Всем привет! Есть проект: maven+selenium+testng. Через консоль mvn test проект собирается и запускается без ошибок. Но при запуске из jenkins появляются проблемы. Подскажите в чём может быть причина?
Вот лог: (извините за его длину, что-то спойлера не нашёл)
Started by user anonymous Building in workspace /var/lib/jenkins/workspace/ag > git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url https://тут проект # timeout=10 Fetching upstream changes from https://github.com/ > git --version # timeout=10 > git -c core.askpass=true fetch --tags --progress https://github.com/тут проект +refs/heads/*:refs/remotes/origin/* > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10 Checking out Revision c0de58eb377d377047970330fc7bbd40c21bb51b (refs/remotes/origin/master) > git config core.sparsecheckout # timeout=10 > git checkout -f c0de58eb377d377047970330fc7bbd40c21bb51b > git rev-list c0de58eb377d377047970330fc7bbd40c21bb51b # timeout=10 [ag] $ mvn test -P testcontur [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building project 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @project --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 2 resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ project --- [INFO] Changes detected - recompiling the module! [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 4 source files to /var/lib/jenkins/workspace/ag/target/classes [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ project --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ project --- [INFO] Changes detected - recompiling the module! [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 5 source files to /var/lib/jenkins/workspace/ag/target/test-classes [INFO] [INFO] --- maven-surefire-plugin:2.16:test (default-test) @ project --- [INFO] Surefire report directory: /var/lib/jenkins/workspace/ag/target/surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running TestSuite ... ... TestNG 6.9.4 by Cédric Beust (cedric@beust.com) ... org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: (process:12669): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed Error: no display specified 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:132) at ru.stqa.selenium.factory.WebDriverFactoryInternal.createLocalDriver(WebDriverFactoryInternal.java:74) at ru.stqa.selenium.factory.WebDriverFactoryInternal.newDriver(WebDriverFactoryInternal.java:58) at ru.stqa.selenium.factory.ThreadLocalSingletonStorage.createNewDriver(ThreadLocalSingletonStorage.java:91) at ru.stqa.selenium.factory.ThreadLocalSingletonStorage.getDriver(ThreadLocalSingletonStorage.java:36) at ru.stqa.selenium.factory.WebDriverFactoryInternal.getDriver(WebDriverFactoryInternal.java:49) at ru.stqa.selenium.factory.WebDriverFactory.getDriver(WebDriverFactory.java:39) at qwe.TestBase.init(TestBase.java:46) 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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:517) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:140) at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:170) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:104) at org.testng.TestRunner.privateRun(TestRunner.java:771) at org.testng.TestRunner.run(TestRunner.java:621) at org.testng.SuiteRunner.runTest(SuiteRunner.java:357) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310) at org.testng.SuiteRunner.run(SuiteRunner.java:259) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1199) at org.testng.TestNG.runSuitesLocally(TestNG.java:1124) at org.testng.TestNG.run(TestNG.java:1032) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:217) at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:84) at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:92) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) Tests run: 12, Failures: 1, Errors: 0, Skipped: 11, Time elapsed: 46.801 sec <<< FAILURE! - in TestSuite init(qwe.Login) Time elapsed: 46.664 sec <<< FAILURE! org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/usr/bin/firefox) on port 7055; process output follows: (process:12669): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed Error: no display specified Build info: version: '2.46.0', revision: '61506a4624b13675f24581e453592342b7485d71', time: '2015-06-04 10:22:50' System info: host: 'nout', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.19.0-25-generic', java.version: '1.7.0_79' Driver info: driver.version: FirefoxDriver at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:132) 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:132) at ru.stqa.selenium.factory.WebDriverFactoryInternal.createLocalDriver(WebDriverFactoryInternal.java:74) at ru.stqa.selenium.factory.WebDriverFactoryInternal.newDriver(WebDriverFactoryInternal.java:58) at ru.stqa.selenium.factory.ThreadLocalSingletonStorage.createNewDriver(ThreadLocalSingletonStorage.java:91) at ru.stqa.selenium.factory.ThreadLocalSingletonStorage.getDriver(ThreadLocalSingletonStorage.java:36) at ru.stqa.selenium.factory.WebDriverFactoryInternal.getDriver(WebDriverFactoryInternal.java:49) at ru.stqa.selenium.factory.WebDriverFactory.getDriver(WebDriverFactory.java:39) at qwe.TestBase.init(TestBase.java:46) 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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:517) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:140) at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:170) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:104) at org.testng.TestRunner.privateRun(TestRunner.java:771) at org.testng.TestRunner.run(TestRunner.java:621) at org.testng.SuiteRunner.runTest(SuiteRunner.java:357) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310) at org.testng.SuiteRunner.run(SuiteRunner.java:259) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1199) at org.testng.TestNG.runSuitesLocally(TestNG.java:1124) at org.testng.TestNG.run(TestNG.java:1032) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:217) at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:84) at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:92) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: (process:12669): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed Error: no display specified 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:132) at ru.stqa.selenium.factory.WebDriverFactoryInternal.createLocalDriver(WebDriverFactoryInternal.java:74) at ru.stqa.selenium.factory.WebDriverFactoryInternal.newDriver(WebDriverFactoryInternal.java:58) at ru.stqa.selenium.factory.ThreadLocalSingletonStorage.createNewDriver(ThreadLocalSingletonStorage.java:91) at ru.stqa.selenium.factory.ThreadLocalSingletonStorage.getDriver(ThreadLocalSingletonStorage.java:36) at ru.stqa.selenium.factory.WebDriverFactoryInternal.getDriver(WebDriverFactoryInternal.java:49) at ru.stqa.selenium.factory.WebDriverFactory.getDriver(WebDriverFactory.java:39) at qwe.TestBase.init(TestBase.java:46) 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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:517) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:140) at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:170) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:104) at org.testng.TestRunner.privateRun(TestRunner.java:771) at org.testng.TestRunner.run(TestRunner.java:621) at org.testng.SuiteRunner.runTest(SuiteRunner.java:357) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310) at org.testng.SuiteRunner.run(SuiteRunner.java:259) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1199) at org.testng.TestNG.runSuitesLocally(TestNG.java:1124) at org.testng.TestNG.run(TestNG.java:1032) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:217) at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:84) at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:92) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) Results : Failed tests: Login>TestBase.init:46 » WebDriver Failed to connect to binary FirefoxBinary(/... Tests run: 12, Failures: 1, Errors: 0, Skipped: 11 [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 51.748s [INFO] Finished at: Sun Jan 24 15:44:17 MSK 2016 [INFO] Final Memory: 23M/251M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-test) on project project: There are test failures. [ERROR] [ERROR] Please refer to /var/lib/jenkins/workspace/ag/target/surefire-reports for the individual test results. [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException Build step 'Вызвать цели Maven верхнего уровня ' marked build as failure Finished: FAILURE
И, на всякий случай, pom файл:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>qwe</groupId> <artifactId>project</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <dependencies> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.9.4</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency> <dependency> <groupId>ru.stqa.selenium</groupId> <artifactId>webdriver-factory</artifactId> <version>1.1.46</version> </dependency> </dependencies> <build> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> </resources> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.6</version> <configuration> <encoding>UTF-8</encoding> </configuration> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>2.16</version> <configuration> <suiteXmlFiles> <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile> </suiteXmlFiles> </configuration> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build> <!-- profiles --> <profiles> <profile> <id>local</id> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <env>local</env> <user.username></user.username> <user.password></user.password> <grid2.hub></grid2.hub> <site.url>http://localhost/</site.url> <browser.name>firefox</browser.name> <browser.version></browser.version> <browser.platform></browser.platform> </properties> <activation> <activeByDefault>true</activeByDefault> </activation> </profile> <profile> <id>dev</id> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <env>dev</env> <user.username></user.username> <user.password></user.password> <grid2.hub></grid2.hub> <site.url>http://devhost/</site.url> <browser.name>firefox</browser.name> <browser.version></browser.version> <browser.platform></browser.platform> </properties> </profile> <profile> <id>test</id> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <env>test</env> <user.username></user.username> <user.password></user.password> <grid2.hub></grid2.hub> <site.url>http://testhost/</site.url> <browser.name>firefox</browser.name> <browser.version></browser.version> <browser.platform></browser.platform> </properties> </profile> <profile> <id>testcontur</id> <properties> <env>testcontur</env> <user.username></user.username> <user.password></user.password> <grid2.hub> </grid2.hub> <site.url>http://ya.ru/</site.url> <browser.name>firefox</browser.name> <browser.version></browser.version> <browser.platform></browser.platform> </properties> </profile> <profile> <id>force-local-driver</id> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <grid2.hub></grid2.hub> </properties> </profile> </profiles> </project>
В maven запускаю так:
test -P testcontur
У меня ubuntu 14.04 , установлен firefox версии 41.