Run Framework Testers of the Play Framework Class - Test Results Not Additive
Does anyone know how I can set up test run classes other than default and get summary test results to count test / fail results?
In particular, I want to work with a few specialized runners. For example a junit spring runner:
@RunWith(SpringJUnit4ClassRunner.class)
or perhaps a unit category runner:
@RunWith(Categories.class)
The tests are annotated with the above run, but the results are not printed to the activator console. For example, the below actually ran 6 tests on my package, but the results say 0 0 0 0:
[finbot] $ test-only com.myapp.finbot.model. *
[info] Update {file: / Users / todd / workspace / finbot /} root ...
[info] Solution: com.typesafe.trace # trace-sigar-libs; 0.1.6 ...
[info] Updated.
09: 09: 07.488 default [pool-1-thread-1] DEBUG ostcjSpringJUnit4ClassRunner →................
[info] ohviuVersion - HV000001: Hibernate Validator 5.0.3.Final
[debug] crfgcBatchConfiguration - ****************************** *** Step created ******** *************************
[debug] crfgcBatchConfiguration - ****** ***************************** Work created ******** ************ **************
[info] Skipped: Total 0, Failed 0, Errors 0, Skipped 0
Any ideas?
source to share
Alternatively, you can use a custom unit rule.
public class MyTest {
// ...
@Rule
public CustomRule customRule = new CustomRule();
// ...
}
public class CustomRule extends TestWatcher {
@Override
public Statement apply(final Statement base,
final Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
try {
// before test execution
base.evaluate(); // test execution
// test succeeded
} catch (Throwable e) {
// test failed
}
}
};
}
}
source to share