mardi 5 septembre 2017

Issues with instrumentation testing in Android

I have written two instrumentation which will test some UI elements.

If I run both the instrumentation tests separately, it runs to completion.

Android Studio is triggering the following commands for that.

adb shell am instrument -w -r   -e debug false -e class com.android.example.AppTestOne http://ift.tt/2x855Q2
adb shell am instrument -w -r   -e debug false -e class com.android.example.AppTestTwo http://ift.tt/2x855Q2

But if I write a test suite, which triggers those tests automatically.

adb shell am instrument -w -r   -e debug false -e class com.android.example.TestSuite http://ift.tt/2x855Q2

Some test in the second test is failing on lower Android sdk devices (For example 4.1.2). But will work if I run the test individually on lower sdk devices or higher sdk ones.

This is my TestSuite

// Runs all unit tests.
@RunWith(Suite.class)
@Suite.SuiteClasses({AppTestOne.class,
        AppTestTwo.class})
public class TestSuite {}

Is there any way I can run, the tests from the test suite. But should execute each of those tests separately.

Aucun commentaire:

Enregistrer un commentaire