詹金斯没有通过surefire运行TestNG测试
使用Maven和TestNG进行了本地设置,它的构建很好。构建有点奇怪,因为为了运行测试,首先需要打包的JAR。因此,在影响地方安装运行詹金斯没有通过surefire运行TestNG测试
#!/bin/bash mvn clean package -Dmaven.test.skip.exec=true
mvn test
当詹金斯运行,清洁/包装步骤成功一样测试,除了没有测试实际运行:
[workspace] $ mvn -f some_sub_directory/pom.xml test [INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ...-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ project ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /var/lib/jenkins/jobs/...
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ project ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ project ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ project ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ project ---
[INFO] Tests are skipped.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.222s
[INFO] Finished at: Fri Nov 22 18:34:00 UTC 2013
[INFO] Final Memory: 11M/89M
[INFO] ------------------------------------------------------------------------
Finished: SUCCESS
好像在testCompile和测试surefire插件中的目标没有找到任何测试类。
在pom.xml中是否需要额外的配置?
回答:
测试类的默认路径和推荐路径为{basedir}/src/test/java /。 但你可以精确的在你的pom.xml
<build> <testSourceDirectory>{basedir}/path/to/test/classes</testSourceDirectory>
...
</build>
回答:
您需要指定您的测试,需要运行的路径。我相信,它会从测试*开始寻找测试。如果您使用的是testng xml,那么您需要设置它。有关如何以不同方式指定测试的示例,请查询this link。
以上是 詹金斯没有通过surefire运行TestNG测试 的全部内容, 来源链接: utcz.com/qa/261196.html