Use both InstrumentationTestRunner and AndroidJUnitRunner with Robotium and Espresso

We use Robotium s android.test.InstrumentationTestRunnerfor our tests. Nevertheless, we want to replace Robotium for Espresso, but we still have some doubts about this, since we have a machine with Jenkins for CI.

Espresso uses android.support.test.runner.AndroidJUnitRunner, while Robotium uses the above and the first, we would like to be able to use both test environments at the same time. Is it possible? How can we indicate this in a file build.gradle? How can we customize our jenkins machine for different tasks for different testing platforms?

I understand that it is possible that Espresso is expanding ActivityInstrumentationTestCase2, since our test classes Robotium also use a test runner that extends from ActivityInstrumentationTestCase2, but we still need to solve the problem of the testing testing tool.

+5
source share
1 answer

From the documentation for Android developers, AndroidJUnitRunnerreplaces the old one InstrumentationTestRunnerand includes JUnit 4 tests.

A class AndroidJUnitRunneris a test run JUnitthat allows you to run test classes JUnit 3or JUnit 4-style on Android devices, including those that use test environments Espressoand UI Automator.

, . InstrumentationTestRunner, JUnit 3.

https://developer.android.com/training/testing/junit-runner.html

, (, Robotium). .

, build.gradle. https://developer.android.com/training/testing/unit-testing/instrumented-unit-tests

+5

All Articles