Droidcon Boston '19: Writing Tests That Stand the Test of Time
You will leave the talk having a clearer understanding of why tests are important and worth the time and ultimately be able to apply the tips to write robust and more maintainable tests.
What you'll learn
One of the promises of test-driven development is the confidence and ease with which we can refactor our production code. However, sometimes we find ourselves in situations where our tests are too coupled to our code and we have to change the tests every time we update the code. At this point, we start wondering if the tests are worth it. If you have ever found yourself having to update your tests every time the behavior of a dependency of a class changes, then this talk is for you. This talk is to share some patterns, tools, and examples that can guide us to write more maintainable tests. We will look at why we need tests in the first place, how writing tests is an investment that will save time in the future. We will also look at some causes of unmaintainable tests (for example using a wrong test double, testing implementation details and not general behavior) and how to overcome these problems. With the use of examples from everyday Android development, we will learn how to avoid brittle tests. You will leave the talk having a clearer understanding of why tests are important and worth the time and ultimately be able to apply the tips to write robust and more maintainable tests.