Android Instrumental Testing

0

When I begin to compose the instrumental test for MainActivity, it fails because it does not recognize this MainActivity, as you can see in the next image.

Ihavereadinsomeplacesthat"Because instrumented tests are compiled into an APK (separate from the application's APK), they must have their own AndroidManifest.xml file." I do not know if this is the cause of my problem.

Can you help me?

    
asked by anonymous 09.08.2017 / 18:45

1 answer

0

I believe you declared your test class wrong and the correct one would be this:

@RunWith(AndroidJUnit4.class)
@LargeTest
public class MainActivityTest {
    @Rule
    public ActivityTestRule<MainActivity> mMainActivityTestRule =
            new ActivityTestRule<MainActivity>(MainActivity.class);

    @Test
    public void testeAlgo() {
        // Algum teste
    }
}

OBS1: I never had to declare a test manifest itself.

NOTE: The package statement is oddly spaced in the name.

This link has a great test tutorial: link

    
09.08.2017 / 19:16