scalajunitmill

How to run JUnit tests with Mill


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?


Solution

  • While writing the question I figured it out:

    In build.sh you have:

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