Chapter 9. Testing and Troubleshooting

With the following listed recipes, this chapter introduces a set of common practices for maintaining, debugging, and improving an application state:

  • Automating Database Migrations with Flyway
  • Unit testing with Mockito and Maven Surefire
  • Integration testing with Cargo, Rest-assured, and Maven Failsafe
  • Injecting Spring Bean in Integration tests
  • Modern application Logging with Log4j2

Introduction

As we are now approaching the end of this journey, we must see how to consolidate the work. In the real world, tests must be written before a feature is developed (or at least at the same time). Writing automated tests in software development conveys a massive confidence about the application state. It is the best way of ensuring that nothing has been forgotten. Having a system that has the ability to test itself, with the help of modern continuous integration tools, ensures that features will not be damaged at any time.

Manual testing through UI cannot be trusted to cover every single edge case that a developer has to think about. It is the responsibility of the developer to secure all the breaches and to cover all the possible paths, and this is a big responsibility.

Our developer job is an amazing job. The perpetual technology enhancement sets an incomparable pace for every one of us—to stay in the race, to respond to the market, and sometimes to lead the market.

Our job is made of long hours of intense focus, search for information, design, redesign, and so on. Writing tests brings a healthy stability in the cycle. It allows us to finish our day happier with the features we develop, even weeks and months later.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset