Open eucalypto opened 3 years ago
Whole course overview: https://developer.android.com/codelabs/advanced-android-kotlin-training-welcome#1
The Android Testing lesson includes three codelabs:
Testing Basics
This codelabs covers the basics of running and writing tests for Android. It includes Test Driven Development, source sets, Robolectric, AndroidX, and testing ViewModels and LiveData.
Dependency Injection and Test Doubles
This codelab covers how to implement manual dependency injection and use test doubles on Android. It includes setting up manual dependency injection, creating fakes, creating mocks, creating ServiceLocators, instrumentation tests for Fragments, testing Navigation, and basic Espresso testing.
Survey of Testing Topics
This final codelabs covers testing specific types of code, including:
This codelab is part of the Advanced Android in Kotlin course. You'll get the most value out of this course if you work through the codelabs in sequence, but it is not mandatory. All the course codelabs are listed on the Advanced Android in Kotlin codelabs landing page.
When you implemented the first feature of your first app, you likely ran the code to verify that it worked as expected. You performed a test, albeit a manual test. As you continued to add and update features, you probably also continued to run your code and verify it works. But doing this manually every time is tiring, prone to mistakes, and does not scale.
Computers are great at scaling and automation! So developers at companies large and small write automated tests, which are tests that are run by software and do not require you to manually operate the app to verify the code works.
What you'll learn in this series of codelabs is how to create a collection of tests (known as a testing suite) for a real-world app.
This first codelab covers the basics of testing on Android, you'll write your first tests and learn how to test LiveData
and ViewModel
s.
You should be familiar with:
ViewModel
and LiveData
You'll learn about the following topics:
You'll learn about the following libraries and code concepts:
LiveData
and ViewModel
tests.
TO-DO Notes App - from Advanced Android Kotlin Testing Codelab
Project Files
Whole course overview: https://developer.android.com/codelabs/advanced-android-kotlin-training-welcome#1
Original repository: https://github.com/googlecodelabs/android-testing