We have received a new class of
MainActivityTest.java in the result. Directly here our tests will be.
But that's not all. We still need to perform the following steps:
- Create an object of class ActivityTestRule, as well as add an annotation @Rule to this object. This object is a pointer to the test object.
- It implementing setUp() and tearDown() methods. We obtain activity in setUp() method, and we assign null to the object in the method tearDown().
- We inherit our class from Assert class. A number of methods for objects comparison is represented in Assert class. This class will greatly simplify the work with the test
Method which is designated by
@Before annotation, fired at the beginning of the test. Typically, in the method body designated by this annotation, performed all the preparatory operations. For example, the download of valid data, etc.
@After annotation called immediately after the test completion