- [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).…
Author
Released
8/30/2017- Why test?
- Local vs. on-device
- Code coverage
- UI testing
- RecyclerView
- Hermetic environment
- Dependency injection
- Testing with MVP
Skill Level Intermediate
Duration
Views
Related Courses
-
Android App Development: Data Persistence Libraries
with Annyce Davis4h 52m Intermediate
-
Introduction
-
Welcome1m
-
-
1. Testing Considerations
-
Why test?1m 10s
-
Types of tests1m 10s
-
Local vs. on-device4m 54s
-
-
2. Test as You Go
-
The sample app1m 32s
-
Smallest unit first2m 20s
-
Code coverage5m 20s
-
-
3. UI Testing
-
RecyclerView7m
-
RecipeActivity: Layout2m 38s
-
Vector drawable: Create3m 7s
-
Vector drawable: Use2m 8s
-
SharedPreferencesFavorites5m 22s
-
Favorite: OnClickListener1m 40s
-
-
4. Hermetic Environment
-
Test doubles2m 10s
-
Dependency injection1m 3s
-
InMemoryFavorites4m 30s
-
RecipeApplication3m 18s
-
TestRecipeApplication1m 51s
-
CustomTestRunner2m 26s
-
Test state: Setup2m 17s
-
Test state: Test3m 47s
-
-
5. Robot Pattern
-
What vs. How56s
-
ScreenRobot3m 4s
-
RecipeRobot6m 12s
-
Clear favorites6m 55s
-
Separation of concerns1m 40s
-
-
6. Model-View-Presenter
-
Introduction1m 19s
-
Refactor: Load recipe2m 58s
-
Refactor: Show error6m 1s
-
Refactor: Show recipe7m 6s
-
Refactor: Toggle favorite3m 31s
-
Mockito: Intro1m 18s
-
Mockito: Setup4m 29s
-
Testing with MVP: Exception2m 26s
-
Summary1m 14s
-
-
Conclusion
-
Next steps23s
-
- 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.
CancelTake 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.
Share this video
Embed this video
Video: TDD: Red, Green, Refactor, part 2