Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Test-Driven Development on Android
Rating: 4.1 out of 5(21 ratings)
179 students
Created byJov Mit
Last updated 11/2022
English

What you'll learn

  • Write production Android apps using TDD
  • Get comfortable test-driving code
  • Evolutionary Design - Evolving the design by leveraging the feedback from the tests
  • Refactoring - Get confident in changing the structure of the code without breaking its behavior
  • Get familiar with Jetpack Compose
  • Testing from the user perspective (UI tests that run whole flow)
  • Set up a continuous delivery system that directly ships the new functionality on Google Play

Course content

1 section46 lectures35h 45m total length
  • Introduction22:20

    Introduction of the Friends project


    This is the beginning of the course that will go through the process of building an entire product. We start off by scratching out the initial project outlines, creating the Android client project, and setting up the CD.


  • Keystores and signing configurations39:03

    In this video we go through the process of creating a signing configuration (keystore) and how to use it to sign a release version of an application.

  • Deployment Pipeline38:14

    In this lecture, we are going through the steps required to make automated publishing to Google Play Store. We will introduce the deployment pipeline to enable continuous delivery so that once we push our work on the remote repository, it will be deployed (in this case on Google Play)

  • Firebase Test Lab45:00

    In this lecture, we set up the deployment script to run both Unit and UI tests as a requirement before publishing to Play Store. The UI tests are leveraging the Firebase Test Lab to run on a real physical device, and we walk through the actual setup required on the Firebase Console side to be able to run the tests.


    A little side note: the configuration that we are writing in the video will most probably be slightly outdated at the time you are learning this, and that is because most of the things inside the script that run the GitHub action are actions that are maintained and changed over time. I will try to keep the script up to date in the GitHub repository, but also here in the resources section. There is a downloadable file named `deploy.yml`. So make sure you look into it when writing your own, and don't hesitate to reach out to me if you end up having problems.


    Also, find some useful links mentioned in the video in the external resources section.


  • Writing the first UI test37:49

    In this lecture, we set up the UI testing dependency and we write our first UI test. We start from the test before any actual UI is written so that we can use the test to guide us toward what to work on next.

  • Writing the first screen using Jetpack Compose49:05

    In this lecture, we start working on the Signup screen so that we can have a form to create an account. We get an initial grasp of how it feels to write UI using Jetpack Compose, and it seems super fun.

  • A bug in the Jetpack Compose testing SDK!27:18

    In this lecture, we are working around a bug we found (and reported) in the JetpackCompose testing SDK.

    Next, we apply some UI improvements on the SignUp screen, and ultimately, we are setting up the JUnit5 to be ready to jump straight into the sign-up business logic right in the following lecture.

  • Get going with TDD51:45

    In this lecture, we are test-driving the credentials validation as part of the signup business logic. We use regex to verify if the email and the password are valid as a sign-up arguments

  • Sign up1:02:46

    In this lecture, we are test-driving the signup. We manage to cover the positive path for creating an account. We ended up emerging a few components with different responsibilities. We observe the design evolving nicely.

  • Introduce navigation34:20

    In this lecture, we introduce the Jetpack Compose Navigation and leverage it to navigate from the SignUp towards the Timeline screen upon successful account creation.

  • Introduce Dependency Injection Container49:21

    In this lecture, we introduce Koin as a dependency injection container, and we managed to complete the UI test that verifies displaying of the error message when the user attempts to create a duplicate account.

  • More UI tests for more functionality56:34

    In this episode, we write more tests to make sure the UI is reacting properly to the different states, particularly backend errors, offline errors, or bad credentials.

  • Polishing time (part1)58:24

    In this lecture, we are working on making the signup screen look nice and polished. We introduce some animation which seems to be quite easy with Jetpack Compose. We made a nice improvement by decoupling the screen state from the actual composable into a standalone class.

  • Polishing time (part 2)29:55

    In this lecture, we work on resetting the bad email and bad password error state from the corresponding composable upon its value gets changed (i.e the user continues to type).

  • Long running operation state45:14

    In this lecture, we are preparing the business logic to allow us to show an indication for a long-running operation. We start off by making sure the ViewModel sends to the UI a state that represents an ongoing operation that might take some time. Later on, we will decide how we are going to represent that in the UI.

  • UI component for a long running operation37:46

    In this lecture, we make sure we display a blocking loading while a long-running operation is going on. We also make sure the blocking loading composable animates nicely between showing and hiding and with that we are wrapping up the signup screen, getting us ready to focus on the Timeline.

  • Introduction of the Timeline41:10

    In this lecture, we start working on the Timeline. We directly jump into the business logic and start emerging some of the essential parts like the ViewModel as a bridge between the UI and the domain, and the Post as a domain model.

  • Fetching Timeline Posts32:52

    In this lecture, we are emerging the algorithm for fetching the timeline posts for a given user.

    The idea is that the timeline should include the posts of the user itself and the posts of the folks the user is following.


  • Refactoring Completed38:18

    In this lecture, we are completing the refactoring that we started in the previous lecture. We are pushing the data from the shipping code toward the tests so that the abstractions will live in the shipping code, and the data will stay in the tests.

  • What if loading goes wrong?33:13

    In this lecture, we are handling the negative cases when loading the timeline. We emerge another collaborator and align the levels of abstraction nicely.

  • Timeline UI (part 1)36:37

    At this point, we start working on the timeline UI. We do the required wiring and we put our focus on the navigation between the signup and the timeline

  • Timeline UI (part 2)42:26

    In this video we start shaping the Timeline which gets capable of showing the posts in a scrollable list

  • Navigation to Post Composer27:12

    The timeline now allows us to navigate to the posts composer which at this moment doesn't do anything.

  • Offloading work to background thread22:30

    The TimelineViewModel is delivering all the UI states to the observers (the screens), and the loading of the timeline is done in the background thread

  • Completing the Timeline1:03:01

    The Timeline shows the loading indicator, as well as the error messages. We managed to improve the InfoMessage to handle the showing/hiding by itself and removed the duplication from the screen states.

  • Creating Posts37:06

    In this lecture, we start working on creating the posts.

    The posts are dealing with 2 elements of randomness (postId and timestamp) that we need to be able to control from the tests. So some interesting ideas are popping up. We already had a chance to do a little refactoring, leaving some more refactoring for the following episode!

  • Elements of randomness31:17

    In this lecture, we continue the refactoring we've started in the previous one - dealing with the elements of randomness.

    The Post consists of "postId" and "timestamp" which are the elements of randomness, and we have to be able to control them for testing purposes.

  • Reasoning, Refactoring, Fun1:09:02

    In this lecture, we almost finish the post-creation business logic. We figured out a bunch of duplicated test doubles that we want to consolidate in the following episode. A lot of refactoring, a lot of reasoning, and a lot of fun!

  • Deal with the duplication!39:55

    Just as we planned in the previous lecture, In this lecture, we are dealing with some duplication for the test doubles, and wrapping up the business logic behind creating a post.

    All the required UI states are delivered to the observers, and all the operations are offloaded from the main thread.

  • Post Composer (part 1)49:29

    In this lecture, we start working on the UI of the Post composer. We have significant progress but still a lot to do to complete it.

  • Contract tests for the PostCatalog40:17

    In this lecture, we are adding contract tests to make sure the PostCatalog implementations behave the way their clients expect.

  • Post Composer (part 2)48:34

    In this lecture, we complete the happy path for composing a post, and we make sure the user can create as many posts as they want to.

  • Post Composer completed37:26

    We finalized the Post Composer and made It fully functional. The first half of the app is almost done!

  • Clean up!53:33

    In this lecture, we are finally addressing the storage of the logged-in user data. Additionally, we are touching a bit on the Friends section of the app, and we have a good intro for the following lecture!

  • Bottom Navigation Bar1:16:11

    In this lecture, we are introducing bottom navigation so that we can navigate between the timeline and the friends sections of the app

  • TDD ZOMBIES42:01

    In this lecture, we start working on the business logic to load the friends.

    We start test-driving the code by introducing yet another technique in the TDD world called TDD ZOMBIES.

    Check out the resources section for more information about the TDD ZOMBIES

  • Unwanted Output1:18:21

    In this lecture, we are focusing on the not-so-common output/result that might occur.

    Those are the situations when the backend throws an error on us, or the user's device might be in an offline state.

    These are legitimate situations and we need to handle them properly.

  • Coroutines, Delivering state to UI45:52

    In this lecture, we complete the business logic to load the content for the People section, so that we can focus next on the UI. Or can we?

  • Getting back on track (improving design)47:28

    In this lecture, we are getting back on the right track, recovering from a design mistake we've done in some of the previous episodes.


    This lecture complies with the well-known sentence: "Make the change easy (note this might be hard). Then make the easy change"

  • Friends section UI (part 1)57:32

    In this lecture, we start building the UI for the Friends section. It seems like it will take us a bit of time, but we have a great start.

  • Friends section UI (part 2)55:47

    In this lecture, we continue our journey into the FriendsScreen composable and we started shaping the list of friends nicely.

    Meanwhile, we made a decision on the uncertainty we had in the previous video to exclude the user who owns the account from the friend list.

  • Friends section UI (part 3)1:11:33

    In this lecture, we are dealing with the different screen states in the Friends Screen. We introduce a pull-to-refresh mechanism for the list, as well as error messages for the error states.

  • Recovering from process death (SavedStateHandle)1:10:05

    In this lecture, we are working on storing and restoring the state over process death by leveraging the SavedStateHandle from the "androidx.lifecycle" package.

  • Following and Unfollowing1:02:46

    In this lecture, we are adding the functionality to toggle the following between the users, so that they can follow and unfollow each other.

    The content in the Timeline depends on the friends a user follows.

  • UI for the following users1:08:02

    In this lecture, we work on showing the current following state for the friends (Follow, Unfollow) and showing a little progress indicator when toggling the friendship.

  • Wrapping Up41:20

    In this episode, we wrap up the error handling for updating the following for friends, and also wrap up the initial set of functionalities planned for the initial version of the Android client of the app.

    Next up: We will be focusing on the backend!

