java - Play Framework (2.1.3) doesn't run any tests -
i have 4 test classes average of 2 test functions each. first test below , must correct (its play's tutorial).
public class applicationtest { @test public void simplecheck() { int = 1 + 1; assertthat(a).isequalto(2); } } the other ones custom made , have @before setup, this:
public class usertest extends withapplication { @before public void setup() { start(fakeapplication(inmemorydatabase())); } // creation , retrieval of user @test public void createandretrieveuser() { new user("bob@gmail.com", "bob", "secret").save(); user bob = user.find.where().eq("email", "bob@gmail.com").findunique(); assertnotnull(bob); // retrieved assertequals("bob", bob.getname()); // correct user retrieved } } now when run play test finishes lot quicker , doesn't execute test.
ps c:\wamp\www\dcid> play test [info] loading project definition c:\wamp\www\dcid\project [info] set current project dcid (in build file:/c:/wamp/www/dcid/) [info] compiling 4 java sources c:\wamp\www\dcid\target\scala-2.10\test-classes... [info] applicationtest [info] [info] [info] total test applicationtest [info] finished in 0.014 seconds [info] 0 tests, 0 failures, 0 errors [info] models.usertest [info] [info] [info] total test models.usertest [info] finished in 0.002 seconds [info] 0 tests, 0 failures, 0 errors [info] models.proposaltest [info] [info] [info] total test models.proposaltest [info] finished in 0.002 seconds [info] 0 tests, 0 failures, 0 errors [info] passed: : total 0, failed 0, errors 0, passed 0, skipped 0 [success] total time: 5 s, completed 16/ago/2013 14:52:35 why this? can do? updated play 2.1.2 2.1.3. updated references , project working fine, except tests. looked @ question, can't that, since didn't change tests, written, it's execution not working.
it's a known issue of play 2.1.3. meanwhile there a workaround. add following build.scala file in val main function:
val main = play.project(appname, appversion, appdependencies).settings( // add own project settings here testoptions in test ~= { args => { arg <- args val ta: tests.argument = arg.asinstanceof[tests.argument] val newarg = if(ta.framework == some(testframeworks.junit)) ta.copy(args = list.empty[string]) else ta } yield newarg } )
Comments
Post a Comment