Types of tests and who should write which test

In software development nowadays there are many testing approaches. I will discuss only few and most popular of them.

Unit test. Who should write? Programmer. We write source code so we best know how to ensure a method or a class does it’s job. I’m not a fan of 100% code coverage because it is not most accurate quality factor. Mutation testing seems work in this case.

Integration test. Lets suppose we have a BooksRepository with getBook method. In unit test we can instantiate this repository with some SpyStorageObject injected and assert some specific method calls were made on this storage. But it may bring lower value than integration test communicating with database and asserting that certain data were resolved out of some stack. Who should write integration tests? Programmer, system architect, tech lead.

Acceptance (aka beta) tests. Those tests describe business rules and expectations. Should be written descriptive and in user-friendly manner by QA / business specialist.

Sample acceptance test written in Codeception:

<?php
$I->amOnPage('/login');
$I->fillField('username', 'davert');
$I->fillField('password', 'qwerty');
$I->click('LOGIN');
$I->see('Welcome, Davert!');

Leave a Reply

Your email address will not be published. Required fields are marked *