jeudi 5 novembre 2015

PHPUnit test dependencies

A similar question has been asked before but I don't quite understand the answer. My specific case is that I have a unit test which tests the registration of a user via a REST API endpoint. User registration however depends on a few records which must exist in the database, otherwise it will fail. Inserting these records into the database is most definitely a test case by itself too. So my question is, should I execute my tests in a specific order in order for the records to exist, or should I explicitly insert the records again in every testcase that depends on it?

It might be somewhat irrelevant but I'm using Laravel 5, so testing is done in PHPUnit.

Aucun commentaire:

Enregistrer un commentaire