DEV Community

Cover image for Why is it important to test Ansible Collections?
XLAB Steampunk
XLAB Steampunk

Posted on

Why is it important to test Ansible Collections?

1. Testing prevents bugs from entering the codebase.

We do not write tests to find existing bugs in your codebase, we write tests to prevent bugs from getting into your codebase in the first place. The sooner you discover an error in your code, the easier (and cheaper) it is to fix it.

2. Testing helps us structure our code better.

When we write tests and code at the same time, tests guide our code structure. It is really difficult to write a test for a complex piece of code. As a developer, you want to make your life easier and write simple tests, so you need to simplify or restructure your code to make it easier to test.

3. Testing helps us detect regression.

When tests cover most of our codebase, we can easily detect regressions. During their lifecycle, most products get new features or a bug or two is fixed. If you have a test for existing features, you can be sure that by adding new features - and if all tests are still green - you haven’t broken anything.

Find out more about the benefits of testing, its setup, and see how to implement different types of tests on real-life examples in this free webinar.

Top comments (0)