Applying TDD
In this section, we will analyze the TDD process, which can be used to improve a team’s development process and decrease the number of defects in a project.
Let’s assume that you are tasked with building an activity that displays a calculator with the add, subtract, multiply, and divide options. You must also write tests for your implementation. Typically, you would build your UI and your activity, and a separate Calculator class. Then, you would write the unit tests for your Calculator class and then for your activity class.
If you were to translate the TDD process to implementing features on an Android app, you would have to write your UI test with your scenarios first. To achieve this, you can create a skeleton UI to avoid compile-time errors. After your UI test, you would need to write your Calculator test. Here, you would also need to create the necessary methods in the Calculator class to avoid compile-time errors.
If you ran your tests...