Requirements

  • Kotlin programming language
  • Familiarity with Android development
  • Familiarity with JUnit. It's fine if you are not very knowledgeable for testing, you will learn many things on the go
  • Knowledge of Jetpack Compose is a plus, but not a requirement, as you will learn a lot about it along

Description

The objective of this course is the eXtreme Programming practices, particularly the technical ones. By the end of the course, you'll become comfortable with Test-Driven Development, Refactoring, Evolutionary Design, and Continuous Integration.


The instructor happens to work on an Android application throughout the course, but the technical knowledge, the practices, and the tips you will get from the lectures are applicable regardless of the language or the technology you are using.


As an extra, if you are an Android developer, you will also learn the basics of Jetpack Compose, and you'll get comfortable writing UI by using it. The course is targeting students with various experiences. There is certainly a lot of learnings in this course for both junior and senior developers.


By the time this course was created initially, certain technologies like Jetpack Compose were not stable. However, as they were evolving, they were being updated and re-explained in the course, even though the main focus of the course is not a particular technology, but rather good software development practices.


What's also very important, this course takes into consideration the gender and race-neutral position and makes sure that all the students feel welcome and comfortable following it. The instructor is going to be available for help throughout the entire course, as well as after finishing it.

Who this course is for:

  • Beginner and advanced Android developers curious about better ways of developing high quality software, willing to learn more about testing and Jetpack Compose as a plus.