【问题标题】:How to run JUnit tests with Mill如何使用 Mill 运行 JUnit 测试
【发布时间】:2019-12-25 18:19:24
【问题描述】:

我有一些想要运行的 JUnit 测试。

sbt 中我所要做的就是添加这个依赖:

"com.novocode" % "junit-interface" % "0.11" % "test"

根据Mill documentation,您必须添加自定义框架,例如:

def testFrameworks = Seq("org.scalatest.tools.Framework", "WHAT GOES HERE?")

我需要做什么才能让我的 JUnit 测试正常工作?

【问题讨论】:

    标签: scala junit mill


    【解决方案1】:

    在写问题的时候我想通了:

    build.sh 你有:

    • 添加此测试依赖项: ivy"com.novocode:junit-interface:0.11"
    • 添加此测试框架: com.novocode.junit.JUnitFramework

    然后整个组件看起来:

    object myModule extends ScalaModule {
      def scalaVersion = "2.12.8"
      object test extends Tests {
        override def ivyDeps = Agg(
          ivy"org.scalatest::scalatest:3.0.5",
          ivy"com.novocode:junit-interface:0.11"
        )
    
        def testFrameworks = Seq("org.scalatest.tools.Framework", 
             "com.novocode.junit.JUnitFramework")
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2014-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-31
      • 2015-03-26
      • 2011-05-29
      • 1970-01-01
      • 2017-03-28
      相关资源
      最近更新 更多