Tools for testing
For any development process, testing is of major importance. For Android game development too, there are a few tools and processes to make testing easier.
Creating a test case
Activity tests are written in a structured way. Make sure to put your tests in a separate package, distinct from the code under test. By convention, your test package name should follow the same name as the application package, suffixed with .tests
. In the test package you created, add the Java class for your test case. By convention, your test case name should also follow the same name as the Java or Android class that you want to test, but suffixed with Test
.
To create a new test case in Eclipse, perform the following steps:
In Package Explorer, right-click on the
/src
directory for your test project, and select New | Package.Set the Name field to
<package_name>.tests
(for example,com.example.android.testingfun.tests
), and click on Finish.Right-click on the test package you created, and select...