TDD
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 in this phase, they would fail. This would force you to implement your code until the tests pass. Once your Calculator tests pass, you can connect your calculator to your UI until...