How to run multiple JUnit test suites from the same class?

I tried to do a google search, but I keep getting the same answer that the following code should use:

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 try to use this code in my program, I get a few errors. They all say the same thing: Access restriction: The type is not API .

Is there any way to fix this? Or another method that I can use to run multiple test suites?

+5
source share
1 answer

An alternative to this approach can be all test cases of the 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 that this is not an actual answer, but just a job.

+1
source

Source: https://habr.com/ru/post/1275791/


All Articles