I have 2 test classes that I need to run on a test suite one is RestaurantModelTest
the other is CartModelTest.class
:
@Config(sdk = 16, manifest = "src/main/AndroidManifest.xml")
@RunWith(RobolectricTestRunner.class)
public class RestaurantModelTest {
//setUp code here...
@Test
public void testFindByLocation() throws Exception {
//test code here
}
}
So I followed some tutorials online and they specify to create a TestSuite class like this with my 2 classes to be tested:
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
RestaurantModelTest.class,
CartModelTest.class
})
public class ModelsTestSuite {
}
And then I must create a TestSuiteRunner class:
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
public class TestSuiteRunner {
public static void main(String[] args){
Result result = JUnitCore.runClasses(ModelsTestSuite.class);
for (Failure failure : result.getFailures()){
System.out.println(failure.toString());
}
System.out.println(result.wasSuccessful());
}
}
I'm using android studio and when I hate right-click > Run TestSuiteRunner...main() I get Exception in thread "main" java.lang.ClassNotFoundException:
any help really appreciated!