What can make them write a test?

Situations

  • There is no one who writes a test in a team.
  • A little volume of test in a project.
  • Development itself is very active.
  • As you guess, so many :bug: s.

I was like them ever.

I had doubted about test. It wastes my time and cannot covers all the cases.

Then I made a new feature Pull requests without any tests and a gentle colleague often told me, “Hey, you forgot to write a test!” and I currently found the past myself were SO FOOLISH.

So, I understand current people who don’t try to create any test files a little.

But it was really foolish behavior and they have to change themselves.

How I found the importance of tests

When I started programming, it was Ruby on Rails and RSpec. (Though there are Mini Test side people and RSpec side ones, it doesn’t matter here and I ignore the religion.)

I was not familiar with Ruby, Rails and RSpec. RSpec was really difficult for me in particluar at that time and I didn’t wanna write it.

But after I was familiar with Ruby and Rails, I’d got to do refactoring gradually (without test). It produced many bugs, but they were difficult to find in code reviews.

Then I unwillingly started RSpec, but only success case or small number of cases.

After I changed a company and I met a new project, I was really surprised because the project was almost 100% test coverage.

I had to write a test in any situations! …but, I hadn’t written enough test during the first 1~2 months.

The team members ofter changed the code aggressively with a little bugs. I wondered how it could be done, but soon found it was the power of test :bulb:

After that, I changed my idea and I got to write tests in order to keep fast development cycle.

then, What makes them to write a test?

I think there are mainly two:

  • Something lets them to feel relieved with test :relieved:
  • They are not hesitated with writing a test.

and then I can do:

  • Advise how to write a test (or just share good articles about the test tutorials)
  • Tell them the advantage of the test

Advise how to write a test

I can creatae tutorial articles “How to start the RSpec” and advise sample code in code review.

I believe the latter would be helpful for no-test-writters.

If someone created a pull request without test, then I would say, “OK! In this case, you can add this kind of test code. (with add sample test code).”

It might be a bit burden, but I’m sure the return will be larger.

Tell them the advantage of the test

I have no idea about this. But I just keep telling the story about test like this article with “HRT” spirits and patience.

Contents