我试图让我的硒测试在詹金斯运行,但面临以下问题。当使用maven test或intellij运行时,测试在我的本地计算机上运行得很好。
Firefox 39 x64 Selenium 2.46.0 SeleniumHQ插件(自动更新,所以应该是最新版本)
根据这个Xvfb服务器应该正在运行
Xvfb starting$ Xvfb :1 -screen 0 1024x758x16 -fbdir /data/jenkins/xvfb-64-6044594236651529452.fbdir
问题出在哪里?我在网上搜索了两天,尝试了几乎所有我找到的东西后,我想不出来了。
资料来源:
public void setUp() throws Exception {
String Xport = System.getProperty("lmportal.xvfb.id", ":1");
FirefoxBinary firefoxBinary = new FirefoxBinary();
firefoxBinary.setEnvironmentProperty("DISPLAY", Xport);
driver = new FirefoxDriver(firefoxBinary, null);
baseUrl = BASE_URL;
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
错误:
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
1436973591335 DeferredSave.extensions.json DEBUG Save changes
1436973591336 addons.xpi DEBUG Updating XPIState for {"id":"fxdriver@googlecode.com","syncGUID":"NERSGr4g-th8","location":"app-profile","version":"2.46.0","type":"extension","internalName":null,"updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Firefox WebDriver","description":"WebDriver implementation for Firefox","creator":"Simon Stewart","homepageURL":null},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"/tmp/anonymous134216584359310857webdriver-profile/extensions/fxdriver@googlecode.com","installDate":1436973590000,"updateDate":1436973590000,"applyBackgroundUpdates":1,"bootstrap":false,"size":8440790,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":true,"hasBinaryComponents":true,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"3.0","maxVersion":"66.*"}],"targetPlatforms":[{"os":"Darwin","abi":null},{"os":"SunOS","abi":null},{"os":"FreeBSD","abi":null},{"os":"OpenBSD","abi":null},{"os":"WINNT","abi":"x86-msvc"},{"os":"Linux","abi":null}],"multiprocessCompatible":false}
1436973591336 addons.xpi DEBUG getModTime: Recursive scan of fxdriver@googlecode.com
1436973591338 addons.xpi DEBUG New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed in app-global
1436973591340 addons.xpi-utils DEBUG Make addon app-global:{972ce4c6-7e08-4474-a285-3208198ce6fd} visible
1436973591340 DeferredSave.extensions.json DEBUG Save changes
1436973591340 DeferredSave.extensions.json DEBUG Save changes
1436973591340 addons.xpi DEBUG Updating XPIState for {"id":"{972ce4c6-7e08-4474-a285-3208198ce6fd}","syncGUID":"oj50TlNJya_g","location":"app-global","version":"39.0","type":"theme","internalName":"classic/1.0","updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Default","description":"The default theme.","creator":"Mozilla","homepageURL":null,"contributors":["Mozilla Contributors"]},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"/data/jenkins/tools/com.cloudbees.jenkins.plugins.customtools.CustomTool/Firefox/firefox/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}","installDate":1435710843000,"updateDate":1435710843000,"applyBackgroundUpdates":1,"skinnable":true,"size":3169,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":true,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"39.0","maxVersion":"39.0"}],"targetPlatforms":[]}
1436973591340 addons.xpi DEBUG getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1436973591341 addons.xpi DEBUG Updating database with changes to installed add-ons
1436973591341 addons.xpi-utils DEBUG Updating add-on states
1436973591341 addons.xpi-utils DEBUG Writing add-ons list
1436973591345 addons.manager DEBUG Registering shutdown blocker for XPIProvider
1436973591346 addons.manager DEBUG Provider finished startup: XPIProvider
1436973591346 addons.manager DEBUG Starting provider: LightweightThemeManager
1436973591346 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager
1436973591346 addons.manager DEBUG Provider finished startup: LightweightThemeManager
1436973591346 addons.manager DEBUG Starting provider: GMPProvider
1436973591350 addons.manager DEBUG Registering shutdown blocker for GMPProvider
1436973591351 addons.manager DEBUG Provider finished startup: GMPProvider
1436973591351 addons.manager DEBUG Starting provider: PluginProvider
1436973591351 addons.manager DEBUG Registering shutdown blocker for PluginProvider
1436973591351 addons.manager DEBUG Provider finished startup: PluginProvider
1436973591352 addons.manager DEBUG Completed startup sequence
1436973591586 DeferredSave.extensions.json DEBUG Starting timer
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:120)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:275)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:116)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:220)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:215)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at cz.bsc.g6.mbs.pda.selenium.ide.Base.setUp(Base.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:59)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:115)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:102)
at org.apache.maven.surefire.Surefire.run(Surefire.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)
是否正在设置显示环境变量?这需要设置,以便在无头模式下执行测试。
我们使用Xvnc Jenkins插件在作业设置中为变量分配一个随机数:
https://wiki.jenkins-ci.org/display/JENKINS/Xvnc插件
下面还有一个非常有用的指南,可以帮助您使用Jenkins启动和运行无头测试:
http://blog.dahanne.net/2011/07/18/run-ui-tests-on-a-headless-jenkins-hudson-continuous-integration-server-running-ubuntu/
我已经使用Appium和Java以及TestNG为Android应用程序编写了一些测试。我的测试在模拟器上本地运行良好,但当我将它们上传到设备场时,我的测试总是失败。我已经尽可能地简化了我的测试,但它仍然不起作用。目前,我尝试运行的测试会在打开应用程序时出现的提示中找到并单击“允许权限”按钮。代码: 观看Device Farm提供的视频,我可以看到它打开并立即关闭我的应用程序。它甚至没有像应该的那
目前,我正在做一个项目的自动化,并通过selenium和java编写测试,当我在本地服务器上从Jenkins执行测试时,它工作正常,但在QAT上,我得到了一个error.Previously我已经编写了selenium测试,现在我已经开始使用Jenkins在我的Windows平台上构建和集成Git。 此外,我用于QAT服务器的chrome路径是我已经更改为 System.setProperty(“
当在我的本地机器上用Visual Studio中的C#运行Selenium测试时,测试运行良好并且全部通过。然而,当我试图在詹金斯上运行它们时,它们失败了。如果我使用FireFox,那么Jenkins运行良好。问题是,我的老板想要使用IE因为这是我们公司最常用的。 下面是无法运行的代码: 最后但并非最不重要的是StackTrace: 在system.net.httpwebrequest.getre
我已经使用TestNG注释和maven创建了脚本。它在Eclipse中运行,我也尝试运行testng。xml文件,看起来不错。然后我配置了Jenkins,但现在它没有运行。Jenkins给出的错误如下:(仅供参考:我以前已经成功构建了Jenkins,这怎么可能在一天内打破?) 在端口48847上启动ChromeDriver 72.0.3626.69(3C16F8A135ABC0D4DA2DF338
我创建了一个测试项目(maven)来测试REST API的性能。我正在使用Jeter插件 这是我的pom片段 我有一个Jenkins文件在我的项目像这样 当我触发Jenkins上的构建时,构建成功了,我在控制台输出中看到了这一点 问题是,它什么也做不了。Performace趋势图没有显示任何东西。 如果我在本地机器上运行相同的项目,它工作得非常好。我在日志中看到类似的东西,证实了这一点。生成的输出
我有一个运行selenium phpunit测试的ant构建脚本。我可以在命令行上运行构建脚本,然后看到测试正在进行,浏览器窗口打开,并且selenium测试正在执行。命令行上一切正常。 但是,如果我得到创建一个jenkins jobs来运行构建脚本。它在尝试运行phpunit任务时失败。这是控制台输出。 看起来,当jenkins运行构建时,它不能访问Selenium。请参阅“访问被拒绝”和“网页