maven中的Scalatest:JUnit结果(Scalatest in maven: JUnit results)
我有一个在Microsoft Visual Studio Team Services中设置的持续集成服务器。 我能够构建我的代码并通过scalatest运行我的测试。
但是,我无法弄清楚如何以JUnit格式输出结果。 我看到很多使用SBT的人的结果,但没有人使用Maven 。
在配置下,'junitxml'标签是否应该生成正确的文件? 这意味着它就是微软的问题。
我的scalatest插件目前看起来像:
<plugin> <groupId>org.scalatest</groupId> <artifactId>scalatest-maven-plugin</artifactId> <version>${maven.plugin.scalatest.version}</version> <configuration> <reportsDirectory>${project.build.directory}/scalatest-reports</reportsDirectory> <junitxml>jUnitResults</junitxml> <filereports>SparkTestSuite.txt</filereports> </configuration> <executions> <execution> <id>test</id> <goals> <goal>test</goal> </goals> </execution> </executions> </plugin>
更新1:
结果文件无效。 确保文件'C:/a/1/s/common/target/scalatest-reports/jUnitResults/TEST-org.scalatest.tools.DiscoverySuite-2d5739be-0653-4b9d-a8ed-41b6d0f82e48.xml'的结果格式'匹配'JUnit'测试结果格式。
I have a continuous integration server set up in Microsoft Visual Studio Team Services. I am able to build my code and run my tests through scalatest.
However, I cannot figure out how to output the results in a JUnit format. I have seen many results for people using SBT, but none who are using Maven.
Under configuration, is the 'junitxml' tag supposed to generate the correct file? This would mean it's a Microsoft problem then.
My scalatest plugin currently look like:
<plugin> <groupId>org.scalatest</groupId> <artifactId>scalatest-maven-plugin</artifactId> <version>${maven.plugin.scalatest.version}</version> <configuration> <reportsDirectory>${project.build.directory}/scalatest-reports</reportsDirectory> <junitxml>jUnitResults</junitxml> <filereports>SparkTestSuite.txt</filereports> </configuration> <executions> <execution> <id>test</id> <goals> <goal>test</goal> </goals> </execution> </executions> </plugin>
Update 1:
Invalid results file. Make sure the result format of the file 'C:/a/1/s/common/target/scalatest-reports/jUnitResults/TEST-org.scalatest.tools.DiscoverySuite-2d5739be-0653-4b9d-a8ed-41b6d0f82e48.xml' matches 'JUnit' test results format.
最满意答案
我想我能搞清楚这一点。 我的问题是我对VSTS的误解。 但是,我的测试生成了JUnit格式化的测试结果以及非JUnit格式化的结果。 所以在我的构建配置中,我需要删除不必要的测试结果文件。 VSTS不是最直观的使用工具,所以我对测试结果的去向感到困惑。 我的构建文件显示了通过测试的数量,但没有详细信息。 我发现如果在构建期间测试失败,失败的详细信息将显示在构建页面上。 如果我想查看通过的测试的实际名称,我需要转到“测试”选项卡并查看“运行”。 在那里我会看到更详细的结果。
I think I was able to figure this out. My problem was with my misunderstanding of VSTS. However, my tests were generating both the JUnit formatted test results, as well as non-JUnit formatted results. So in my build configuration I need to remove the unnecessary test result files. VSTS is not the most intuitive tool to use, so I was confused as to where the test results were going. My build file shows me the number of tests that passed, but not details. I discovered that if a test fails during a build, details of the failure will show up on the build page. If I want to see the actual names of the tests which passed, I need to go to the "Test" tab and look under "Runs". There I will see a more detailed result.
相关问答
更多-
我只是有这个错误,并通过解决方案。 我的pom.xml文件具有以下依赖性:
org.powermock powermock-mockito-release-full 1.5 full test -
不幸的是,如果没有修补maven surefire报告插件,我认为这不容易实现。 报告插件使用surefire XML报告并使用Doxia库生成maven HTML报告。 生成报告的类在这里: http://maven.apache.org/plugins/maven-surefire-report-plugin/xref/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.html 修补此类以改变报告输出几乎是直截了当的; 但是 ...
-
默认情况下,Maven在查找要运行的测试时使用以下命名约定: Test* *Test *TestCase 您的测试类不遵循这些约定。 您应该重命名或配置Maven Surefire Plugin以使用另一种模式进行测试类。 By default Maven uses the following naming conventions when looking for tests to run: Test* *Test *TestCase Your test class doesn't follow these ...
-
编辑 - 通过评论解决:在您的屏幕截图中, test.iml位于您的测试文件夹中。 是否有排除或其他什么? 你能尝试删除那个文件吗? 您可以尝试在IntelliJ File | Invalidate Cache (通过File | Invalidate Cache )。 您还可以在IDE中尝试重建项目(通过Build | Rebuild Project )。 您还可以尝试通过Maven 同步项目 (重新导入所有Maven项目)(右侧某处应该有Maven Tab,或者通过键入Maven Projects进入C ...
-
我从引用的课程中检查了任务项目,它实际上具有相当复杂的结构,使用在project/*.scala文件中定义构建的不推荐方式,扩展了Build 。 尽管如此,您的问题的答案很简单:在project/CommonBuild.scala定义了scalatest依赖project/CommonBuild.scala并将其添加到project/StudentBuildLike.scala的构建版本中。 所以没有魔法,你使用普通的scalatest和一个自定义的测试运行器(参见project/ScalaTestRunn ...
-
如何确保在使用maven失败的jUnit测试后进行清理?(How to ensure cleanup after failed jUnit tests using maven?)[2023-02-18]
目前, failsafe:verify绑定到integration-test阶段:run-nonautowired-tests integration-test integration-test verify ... -
我想我能搞清楚这一点。 我的问题是我对VSTS的误解。 但是,我的测试生成了JUnit格式化的测试结果以及非JUnit格式化的结果。 所以在我的构建配置中,我需要删除不必要的测试结果文件。 VSTS不是最直观的使用工具,所以我对测试结果的去向感到困惑。 我的构建文件显示了通过测试的数量,但没有详细信息。 我发现如果在构建期间测试失败,失败的详细信息将显示在构建页面上。 如果我想查看通过的测试的实际名称,我需要转到“测试”选项卡并查看“运行”。 在那里我会看到更详细的结果。 I think I was abl ...
-
Spring - 从JUnit和Maven运行时的不同测试结果(Spring - Different test results when running from JUnit and Maven)[2022-08-28]
! 解决了 ! 第一 问题 。 当在同一个项目中包含两个验证器时,似乎是一种不兼容性:javax.validation validation-api 1.1.0.Final org.hibernat ... -
如何使用maven-gunit-plugin生成JUnit源代码(How to generate JUnit sources using maven-gunit-plugin)[2021-10-27]
我通过MNG-4039找到了一个用 maven-gunit-plugin gunit-maven-plugin样本进行说明的讨论。 我会让你阅读整篇文章,但据作者说,你最终会得到这样的结论:org.antlr antlr-runtime 3.1.1