2016-05-09 15 views
0

我使用的是Maven项目使用TestNG挑测试用例,项目包含1测试用例 enter image description here詹无法

当我使用CMD手动运行Maven,测试套件被正确执行。 mvn test -e

我没有得到任何错误,当我做手动。

我已经配置了一个jenkins maven项目。 我已经正确配置maven & jdk。 我已经正确地将路径传递给pom.xml 目标:测试-e

詹金斯莫名其妙地无法运行我的测试用例。 它没有找到我的测试用例。

的pom.xml:

<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>Jenkin_Demo_Project</groupId> 
    <artifactId>Jenkin_Demo_Project</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <build> 
    <sourceDirectory>src</sourceDirectory> 
    <plugins> 
     <plugin> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <version>3.5.1</version> 
     <configuration> 
      <source>1.8</source> 
      <target>1.8</target> 
     </configuration> 
     </plugin> 
     <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-surefire-plugin</artifactId> 
       <version>2.14</version> 
       <configuration> 
       <suiteXmlFiles> 
       <suiteXmlFile>testng.xml</suiteXmlFile> 
      </suiteXmlFiles> 
        <testFailureIgnore>false</testFailureIgnore> 
        <systemProperties> 
         <property> 
          <name>listener</name> 
          <value>ru.yandex.qatools.allure.testng.AllureTestListener</value> 
         </property> 
        </systemProperties> 
       </configuration> 
       </plugin> 
    </plugins> 
    </build> 
    <dependencies> 
    <dependency> 
     <groupId>io.appium</groupId> 
     <artifactId>java-client</artifactId> 
     <version>3.3.0</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.seleniumhq.selenium</groupId> 
     <artifactId>selenium-java</artifactId> 
     <version>2.48.2</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.testng</groupId> 
     <artifactId>testng</artifactId> 
     <version>6.9.10</version> 
    </dependency> 
    </dependencies> 
</project> 

的testng.xml:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> 
<suite name="Example test run"> 
    <test name="StartTest"> 
    <classes> 
     <class name="TestCase.StartApplication"/> 
     </classes> 
    </test> 
</suite> 

请告诉我,我失去了什么,为什么詹的不能来接我的测试情况下,虽然手动其工作精细。 我在本地系统上安装了jenkins。 詹项目的图片: enter image description here

詹金斯控制台输出:

Started by user neha1 
Building in workspace C:\Program Files (x86)\Jenkins\workspace\GitMavenProject 
> C:\Program Files (x86)\Git\cmd\git.exe rev-parse --is-inside-work-tree # timeout=10 
Fetching changes from the remote Git repository 
> C:\Program Files (x86)\Git\cmd\git.exe config remote.origin.url https://github.com/nehabedi/Repo1.git # timeout=10 
Fetching upstream changes from https://github.com/nehabedi/Repo1.git 
> C:\Program Files (x86)\Git\cmd\git.exe --version # timeout=10 
Setting http proxy: 172.18.65.22:80 
> C:\Program Files (x86)\Git\cmd\git.exe -c core.askpass=true fetch --tags --progress https://github.com/nehabedi/Repo1.git +refs/heads/*:refs/remotes/origin/* 
> C:\Program Files (x86)\Git\cmd\git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10 
> C:\Program Files (x86)\Git\cmd\git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10 
Checking out Revision c63d32391414a2a8368c74fb34733fafc66fc5f6 (refs/remotes/origin/master) 
> C:\Program Files (x86)\Git\cmd\git.exe config core.sparsecheckout # timeout=10 
> C:\Program Files (x86)\Git\cmd\git.exe checkout -f c63d32391414a2a8368c74fb34733fafc66fc5f6 
> C:\Program Files (x86)\Git\cmd\git.exe rev-list c63d32391414a2a8368c74fb34733fafc66fc5f6 # timeout=10 
Parsing POMs 
[Jenkin_Demo_Project] $ "C:\Program Files\Java\jdk1.8.0_74/bin/java" -cp "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven31-agent-1.5.jar;D:\apache-maven-3.2.5\boot\plexus-classworlds-2.5.2.jar;D:\apache-maven-3.2.5/conf/logging" jenkins.maven3.agent.Maven31Main D:\apache-maven-3.2.5 "C:\Program Files (x86)\Jenkins\war\WEB-INF\lib\remoting-2.53.3.jar" "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven31-interceptor-1.5.jar" "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.5.jar" 52804 
<===[JENKINS REMOTING CAPACITY]===>channel started 
Executing Maven: -B -f C:\Program Files (x86)\Jenkins\workspace\GitMavenProject\Jenkin_Demo_Project\pom.xml clean test 
[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Jenkin_Demo_Project 0.0.1-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Jenkin_Demo_Project --- 
[INFO] Deleting C:\Program Files (x86)\Jenkins\workspace\GitMavenProject\Jenkin_Demo_Project\target 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Jenkin_Demo_Project --- 
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] skip non existing resourceDirectory C:\Program Files (x86)\Jenkins\workspace\GitMavenProject\Jenkin_Demo_Project\src\main\resources 
[INFO] 
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ Jenkin_Demo_Project --- 
[INFO] Changes detected - recompiling the module! 
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent! 
[INFO] Compiling 1 source file to C:\Program Files (x86)\Jenkins\workspace\GitMavenProject\Jenkin_Demo_Project\target\classes 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Jenkin_Demo_Project --- 
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] skip non existing resourceDirectory C:\Program Files (x86)\Jenkins\workspace\GitMavenProject\Jenkin_Demo_Project\src\test\resources 
[INFO] 
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ Jenkin_Demo_Project --- 
[INFO] No sources to compile 
[INFO] 
[INFO] --- maven-surefire-plugin:2.14:test (default-test) @ Jenkin_Demo_Project --- 
[INFO] No tests to run. 
[INFO] Surefire report directory: C:\Program Files (x86)\Jenkins\workspace\GitMavenProject\Jenkin_Demo_Project\target\surefire-reports 

------------------------------------------------------- 
T E S T S 
------------------------------------------------------- 

Results : 

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 
+0

请发表您jenkins..are在某处检查控制台日志..是代码签出? –

回答

0

一眼看出这看起来OKE。想知道,testng.xml的位置是否正确?我也想尝试TestNG的依赖测试的范围,像

<dependency> 
    <groupId>org.testng</groupId> 
    <artifactId>testng</artifactId> 
    <version>6.9.10</version> 
    <test> 
</dependency> 
+0

我也可以使用eclipse(运行maven测试)来执行它也使用命令提示符。它只适用于jenkins不起作用。 –

+0

什么是您在詹金斯控制台中看到的错误/信息?另外,请在编辑目标和选项后检查-Dtests = src/test/resources/testng.xml test – arin

+0

跳过不存在的资源目录D:\ Dexcom_project \ CGM \ integration-tests \ Jenkin_Demo_Project \ src \ main \ resources。 –