Reputation: 1
Provide me Android sample test project with only 2-3 java files,by using JUnit 4. I was trying to do this.
My main test file.
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
SimpleMathTest.class
// add other classes here (comma separated)
})
public class TestSuite {
}
and I made another test file as JUnit 4 that is
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
public class SimpleMathTest {
@BeforeClass
public static void setUpBeforeClass() throws Exception {
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
}
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
}
but at the time of execution Error displays:
SampleTest: Failed to launch test
please give me some solution.
Thanks
Upvotes: 0
Views: 909
Reputation: 2149
The following steps worked for me:
With this configuration I can run my unit tests. They run on the pc and not on the phone. Hope this helps.
Upvotes: 2
Reputation: 18704
You don't have any @Test methods.
Add:
@Test
public void test() {
//Test code here
}
Upvotes: 0