Contrasting unit and integrate test • Why we need to test and important • Intro JUnit4 • Basic Test fixture • Testing in pure kotlin • Testing exception
test names • Good Unit Test • Understand Test Double • Mocking Dependency • Dependency Injection (DI) • Writing your own rule • Intro Mockito • Test as a Design Tools • Test as a Document • TDD - Test Driven Development
• Why testing in android so hard • Understand pattern • Dependency Injection (Dagger2) • Prepare to stub, fake, mock, spy, dummy • Test Double in Android • Real world requirements unit test in Android
E T H E A U T H O R O F T H E A RT O F U N I T T E S T I N G “A unit test is a piece of code that invokes a unit of work and checks one specific end result of that unit of work.”
O V E T H E A U T H O R O F T H E A RT O F U N I T T E S T I N G “Integration testing is testing a unit of work without having full control over all of it and using one or more of its real dependencies, such as time, network, database, threads, random number generators, and so on.”
unit of work from its dependencies so that they’re easily consistent in their results and can easily control and simulate any aspect of the unit’s behavior. R O Y O S H E R O V E T H E A U T H O R O F T H E A RT O F U N I T T E S T I N G Summary
3. Readable 4. Fast 5. Repeatable and Automated 6. Fully Isolated 7. Verify One concern (Focus) 8. No real dependencies, such as time, network, database, threads, random number generators
way of hiding the implementation details of a particular set of functionality, allowing the separation of concerns to facilitate interoperability and platform independence. https://en.wikipedia.org/wiki/Abstraction_layer
M ( l o c a l u n i t t e s t s ) R E Q U I R E A N D R O I D ( i n s t r u m e n t a t i o n t e s t s ) module-name/src/test/java/. module-name/src/androidTest/java/
Test Driven: Practical TDD and Acceptance TDD for Java Developers - Effective Unit Test - xUnit Test Patterns - Android Architecture Components Future Read