From the course: Advanced Android Espresso Testing

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Incoming intents: Activity rule

Incoming intents: Activity rule - Android Tutorial

From the course: Advanced Android Espresso Testing

Start my 1-month free trial

Incoming intents: Activity rule

- [Instructor] We want to launch ideas activity with an intent carrying the theme as an extra. To do that, we need to give two more parameters to the constructor of the activityRule. Go to line 17. At the end, we would like to add some parameters. The first one to add is initial touch mode which determines if our test should be placed into touch mode when started. Give it true. Next, we want to give it to parameter false for launch activity. This determines if the rule will automatically launch the activity at the start of the test method. It is set to true when we use the one parameter version of the activity test rule. But now we want to set it to false so that we can pass in an intent. With this change, we need to call launch activity on the ActivityTestRule ourselves. If we don't, the test method is run without launching the activity. Let's try that. Press the green triangle to run our test. Our test failed. Look at the lower left corner. Click on no theme and you can see the…

Contents