作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有以下故障安全设置,当我“正常”运行时(=使用 mvn verify,并且不使用 dependencyToScan),它会按预期工作:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<failIfNoTests>true</failIfNoTests>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/mySuite.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
但是,当我采用完全相同的故障安全设置,并在“test-runner”pom/项目中使用“dependencyToScan”扩展它时,该项目仅从 jar 文件运行测试(因此我不会重新编译/重建每次我想运行集成测试时整个项目):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<failIfNoTests>true</failIfNoTests>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/mySuite.xml</suiteXmlFile>
</suiteXmlFiles>
<dependenciesToScan>
<dependency>${test.library.groupId}:${test.library.artifactId}</dependency>
</dependenciesToScan>
</configuration>
</plugin>
发生的情况是这样的:
我检查了各种各样的东西,并尝试了一些东西,所以我不确定我可能会在这里遗漏什么。如果我不使用 dependencyToScan,插件配置显然可以正常工作。
当您使用dependencyToScan时,故障安全插件中是否有可能存在一个错误,该错误会破坏验证业务逻辑?
Tests run: 79, Failures: 6, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-failsafe-plugin:2.18.1:verify (default) @ test-runner ---
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-failsafe-plugin:2.18.1:verify from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-failsafe-plugin:2.18.1, parent: sun.misc.Launcher$AppClassLoader@42a57993]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-failsafe-plugin:2.18.1:verify' with basic configurator -->
[DEBUG] (s) basedir = /xyz/test-runner
[DEBUG] (f) encoding = UTF-8
[DEBUG] (s) failIfNoTests = true
[DEBUG] (s) reportsDirectory = /xyz/test-runner/target/failsafe-reports
[DEBUG] (s) skip = false
[DEBUG] (f) summaryFile = /xyz/test-runner/target/failsafe-reports/failsafe-summary.xml
[DEBUG] (s) testClassesDirectory = /xyz/test-runner/target/test-classes
[DEBUG] (s) testFailureIgnore = false
[DEBUG] -- end configuration --
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:27 min
[INFO] Finished at: 2015-03-13T22:44:46-04:00
[INFO] Final Memory: 13M/250M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.18.1:verify (default) on project test-runner: No tests to run! -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.18.1:verify (default) on project test-runner: No tests to run!
最佳答案
嗯...首先从您发布的内容看来您的配置是错误的:
您已这样配置:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<failIfNoTests>true</failIfNoTests>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/mySuite.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
<dependenciesToScan>
<dependency>${test.library.groupId}:${test.library.artifactId} </dependency>
</dependenciesToScan>
</plugin>
我很惊讶你没有从 Maven 中得到失败......
但它应该看起来像这样。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<failIfNoTests>true</failIfNoTests>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/mySuite.xml</suiteXmlFile>
</suiteXmlFiles>
<dependenciesToScan>
<dependency>${test.library.groupId}:${test.library.artifactId} </dependency>
</dependenciesToScan>
</configuration>
</plugin>
因为调试输出不显示任何类型的配置来代表您在配置中编写的内容(dependencyToScan)。
关于java - maven故障安全:verify broken when using dependenciesToScan?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29050477/
我有以下故障安全设置,当我“正常”运行时(=使用 mvn verify,并且不使用 dependencyToScan),它会按预期工作: org.apache.maven.plugins m
我是一名优秀的程序员,十分优秀!