Monday, 22 June 2015

android studio unittest



If you create project by android, you should get folder structure like this:



main folder is your source code folder.

androidTest is your Instrumentation Tests folder, is not your unit test folder, you should create a unit test folder for manually.












Then you should see the new folder display as green:



Open the class you want to create unit test for:





Then android studio will create the unit test class for you:




To run it:




if you failed to run it , you should run grunt first:




http://tools.android.com/tech-docs/unit-testing-support







No comments:

Post a comment