How to run JUnit tests with Mill

270 Views Asked by At

I have some JUnit tests I want to run.

In sbt all I have to do is adding this dependency:

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

According to the Mill documentation you have to add the custom framework like:

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

What do I have to do that my JUnit Tests work?

1

There are 1 best solutions below

0
On BEST ANSWER

While writing the question I figured it out:

In build.sh you have:

  • To add this test dependency: ivy"com.novocode:junit-interface:0.11"
  • to add this test framework: com.novocode.junit.JUnitFramework

The whole component looks then:

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")
  }
}