Skip to content

Commit 67828c8

Browse files
authored
Update README.md
1 parent f34bcda commit 67828c8

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,40 @@ buildTypes {
158158
* Task `testDebugUnitTestCoverage` depends on `testDebugUnitTest` tasks (each module separately). Thanks to it all sources required for coverage report are available before gradle starts generating it (in `<module_dir>/build/...`.
159159

160160
![Coverage report](https://raw.githubusercontent.com/frogermcs/MultiModuleGithubClient/master/docs/img/coverage_report.png "Coverage report")
161+
162+
163+
## Instrumentation Testing
164+
165+
Project contains example Instrumentation test.
166+
167+
### Gradle
168+
169+
To run all Instrumentation tests from all modules at once launch emulator or plugin device and execute:
170+
171+
```
172+
./gradlew connectedAndroidTest
173+
```
174+
175+
When all goes fine, you should see testing report in `app/build/reports/androidTests/connected/` directory.
176+
![Instrumentation test report](https://raw.githubusercontent.com/frogermcs/MultiModuleGithubClient/master/docs/img/instrumentation_report_example.png "Instrumentation test report")
177+
178+
### Functional vs End-to-end testing
179+
From the high level, Android Instrumentation tests can be split into two types: functional and end-to-end. You can check my [article](https://medium.com/azimolabs/automated-testing-will-set-your-engineering-team-free-a89467c40731) about how we do QA at Azimo to see what is the difference between both of them.
180+
181+
Having in mind multi-feature config, it's pretty likely building functional tests can be more difficult. It's because your modules won't always see each other. In our example `app` module doesn't have knowledge about `feature/repository` module, so it means that instead of code:
182+
183+
```java
184+
intended(hasComponent(RepositoryDetailsActivity.class.getName()));
185+
```
186+
187+
you need to use:
188+
189+
```java
190+
intended(hasComponent("com.frogermcs.multimodulegithubclient.repository.RepositoryDetailsActivity"));
191+
```
192+
193+
It is, because `app` module doesn't have access to `RepositoryDetailsActivity` class.
194+
195+
What about end-to-end tests? They shouldn't be problematic, simply because tests shouldn't have knowledge about specific implementation, but rather how user interface is composed (so again, not: `withText("R.string.show_repos")` but `withText("Show repositories")`).
196+
197+
More cases: TBD

0 commit comments

Comments
 (0)