День добрый.
При запуске тестов #java + #webdriver + #testng + #maven на #jenkins , тесты прогоняются 2 раза.
У меня несколько testng.xml файлов, в каждом определенные суиты. При запуске
mvn -DsuiteXmlFile=testng1.xml проходиn нужный мне суит и после этого запускается вторичный прогон дефолтного testng.xml.
Т.е сначала mvn clean install и второй раз из pom файла, как можно отключить повторный прогон?
<?xml version="1.0" encoding="UTF-8"?>
<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>Pokupo</groupId>
<artifactId>Pokupo1</artifactId>
<packaging>jar</packaging>
<version>1.1-SNAPSHOT</version>
<name>Pokupo</name>
<description>TestPokupo</description>
<repositories>
<repository>
<id>jcenter</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>
<properties>
<suiteXmlFile>testng.xml</suiteXmlFile>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin></plugins>
</build>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.0.0-beta4</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
</project>
Вот вывод консоли:
Started by user jadmin
Building in workspace /var/lib/jenkins/workspace/Test
> /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> /usr/bin/git config remote.origin.url https://github.com/test/Tests.git # timeout=10
Fetching upstream changes from https://github.com/testTests.git
> /usr/bin/git --version # timeout=10
using GIT_ASKPASS to set credentials
> /usr/bin/git fetch --tags --progress https://github.com/test/Tests.git +refs/heads/*:refs/remotes/origin/*
> /usr/bin/git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> /usr/bin/git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 15c1e7a3d3d76ce8a1d7ac62c07f042fd8cb1779 (refs/remotes/origin/master)
> /usr/bin/git config core.sparsecheckout # timeout=10
> /usr/bin/git checkout -f 15c1e7a3d3d76ce8a1d7ac62c07f042fd8cb1779
> /usr/bin/git rev-list 15c1e7a3d3d76ce8a1d7ac62c07f042fd8cb1779 # timeout=10
Xvfb starting$ Xvfb :1 -screen 0 1440x900x24 -fbdir /var/lib/jenkins/xvfb-68-745359035723510083.fbdir
[Test] $ /usr/share/maven/bin/mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Pokupo 1.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Pokupo1 ---
[INFO] Deleting /var/lib/jenkins/workspace/Test/target
[INFO]
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ Pokupo1 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /var/lib/jenkins/workspace/Test/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ Pokupo1 ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 15 source files to /var/lib/jenkins/workspace/Test/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.3:testResources (default-testResources) @ Pokupo1 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /var/lib/jenkins/workspace/Test/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ Pokupo1 ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 6 source files to /var/lib/jenkins/workspace/Test/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ Pokupo1 ---
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Starting ChromeDriver 2.22 (undefined) on port 19469
Only local connections are allowed.
Nov 21, 2016 12:27:12 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Nov 21, 2016 12:27:12 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Starting ChromeDriver 2.22 (undefined) on port 9136
Only local connections are allowed.
Nov 21, 2016 12:27:23 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Nov 21, 2016 12:27:25 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Starting ChromeDriver 2.22 (undefined) on port 1527
Only local connections are allowed.
Nov 21, 2016 12:27:37 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Nov 21, 2016 12:27:37 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Starting ChromeDriver 2.22 (undefined) on port 31011
Only local connections are allowed.
Nov 21, 2016 12:27:50 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Nov 21, 2016 12:27:50 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 51.065 sec - in TestSuite
Results :
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ Pokupo1 ---
[INFO] Building jar: /var/lib/jenkins/workspace/Test/target/Pokupo1-1.1-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ Pokupo1 ---
[INFO] Installing /var/lib/jenkins/workspace/Test/target/Pokupo1-1.1-SNAPSHOT.jar to /var/lib/jenkins/.m2/repository/Pokupo/Pokupo1/1.1-SNAPSHOT/Pokupo1-1.1-SNAPSHOT.jar
[INFO] Installing /var/lib/jenkins/workspace/Test/pom.xml to /var/lib/jenkins/.m2/repository/Pokupo/Pokupo1/1.1-SNAPSHOT/Pokupo1-1.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 55.435s
[INFO] Finished at: Mon Nov 21 12:28:03 MSK 2016
[INFO] Final Memory: 22M/53M
[INFO] ------------------------------------------------------------------------
Parsing POMs
Established TCP socket on 35557
[Test] $ /var/lib/jenkins/tools/hudson.model.JDK/JAVA_HOME/bin/java -Dfile.encoding=UTF-8 -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.8.1.jar:/usr/share/maven/boot/plexus-classworlds-2.x.jar org.jvnet.hudson.maven3.agent.Maven3Main /usr/share/maven /var/cache/jenkins/war/WEB-INF/lib/remoting-2.62.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.8.1.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.8.1.jar 35557
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /var/lib/jenkins/workspace/Test/pom.xml install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Pokupo 1.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ Pokupo1 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /var/lib/jenkins/workspace/Test/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ Pokupo1 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.3:testResources (default-testResources) @ Pokupo1 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /var/lib/jenkins/workspace/Test/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ Pokupo1 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ Pokupo1 ---
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Starting ChromeDriver 2.22 (undefined) on port 9627
Only local connections are allowed.
Nov 21, 2016 12:28:09 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Nov 21, 2016 12:28:10 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Starting ChromeDriver 2.22 (undefined) on port 27736
Only local connections are allowed.
Nov 21, 2016 12:28:23 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Nov 21, 2016 12:28:23 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Starting ChromeDriver 2.22 (undefined) on port 2645
Only local connections are allowed.
Nov 21, 2016 12:28:36 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Nov 21, 2016 12:28:36 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Starting ChromeDriver 2.22 (undefined) on port 26147
Only local connections are allowed.
Nov 21, 2016 12:28:48 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Nov 21, 2016 12:28:48 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 51.799 sec - in TestSuite
Results :
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0
[JENKINS] Recording test results
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ Pokupo1 ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ Pokupo1 ---
[INFO] Installing /var/lib/jenkins/workspace/Test/target/Pokupo1-1.1-SNAPSHOT.jar to /var/lib/jenkins/.m2/repository/Pokupo/Pokupo1/1.1-SNAPSHOT/Pokupo1-1.1-SNAPSHOT.jar
[INFO] Installing /var/lib/jenkins/workspace/Test/pom.xml to /var/lib/jenkins/.m2/repository/Pokupo/Pokupo1/1.1-SNAPSHOT/Pokupo1-1.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 56.784s
[INFO] Finished at: Mon Nov 21 12:29:03 MSK 2016
[INFO] Final Memory: 13M/32M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving /var/lib/jenkins/workspace/Test/pom.xml to Pokupo/Pokupo1/1.1-SNAPSHOT/Pokupo1-1.1-SNAPSHOT.pom
[JENKINS] Archiving /var/lib/jenkins/workspace/Test/target/Pokupo1-1.1-SNAPSHOT.jar to Pokupo/Pokupo1/1.1-SNAPSHOT/Pokupo1-1.1-SNAPSHOT.jar
Xvfb stopping
channel stopped
Finished: SUCCESS
Как видно тесты запустились 2 раза.