Run JUnit tests with SBT

后端 未结 2 2080
南旧
南旧 2020-12-01 16:26

I have a 0.13.7 SBT project, with several sub-projects.

One of them is called webapp, and it has many JUnit tests in webapp/src/test/

2条回答
  •  长情又很酷
    2020-12-01 17:01

    This question about supporting JUnit in SBT has been asked multiple times with slightly different framings.

    Multiple hits made it hard for me to find the simplest and most current answer.

    This answer by @david.perez seems clear and works with current (2018) SBT 1.1.4.

    (That particular question was about conflicting JUnit versions. The exclude("junit", "junit-dep") may not be necessary.)

    I'll also copy-paste the code here for quick access:

    libraryDependencies ++= Seq(
      "junit" % "junit" % "4.12" % Test,
      "com.novocode" % "junit-interface" % "0.11" % Test exclude("junit", "junit-dep")
    )
    

提交回复
热议问题