Proper code infrastructure is key

Integration and system tests both require a decent infrastructure behind the scenes. Without it, we may spend too much time setting up the environment or asserting that behavior was as expected. My key advice here is to invest in test infrastructure. Your infrastructure should help developers set up the environment, clean up the environment, retrieve… Continue reading Proper code infrastructure is key

Be careful with methods that are covered but not tested

Larger tests exercise more classes, methods, and behaviors together. In addition to all the trade-offs discussed with larger tests, the chances of covering a method but not testing it are much higher. Vera-Pérez and colleagues (2019) coined the term pseudo-tested methods. These methods are tested, but if we replace their entire implementation with a simple return null, tests still… Continue reading Be careful with methods that are covered but not tested

Patterns and best practices

You probably noticed that the amount of code required to get our first system test working was much greater than. In this section, I introduce some patterns and best practices that will help you write maintainable web tests. These patterns come from my own experience after writing many such tests. Together with Guerra and Gerosa,… Continue reading Patterns and best practices

Designing page objects

For web applications and system testing, we do not want to exercise just one unit of the system but the entire system. We want to do what we called system testing. What should we test in a web application, with all the components working together and an infinite number of different paths to test? Following what… Continue reading Designing page objects

An introduction to Selenium

Before diving into the best practices, let’s get familiar with the mechanics of writing such tests. For that, we will rely on Selenium. The Selenium framework is a well-known tool that supports developers in testing web applications. Selenium can connect to any browser and control it. Then, through the Selenium API, we can give commands… Continue reading An introduction to Selenium