出于自动化测试的目的,我尝试使用 Zalenium Docker 系统运行 UI 测试。
测试在 Jenkins slave 上执行,并从 Pipeline 脚本执行:
docker run --rm --name zalenium --detach -p 4444:4444 -v /var/run/docker.sock:/var/run/docker.sock -v /tmp/videos:/home/seluser/videos --privileged dosel/zalenium start"
然后我使用另一个 Docker 容器来执行测试:
docker run --privileged --rm --volume=${workingDirectory}:/volume/git --workdir='/volume/git' some-container-name:0.1 mvn -f /project/pom.xml clean test -Dselenium.hub='http://localhost:4444'
当我执行测试时,我看到以下错误:
Tests run: 3, Failures: 2, Errors: 0,
Skipped: 1, Time elapsed: 1.824 sec <<< FAILURE!
- in TestSuite setupBrowser(com.skybet.myaccount.login.usingCorrectDetails) Time elapsed: 1.108 sec <<< FAILURE!
org.openqa.selenium.remote.UnreachableBrowserException:
Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
System info: host: '96a52140dee0', ip: 'X.X.X.X', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-693.5.2.el7.x86_64', java.version: '1.8.0_151' Driver info: driver.version: RemoteWebDriver Caused by: org.apache.http.conn.HttpHostConnectException: Connect to
127.0.0.1:4444 [/127.0.0.1] failed: Connection refused (Connection refused) Caused by: java.net.ConnectException: Connection refused (Connection refused)
我不确定正确的地址应该是什么。有任何想法吗?