简体   繁体   中英

Play 2 Java sbt doesn't run all test classes

I have two JUnit test classes for my Play 2.0.4 project. They do get compiled but only one of them is actualy run with 'play test'. It seems to be random which class gets executed.

There are no errors in the output, just no tests of the other class get executed:

[info] Total for test api.ApiTest
[info] Finished in 0.611 seconds
[info] 0 tests, 0 failures, 0 errors

I turned out to be a stupid mistake in my test setup. I'll leave the question and answer here for future reference. Unfortunatelly the log did not show any issues with starting or stopping so I had debug it line by line.

WAS:

FakeApplication app = createCustomFakeApplication();
Helpers.start(Helpers.testServer(3333, app));
...
Helpers.stop(app);  

FIXED:

TestServer app = Helpers.testServer(3333, createCustomFakeApplication());
Helpers.start(app);
...
Helpers.stop(app);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM