Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Testing sbt不识别测试_Testing_Sbt_Junit4 - Fatal编程技术网

Testing sbt不识别测试

Testing sbt不识别测试,testing,sbt,junit4,Testing,Sbt,Junit4,我很难让sbt(版本0.12.1)识别src/test/scala中的任何测试 我尝试过JUnit风格的测试和scalatest风格的测试,但没有成功 简化 我已将测试移到根包(src/test/scala) 我在build.sbt中包括了org.scalatest和junit接口 libraryDependencies++=列表( “org.scalatest”%%“scalatest”%%“1.8”%”测试, com.novocode“%”junit接口“%”0.8“%”测试->默认值 )

我很难让sbt(版本0.12.1)识别src/test/scala中的任何测试

我尝试过JUnit风格的测试和scalatest风格的测试,但没有成功

简化

  • 我已将测试移到根包(src/test/scala)

  • 我在build.sbt中包括了org.scalatest和junit接口 libraryDependencies++=列表( “org.scalatest”%%“scalatest”%%“1.8”%”测试, com.novocode“%”junit接口“%”0.8“%”测试->默认值 )

  • 我已使测试尽可能简单:

  • 缩放示例

    导入org.scalatest.FunSuite 导入scala.collection.mutable.Stack

    类ExampleSuite扩展了FunSuite{

    测试(“数学仍然有效”){ 断言(1+1==2) } }

  • junit测试示例: 导入org.junit.Assert_ 导入org.junit.Test

    类SimpleTest{

    @试验 def testPass(){ 资产质量(1+1,2) }

    }

  • 我的测试结构是: src/test/scala

    import org.junit._
    import org.junit.Assert._
    
    
    class SimpleTeset {
    
      @Test
      def testTrue() {
        assertEquals(1+1, 2)
      }
    }
    
    ├── FunSuiteExample.scala

    └── 斯卡拉简单试验


我遗漏了什么?

根据以下说明:

修改的
build.sbt

  • 从build.sbt中删除了
    “junit”%%“junit”%%“4.10”%%“test”
  • 添加了
    “com.novocode”%”junit接口“%”0.11“%”测试“
将测试放在src/test/scala中

import org.junit._
import org.junit.Assert._


class SimpleTeset {

  @Test
  def testTrue() {
    assertEquals(1+1, 2)
  }
}

sbt测试的控制台输出是什么?适用于sbt 1.1.4