Maven不会运行Scala测试 [英] Maven won't run scala tests
本文介绍了Maven不会运行Scala测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用此处中所述的Maven Scala测试插件.我定义了两个测试类,并将它们放在src/test/scala
下:
I'm using maven scala test plugin as described here. I defined two test classes and put them under src/test/scala
:
测试如下所示:
class LoginTest extends FlatSpec with ShouldMatchers with WebBrowser with Eventually with IntegrationPatience {
...
}
我的pom.xml
包含以下依赖项/配置:
My pom.xml
contains the following dependencies / configuration:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.44.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.11</artifactId>
<version>2.2.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<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>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.2</version>
<executions>
<execution>
<id>scala-compile</id>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
当我运行mvn test
时,我收到消息:
When I run mvn test
I got the message:
[INFO] --- scalatest-maven-plugin:1.0:test (test) @ selenium ---
Discovery starting.
Discovery completed in 30 milliseconds.
Run starting. Expected test count is: 0
DiscoverySuite:
Run completed in 91 milliseconds.
Total number of tests run: 0
Suites: completed 1, aborted 0
Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0
No tests were executed.
从Intellij
调用测试会显示一条消息:
Calling tests from Intellij
brings a message:
0 test class found in package '<default package>'
推荐答案
在我的情况下,我必须进行2项更改才能使其正常工作:
I had to make 2 changes for this to work in my case:
- 更改文件报告的名称,删除空间:
<filereports>WDFTestSuite.txt</filereports>
- 明确地说不要跳过测试:
<skipTests>false</skipTests>
- Change the name of the filereport, remove space:
<filereports>WDFTestSuite.txt</filereports>
- Explicitly say not to skip tests:
<skipTests>false</skipTests>
因此,配置块如下所示:
So the configuration block looks like this:
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>WDFTestSuite.txt</filereports>
<skipTests>false</skipTests>
</configuration>
这篇关于Maven不会运行Scala测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文