mercredi 31 janvier 2018

check test preconditions or not

let's say I have a functional test where I test whether user can buy some item. Precondition for the test is that user has enough money on his account. Therefore, before I run the test, I set enough money on the user account.

Is it OK just to check the result message of the "set money" call or is it a good practice to check also whether preconditions where executed successfully more verbosely? I mean, when there is a call to set money, there could also be a call, which returns current amount of money on user's account, which I would call after setting amount of money to make sure, user has enough money on his account, before I run the test. Of course, if the "set money" call is unreliable - often changes, then there is a reason, but otherwise?

Thanks for help.

Aucun commentaire:

Enregistrer un commentaire