6

I've tried to search on google, but I keep getting the same answer which is to use the following code:

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

@RunWith(Suite.class)
@SuiteClasses({FirstTest.class,SecondTest.class,ThirdTest.class})
public class RunTestSuite {
}

However when I attempt to use this code in my program, I get multiple errors. All of them say the same thing: Access restriction: The type is not API.

Is there a way to fix this? Or another method altogether that I can use to execute multiple test suites?

  • Are you using Eclipse? If so, take a look at this: https://stackoverflow.com/questions/25222811/access-restriction-the-type-application-is-not-api-restriction-on-required-l – Guts Mar 08 '18 at 15:56

1 Answers1

2

An alternative of this approach can be running all test cases of entire project. You can do this by simply right-clicking the project -> Run As JUnitTest.

If you want to ignore some of the test cases you can use @ignore with it. Hope this helps. I know this is not the actual answer, but just a work around.

Kaushal28
  • 5,377
  • 5
  • 41
  • 72