views:

87

answers:

1

Hi 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 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?

A: 

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.)

Yoni Samlan
Thanks for ur response.but the problem is still there.I have written the test tuite as u said bove and i could not able to run the second testcase in the same package.even when i run the first test case it says the Test crashed.Both test cases are successfuly run individually.Can u please give me the solution.....Thanks in advance.
siri
if it crashed, what's the traceback?
Yoni Samlan