Can't run Scalatest with Gradle

前端 未结 5 444
醉梦人生
醉梦人生 2021-02-02 09:28
task scalaTest(dependsOn: testClasses) << {
    description = \'Runs Scalatest suite\'
    ant.taskdef(name: \'scalatest\',
            classname: \'org.scalatest.         


        
5条回答
  •  暖寄归人
    2021-02-02 09:40

    I do not know how to solve this one, but I can offer you a workaround. Annotate your test classes with @RunWith(classOf[JUnitRunner]), like this:

    import org.scalatest.junit.JUnitRunner
    import org.junit.runner.RunWith
    
    @RunWith(classOf[JUnitRunner])
    class MyTest extends FunSpec{
    }
    

    and then, gradle test should work.

    Edit:

    My dependencies:

    compile "org.scala-lang:scala-library:2.10.1"
    testCompile "org.scalatest:scalatest_2.10:1.9.1"
    

提交回复
热议问题