开发者

android instrumentation testsuite

I have written two test cases in a package com.app.myapp.test When I try to run them both of them are not getting executed, only one test开发者_如何学Go case gets executed and stops.

I have written the following testsuite in the same package

AllTests.java

public class AllTests extends TestSuite {

    public static Test suite() {
        return new TestSuiteBuilder(AllTests.class).includePackages("./src/com.ni.mypaint.test","./src/com.ni.mpaint.test").build();
               /* .includeAllPackagesUnderHere()
                .build();*/
    }

Is the code and location for this testsuite is correct?


Well, certainly leave off the '/src/' portion of the package listing for that invocation. Either way, the easiest and most flexible way to run your tests this is to make sure all your tests are in a subpackage of where AllTests is (e.g. com.app.myapp.test.tests) and use this for the suite:

public static Test suite() {
    return new TestSuiteBuilder(AllTests.class)
            .includeAllPackagesUnderHere().build();
}

Make sure your tests run individually, too, without the suite runner -- the suite won't pick up your tests if they're set up wrong to begin with.

(This is better than explicitly listing the package name since it's more portable -- you can rename your test package without breaking it, for example.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