Join Chiu-Ki Chan for an in-depth discussion in this video TDD: Red, Green, Refactor, part 2, part of Effective Android Testing for Mobile Developers.
- [Instructor] Now that we have created a dummy recipe,…let's use test-driven development to parse out as fields.…Go back to ReceiptTest.…We are going to enter another red/green/refactor cycle.…We will want to know that the id is what we expected.…Take a look at the text file.…The id should be water.…Go back to the test and add the line…assertEquals("water", recipe.id).…
Run the test, again, it fails,…because we are in the red part…of the red/green/refactor cycle.…So let's go to the recipe and actually implement…the part where we parse out the id.…To do that, we will need to create a BufferedReader…out of the InputStream.…BufferedReader, we'll call it reader, = new BufferedReader,…and then inside we'll have a new InputStreamReader,…which we'll give it stream.…
Next, we are going to read out of this reader line by line.…For (String line = reader.readLine(); line != null;…line = reader.readLine().…You can see that the reader reader.readLine…has exception, so we'll wrap the whole thing…in a Try/Catch block.…Try, catch (IOException e).…
- 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.