Trying to get ScalaTest working: “There are no tests to run” when doing “mvn test”

后端 未结 3 814
感情败类
感情败类 2020-12-29 12:13

Edit: I finally got it to work!!!

It needed a combination of JUnit in the pom.xml, and three statements in my .scala:

import org.junit.runner.RunWith         


        
3条回答
  •  孤独总比滥情好
    2020-12-29 12:25

    Adding to Blake's answer, besides @RunWith(classOf[JUnitRunner]) you might also need to set the surefire as follows:

      
        org.apache.maven.plugins
        maven-surefire-plugin
        2.12
        
          
            **/*Suite.class
            **/*Test.class
            **/*Tests.class
            **/*Spec.class
            **/*Specs.class
          
        
      
    

    Here's one of my Maven projects which tests just fine by ScalaTest without any special plugin: https://github.com/nikita-volkov/sext/

提交回复
热议问题