Добрый день!
Имеется десяток тестов на Java, которые отлично проходят при “ручном” запуске из IDEA или из консоли(mvn test) как на локальной машине, так и на удалённой. Но когда я запускаю тесты из TeamCity - около 50% тестов не проходит.
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
4.0.0
<groupId>ru.test</groupId>
<artifactId>SelenideTests</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<includes>
<include>**/*Test*.java</include>
<include>**/*test*.java</include>
<argLine>-Dfile.encoding=UTF-8</argLine>
</includes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>4.2</version>
<scope>test</scope>
</dependency>
</dependencies>
Единственное, на что грешу, разная локализация систем(ну и кодировки конечно же):
Локальная:
D:\apache-maven-3.3.9\bin>mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T19:41:47+03:00)
Maven home: D:\apache-maven-3.3.9
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_121\jre
Default locale: ru_RU, platform encoding: Cp1251
OS name: “windows 10”, version: “10.0”, arch: “amd64”, family: “dos”
Удалённая:
D:\apache-maven-3.3.9\bin>mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T19:41:47+03:00)
Maven home: D:\apache-maven-3.3.9
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_121\jre
Default locale: ru_RU, platform encoding: Cp1251
OS name: “windows 10”, version: “10.0”, arch: “amd64”, family: “dos”
На удалённой
Default locale: en_US
Test set: Admin.Tests.AdminCategoryTests
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 30.16 sec <<< FAILURE! - in Admin.Tests.AdminCategoryTests
userCanSeeAdminCategoryGrid(Admin.Tests.AdminCategoryTests) Time elapsed: 30.094 sec <<< FAILURE!
com.codeborne.selenide.ex.ElementShould: Element should be visible {#rmUserMenu > ul > li.rmItem.rmFirst.rmSettings > span > span}
Element: ‘’
at com.codeborne.selenide.impl.WebElementSource.checkCondition(WebElementSource.java:66)
at com.codeborne.selenide.impl.WebElementSource.findAndAssertElementIsVisible(WebElementSource.java:72)
at com.codeborne.selenide.commands.Click.execute(Click.java:14)
at com.codeborne.selenide.commands.Click.execute(Click.java:11)
at com.codeborne.selenide.commands.Commands.execute(Commands.java:140)
at com.codeborne.selenide.impl.SelenideElementProxy.dispatchAndRetry(SelenideElementProxy.java:86)
at com.codeborne.selenide.impl.SelenideElementProxy.invoke(SelenideElementProxy.java:62)
at com.sun.proxy.$Proxy5.click(Unknown Source)
at HD.PagesAndFrames.MainPage.getUserMenuElements(MainPage.java:34)
at Admin.AdminBase.setUpAdmin(AdminBase.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
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.JUnit4Provider.execute(JUnit4Provider.java:264)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
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)