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?

+3


source to share


2 answers


Upgrading from sbt 0.13.5 to 0.13.6 as per @Salem's comment will fix the issue.



+1


source


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
                }
            }
        };
    }
}

      

0


source







All Articles