jeudi 7 mai 2015

'assert' is ignored on Junit Tests with InstrumentationTestCase

I set up JUnit Test from android unit testing support and get "FAIL" result from the following test class.

public class FooTest extends AndroidTestCase {
    @Before
    public void setUp() throws Exception { super.setUp(); }
    @After
    public void tearDown() throws Exception { super.tearDown(); }
    @Test
    public void testCase1() { assertTrue(false); }  
}

However, after replacing 'AndroidTestCase' with 'InstrumentationTestCase', I got "SUCCESS" result in spite of containing assertion that obviously returns 'FAIL'.

I would like to get to know the reason why I had got such a result, which are different by super classes and how to use Context in JUnit framework tests.

Aucun commentaire:

Enregistrer un commentaire