-
Notifications
You must be signed in to change notification settings - Fork 0
Lab 22
Nate Ebel edited this page Jul 19, 2022
·
3 revisions
Let's build a simple test suite for our app
-
Write unit tests for
MyNotesViewModel
- Write tests to verify
ViewState
expectations - Use
@Before
annotation method to simplify test setup - Use
Mockito
to mockNoteDao
behavior - Use Turbine library to make assertions about multiple
Flow
emissions
- Write tests to verify
-
Write instrumentation tests for
MainActivity
- Write a basic test to verify Android framework api
- Write an Espresso test to verify the AppBar title is correct in
MainActivity
-
Use Gradle Wrapper to run unit tests from the command line
-
Use Gradle Wrapper to run instrumentation tests from the command line
- Build Effective Android Unit Tests
- Build Local Unit Tests
- Build Instrumentation Tests
- Mock Dependencies with Mockito
- Testing Flows using Turbine
Create a new test class, and add test methods that are annotated with @Test
.
@Test
fun verifySomeBehavior() {
// test logic
}