playframework - How can I use TestNG with Java Play 2.4.x? -


i use testng in java play project instead of junit testing (it has more robust features). however, there doesn't appear documentation on how since play seems treat java second class citizen compared scala. know how configure java play project use testng?

  1. add following dependencies build.sbt:
     librarydependencies ++= seq(   ...   "org.testng" % "testng" % "6.8.8",   "de.johoop" % "sbt-testng-interface_2.10" % "3.0.0",   "org.scalatest" %% "scalatest" % "2.2.1",   "org.scalatestplus" %% "play" % "1.4.0-m4" ) 
  2. add following dependencies plugins.sbt (in "project [root-build]"):

    addsbtplugin("de.johoop" % "sbt-testng-plugin" % "3.0.2")
  3. restructure "test" directory classes part of package structure. example:

     test --- com.test.integration ------ integrationtest.java --- com.test.unit ------ unittest.java 
  4. add new test file (ex: exampleintegrationtest.java) 1 of test packages ("unit" or "integration") basic test. should extend "testngsuite" class (part of scalatest module).

     public class exampleintegrationtest extends testngsuite {     @test     public void test() {         assert.asserttrue(true);     } } 
  5. in terminal / console, navigate project directory , run following command:

    activator clean compile
  6. once has compiled, run:

    activator test

if goes well, should see 1 successful test executed.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -