Skip to main content

The way to introduce testing rules to your team smoothly

💻 Tech

In this articles, I'll show you what have I done when I established and introduced the testing rules to our team.
Our team consisted of 8 developers and managed development process with Scrum methodology.
Would be very nice if this helps you to do the same thing :)

Step1: Made it clear what the test is

When I started this work, some of the junior engineers were not understanding the difference between Unit, Integration and E2E Test.
Additionally, the preferable way of implementing each one was not clear. While some engineers understand the situation of the product and have implemented suitable tests, sometimes other ones couldn't and also reviewers could not detect the "smell" of it.

Then I made a documentation about the general definition of each test and hold a seminar to install it to the team.

※You can see the references for making them at the bottom of this article

Step2: Establish the original definition of each test for our product to make coding rules

Even everyone understands testing, most of us are not sure how to implement them in a context of our development.

This time I categorized the tests already implemented there and established the definition of ideal implementation of each test.
The established one defines how deep should or should not write each test and how to do that step by step.

※You can see one example about Unit Testing here.

For example, I defined a "Semi-Unit" test in addition to the general tests.
Since there were so many Integration Tests that looks like a Unit Test, the scale is small, only testing a unit, but using autowired data access class method.
They are not good because the injected methods should be mocked in the context of Unit Tests. Additionally, we wanted to make it possible to exclude every data access from Unit Tests for CI performance and they are obstacles to do it.
As a result, I made a rule that "Semi-Unit" test must not be created anymore.

Step3: Introducing rules helping members

After holding a seminar to introduce the definitions and rules, we started following the rules.
At the first 1 month, I reviewed every pull requests implementing tests and help them write it.

Fortunately, for our team, the established documents are enough to understand and practice them so while I was reviewing, I only commented: "Collect it and you can see the reason why and how to do in this document."

After 1 month the rules were installed and now everyone could follow it without me.

This implementation also helped a lot when TDD is introduced.
And it would be very difficult to do that without rules because we were not confident about even writing a test in a normal way.
I strongly recommend you to do it before starting that kind of new way like TDD.

References

Tell me what you think of this article! 👉️ @curryisdrink