Does Junit reinitialize the class with each test method invocation?
It is because of test isolation. No test should depend on another.
It is because of test isolation. No test should depend on another.
Option 1: Use InstrumentationTestCase Suppose you got assets folder in both android project and test project, and you put the XML file in the assets folder. in your test code under test project, this will load xml from the android project assets folder: getInstrumentation().getTargetContext().getResources().getAssets().open(testFile); This will load xml from the test project assets folder: getInstrumentation().getContext().getResources().getAssets().open(testFile); … Read more
This (old) JUnit best practices article puts it like this: Do not use the test-case constructor to set up a test case Setting up a test case in the constructor is not a good idea. Consider: public class SomeTest extends TestCase public SomeTest (String testName) { super (testName); // Perform test set-up } } Imagine … Read more