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 - Android Tutorial
From the course: Advanced Android Espresso Testing
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
App: Cat Names1m 28s
-
How intents are used5m 6s
-
Incoming intents: Empty4m 20s
-
Incoming intents: Activity rule2m 45s
-
Incoming intents: Known theme2m 19s
-
Incoming intents: Loading string2m 25s
-
Incoming intents: Unknown theme4m 34s
-
Outgoing intents: Launch activity4m 14s
-
Outgoing intents: Verify intent5m 1s
-
Outgoing intents: How to match?5m 5s
-
Stubbing: Intending1m 16s
-
Stubbing: ActivityResult4m 52s
-
-
-
-