Jenkins 詹金斯无法选择测试用例

Jenkins 詹金斯无法选择测试用例,jenkins,maven-2,testng,Jenkins,Maven 2,Testng,我正在使用一个带有TestNG的maven项目,该项目包含1个testcase 当我使用cmd手动运行maven时,测试套件会正确执行。 mvn测试-e 当我手动操作时,不会出现任何错误 我已经配置了一个jenkins maven项目。 我已经正确配置了maven和jdk。 我已经正确地传递了pom.xml的路径 目标:测试-e 詹金斯不知何故无法运行我的测试用例。 它找不到我的测试用例 Pom.xml: <project xmlns="http://maven.apache.org/P

我正在使用一个带有TestNG的maven项目,该项目包含1个testcase

当我使用cmd手动运行maven时,测试套件会正确执行。 mvn测试-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>

4.0.0
Jenkin_Demo_项目

詹金斯控制台输出:

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
由用户neha1启动
在工作区C:\Program Files(x86)\Jenkins\workspace\GitMavenProject中生成
>C:\ProgramFiles(x86)\Git\cmd\Git.exe rev parse——在工作树中#timeout=10
从远程Git存储库获取更改
>C:\ProgramFiles(x86)\Git\cmd\Git.exe config remote.origin.urlhttps://github.com/nehabedi/Repo1.git #超时=10
从中获取上游更改https://github.com/nehabedi/Repo1.git
>C:\ProgramFiles(x86)\Git\cmd\Git.exe--版本#超时=10
设置http代理:172.18.65.22:80
>C:\ProgramFiles(x86)\Git\cmd\Git.exe-C core.askpass=true fetch--tags--progresshttps://github.com/nehabedi/Repo1.git +refs/heads/*:refs/remotes/origin/*
>C:\ProgramFiles(x86)\Git\cmd\Git.exe rev parse“refs/remotes/origin/master^{commit}”#timeout=10
>C:\ProgramFiles(x86)\Git\cmd\Git.exe rev parse“refs/remotes/origin/origin/master^{commit}”#timeout=10
检查版本c63d32391414a2a8368c74fb34733fafc66fc5f6(参考/遥控/原点/主控)
>C:\ProgramFiles(x86)\Git\cmd\Git.exe config core.sparsecheckout#timeout=10
>C:\ProgramFiles(x86)\Git\cmd\Git.exe签出-f c63d32391414a2a8368c74fb34733fafc66fc5f6
>C:\ProgramFiles(x86)\Git\cmd\Git.exe版本列表c63d32391414a2a8368c74fb34733fafc66fc5f6#超时=10
解析pom
[Jenkin\u Demo\u Project]$“C:\Program Files\Java\jdk1.8.0\U 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.2.jar;D:\apache-maven-3.2.5/conf/logging“Jenkins.maven3.agent.Maven31Main”D:\apache-maven-3.2.2.2.2.5”C:\Program文件(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
频道启动
正在执行Maven:-B-f C:\Program Files(x86)\Jenkins\workspace\GitMavenProject\Jenkin\u Demo\u Project\pom.xml清洁测试
[信息]正在扫描项目。。。
[信息]
[信息]------------------------------------------------------------------------
[信息]正在构建Jenkin_Demo_项目0.0.1-SNAPSHOT
[信息]------------------------------------------------------------------------
[信息]
[信息]---maven clean插件:2.5:clean(默认清洁)@Jenkin\u Demo\u项目---
[信息]删除C:\Program Files(x86)\Jenkins\workspace\GitMavenProject\Jenkin\u Demo\u Project\target
[信息]
[信息]---maven资源插件:2.6:resources(默认资源)@Jenkin\u Demo\u项目---
[警告]使用平台编码(实际上是Cp1252)复制过滤后的资源,即构建依赖于平台!

[信息]跳过不存在的资源目录C:\Program Files(x86)\Jenkins\workspace\GitMavenProject\Jenkin\u Demo\u Project\src\main\resources [信息] [信息]---maven编译器插件:3.5.1:编译(默认编译)@Jenkin_Demo_项目--- [信息]检测到更改-重新编译模块! [警告]尚未使用平台编码Cp1252设置文件编码,即生成依赖于平台! [信息]正在将1个源文件编译为C:\Program Files(x86)\Jenkins\workspace\GitMavenProject\Jenkin\u Demo\u Project\target\classes [信息] [信息]---maven资源插件:2.6:testResources(默认testResources)@Jenkin\u Demo\u项目--- [警告]使用平台编码(实际上是Cp1252)复制过滤后的资源,即构建依赖于平台!
[信息]跳过不存在的资源目录C:\Program Files(x86)\Jenkins\workspace\GitMavenProject\Jenkin\u Demo\u Project\src\test\resources [信息] [信息]---maven编译器插件:3.5.1:testCompile(默认testCompile)@Jenkin_Demo_项目--- [信息]没有要编译的源 [信息] [信息]---maven surefire插件:2.14:test(默认测试)@Jenkin_Demo_项目--- [信息]没有要运行的测试。 [信息]Surefire报告目录:C:\Program Files(x86)\Jenkins\workspace\GitMavenProject\Jenkin\u Demo\u Project\target\Surefire报告 ------------------------------------------------------- T T S T S ------------------------------------------------------- 结果: 测试运行:0,失败:0,错误:0,跳过:0
乍一看,这看起来很不错。想知道testng.xml的位置对吗?我还将尝试测试要测试的testng依赖项的范围,如

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

org.testng
testng
6.9.10

乍一看,这看起来很不错。想知道testng.xml的位置对吗?我还将尝试测试要测试的testng依赖项的范围,如

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

org.testng
testng
6.9.10

我可以使用eclipse(作为maven测试运行)和命令提示符执行它。只有当jenkins不工作时,它才能正常工作。您在jenkins控制台中看到的错误/信息是什么?另外,在编辑目标和选项后,请检查-Dtests=src/test/resources/testng.xml testskip不存在的资源目录D:\Dexcom\u project\CGM\integration tests\Jenkin\u Demo\u project\src\main\resources。我没有配置为选择“D:\Dexcom\u project\CGM\integration tests\Jenkin\u Demo\u project\src\main\resources”的位置访问文件的路径。在pom.xml中,我指定了testng.xml的正确路径&在testng.xml中,我指定了包含测试用例的类的位置。奇怪的是,在编辑了目标和选项之后,您是否看到了相同的问题?我也能够使用eclipse(以maven test运行)来执行它