Auto-tools/Projects/Robocop/WritingTests: Difference between revisions

→‎Creating a new test: Add stuff about BaseTest
(→‎Creating a new test: Add stuff about BaseTest)
Line 18: Line 18:
<pre>
<pre>
public class testMyFeature extends ActivityInstrumentationTestCase2
public class testMyFeature extends ActivityInstrumentationTestCase2
</pre>
For convenience, you can also extend one of the provided abstract classes, like BaseTest. This derives from ActivityInstrumentationTestCase2 but also provides a bunch of boilerplate and utility functions.
<pre>
public class testMyFeature extends BaseTest
</pre>
</pre>


Line 26: Line 31:
public void tearDown() // Clean up. This is usually very similar for every test class.
public void tearDown() // Clean up. This is usually very similar for every test class.
</pre>
</pre>
If you extend BaseTest, the setUp() and tearDown() are provided for you, but you can still override them and do additional setup/teardown if needed; just make sure you call super.setUp() and super.tearDown() in your overiddes as necessary.


Finally, add your new test file to the test manifest: mobile/android/base/tests/robocop.ini.
Finally, add your new test file to the test manifest: mobile/android/base/tests/robocop.ini.
Confirmed users
586

edits