Join Chiu-Ki Chan for an in-depth discussion in this video TDD: Red, Green, Refactor, part 1, part of Effective Android Testing for Mobile Developers.
- [Instructor] Test-driven development is a technique…to write software that integrates testing into the workflow.…It is often described as the red-green refactor cycle.…We write a test first before implementing the code.…This will lead to a failing test…which is the red part of the cycle.…You then write the code to make the test pass.…This is the green part.…Optionally, you clean up the code in the refactor style.…
Let's use test-driven development to implement…the readFromString function.…First, we need to add the junit dependency…to build.gradle under the app folder.…TestCompile and then junit:junit:4.12.…Perform a gradle sync.…Go ahead and press okay for this prompt.…Go back to Recipe.Java,…put your cursor on line five on the class name,…and then press command-shift-T to create a new test.…
We are going to put it as a jUnit4 test…under the test folder.…This is because we are writing a JVM test…instead of a Android test which will run on a device.…In the test resource folder, you will see some recipes.…Test, resources, recipes.…
- Why test?
- Local vs. on-device
- Code coverage
- UI testing
- Hermetic environment
- Dependency injection
- Testing with MVP
Skill Level Intermediate
1. Testing Considerations
2. Test as You Go
3. UI Testing
4. Hermetic Environment
5. Robot Pattern
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.