Scalatest in maven: JUnit results

馋奶兔 提交于 2021-02-19 08:28:24

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/39730260/scalatest-in-maven-junit-results

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!