Daniel Gomez Rico
Daniel Gomez Rico

Reputation: 15936

AWS device farm with Espresso and JUnit4

I want to test my app in AWS farm, using

androidTestCompile 'com.android.support.test:runner:0.4'
androidTestCompile 'com.android.support.test:rules:0.4'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.1'
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.1') {
    exclude group: 'com.android.support', module: 'appcompat'
    exclude group: 'com.android.support', module: 'support-v4'
    exclude module: 'recyclerview-v7'
}
androidTestCompile 'junit:junit:4.12'
androidTestCompile 'com.squareup.retrofit:retrofit-mock:1.9.0'
androidTestCompile 'com.squareup.assertj:assertj-android:1.1.0'
androidTestCompile 'com.squareup.spoon:spoon-client:1.2.0'

Sample test:

@RunWith(AndroidJUnit4.class) and run with AndroidJUnitRunner, I have my tests starting like:

@RunWith(AndroidJUnit4.class)
@LargeTest
public class EstimationActivityTests {

@Rule
public ActivityTestRule<LoginActivity> mActivityRule = new ActivityTestRule(LoginActivity.class);

@Before
public void setup() {
}

@Test
public void showsRightDataOnCreate() {
org.junit.Assert.assertEquals("asd", "asd");
}
}

But it just test teardown and setup suite tests... looks like it dont recognize the tests...

Another thing is that I´m creating the apk and test apk with gradlew.

#./gradlew assembleMockAndroidTest

and I upload the files in app-mock-androidTest-unaligned.apk and app-mock-unaligned.apk.

What´s wrong in my process?

Case: https://forums.aws.amazon.com/thread.jspa?messageID=647198&#647198

Upvotes: 4

Views: 738

Answers (1)

Daniel Gomez Rico
Daniel Gomez Rico

Reputation: 15936

All tests clases names should end with "Tests" and test functions should start with "test" and then it will work.

Answer here http://makingiants.com/blog/run-espresso-tests-on-amazon-aws-farm-test-center/

Upvotes: 4

Related Questions