dux2 dux2 - 2 months ago 61
Scala Question

How to show ScalaTest tests nicely in TeamCity

I am new to Scala and integrating it in an existing Java project.

The project is built with Maven (already configured the pom.xml successfully to compile and both Java and Scala code and run both lang's tests in a single project).

Our TeamCity Server has a Maven build step.

I have created a new unit test in ScalaTest, but when TeamCity runs the build, it does not identify this test as a test, so I can only see the result in the full build log, but not in the "Tests" tab.

Searched for a ScalaTest plugin for TeamCity but did not found any.

Any ideas? thanks.

Answer

I managed to solve this in a pretty simple way. It turns out that the maven plugin for scalatest can generate reports in junit format. I changed the output folder for those reports to the same as the report folder of the surefire plugin (target/surefire-reports) and that's it.

Actually the basic sample at scalatest guide shows the correct configuration.

<plugin>
  <groupId>org.scalatest</groupId>
  <artifactId>scalatest-maven-plugin</artifactId>
  <version>1.0</version>
  <configuration>
    <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
    <junitxml>.</junitxml>
    <filereports>WDF TestSuite.txt</filereports>
  </configuration>
  <executions>
    <execution>
      <id>test</id>
      <goals>
        <goal>test</goal>
      </goals>
    </execution>
  </executions>
</plugin>