Running UI test cases
The Java test project created in the previous section has to be compiled into a JAR file to run your test cases. The JAR file has to be copied onto the same Android device in which the application under test is running. Follow the next steps to run your test case:
Open the terminal panel in Android Studio (Tools | Open Terminal).
Navigate to the Android Studios
tools
folder where the android executable is found:$ cd androidSDK/tools/
Get the ID of the Android target that you want to use in your project. Execute the android executable with the list of the target actions. This command will list the available Android targets along with their IDs:
$ ./android list targets
Execute the
android
executable with thecreate uitest-project
action. This command receives the name of the output project (-n
), the ID of the Android target (-t
), and the path of your Java test project (-p
) as parameters. This step is to generate the project's build file as a test project:$ ./android...