Jake Thomas
Jake Thomas

Reputation: 57

Which test to run when using android studio for unit testing

I am working through an android app tutorial course on udacity.com. I have come to a lesson where it's introducing testing. However, the video for the current class is showing how to run a test where only one run test option is available. seen here: https://youtu.be/CHb8JGHU290?t=170

but my android studio shows a number of options

http://i.imgur.com/YOjyXyu.png

and I am not sure what is the correct one to use, or even what the differences between them are. Could anyone shed some light on why I have the 4 different choices and what they are? In particular the first and second options are confusing me. the third and fourth options are intuitive enough to understand.

Thank you.

Upvotes: 1

Views: 688

Answers (1)

unbekant
unbekant

Reputation: 1555

The options you are given are:

1- Run tests using Gradle: This has been added in version 1.1 of Android Studio, to run tests using Android's build system, Gradle.

2- Run tests using Android JUnit, which will probably require a device/emulator. This is the option to use if you have test cases that make use of Android's test suite, like AndroidTestCase, also useful for running more complex and Android-related test cases.

3/4 - Run using JUnit framework. In your case, the only difference between these options is that the first indicates All Tests available in the project, while the last option offers running all tests existing in the specified package. In your case, probably both options are equivalent.

If you are running basic unit tests, I'd definitely stick with the first option. More details on Android Studio testing here: http://tools.android.com/tech-docs/unit-testing-support

Upvotes: 1

Related Questions