Confirmed users
905
edits
No edit summary |
|||
| Line 8: | Line 8: | ||
* The test must be included in the same package as all other Robocop tests | * The test must be included in the same package as all other Robocop tests | ||
= Basic structure of the test | = Basic structure of the test = | ||
package org.mozilla.fennec_root.tests; | package org.mozilla.fennec_root.tests; // Robotium test package | ||
import org.mozilla.fennec_root.*; | import org.mozilla.fennec_root.*; // import the package in order to be able to reuse classes if needed | ||
/* | /* | ||
| Line 19: | Line 19: | ||
public class test[Feature_to_be_tested] extends BaseTest { | public class test[Feature_to_be_tested] extends BaseTest { | ||
@Override | @Override | ||
// This method is needed in the BaseTest class | |||
protected int getTestType() { | protected int getTestType() { | ||
return TEST_MOCHITEST; | return TEST_MOCHITEST; // Test type should remain Mochitest | ||
} | } | ||
/* | /* | ||
* This is the class constructor | * This is the class constructor | ||
* This | * This method will contatin the test that will be ran | ||
*/ | */ | ||
public void testLoad() { | public void testLoad() { | ||
| Line 30: | Line 31: | ||
} | } | ||
} | } | ||
* This is a basic structure of a Robocop test | |||
* Each test class must have three methods: | |||
** protected void setUp() // Starts Fennec and sets up commonly used member variables. This is usually very similar for every test class | |||
** public void test[YourFeature]() // Your test code goes here. Use the Robocop API to access Fennec elements, click, send keys, and assert conditions. | |||
** public void tearDown() // Clean up. | |||
* If your tests extends BaseTest then you will not need to add the methods setUp() and tearDown() as they are already defined in BaseTest | |||
* If you need to do extra clean-up, like removing entries you added in a database for e.g., the tearDown() method can be overwrittern but make sure the first line of the method is '''super.tearDown()'''. The same is applicable for setUp(). | |||