DEV Community

Cover image for How I'm covering changes with tests
Vladimir Schneider
Vladimir Schneider

Posted on • Edited on

How I'm covering changes with tests

Hi there 👋🏼

This is my short note where I wanna talk How I'm covering changes with tests (or how I write tests for my code) and find out how are you doing this.

Questions which I ask myself after all changes:

What's kind of a change?

Answer options: feature/fix/improvement

Image description

So, next if is the feature then

Features

For feature you always should write new tests.

Image description

If the change is logic then write unit-tests and if the change is visual only then write snapshot tests.

Improvements and bugs

If after running tests you have broken tests fix its and if all tests pass it means that a broken thing could have a test – write a test to never break again.

Image description

Create a test

At last, let's talk about creating. Creating have three nodes: unit, snapshots and combined tests.

Image description

Full scheme

Image description

Thank you!

Top comments (0)