Android Studio 2.3
I am running some instrumentation tests and in my build.gradle file I have the following dependencies:
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
I am just wondering that these are for. As my tests seem to run perfectly without them.
I have seen many tutorials where they are included, but If I can run my test without them are they getting included with other dependencies?
So running test with them and without them seems to have no effect on my instrumentation tests.
What are they for and why do we need them?
No. By default, you do not need any of these to run unit tests. Additionally, you can run any test with runner by using @RunWith annotation.
E.g.
@RunWith(MockitoJUnitRunner.class)
public class MyTest ... {
...
}