lundi 30 mars 2015

Proper Unit Testing Philosophy

What would be the proper thing to do for each case?


1: Context: Testing a function that creates a database as well as generating metadata for that database


Question: Normally unit test cases are supposed to be independent, but if we want to make sure the function raises an exception when trying to make a duplicate database, would it be acceptable to have ordered test cases where the first one tests if the function works, and the second one tests if it fails when calling it again?


2: Most of the other functions require a database and metadata. Would it be better to call the previous functions in the set up of each test suite to create the database and metadata, or would it be better to hard code the required information in the database?


Aucun commentaire:

Enregistrer un commentaire