samedi 28 mai 2016

Should my unit tests also test third-party library/package features?

I've just started using unit tests and I'm trying to figure out how comprehensive my tests should be. One particular thing that comes up is when I use packages/libraries whose components are already subject to tests of their own. Should I be carrying out similar tests on those components myself, or should I only be testing the features that I've added?

For example, suppose I am developing a web app in Python and I'm using WTForms to validate input. Should I be writing tests which e.g. check behaviour when an email input is invalid, or when a required field is empty, etc, even though WTForms already contains its own tests of this form?

My gut feeling is that this is a bit redundant, especially since I can always just run the WTForms test suite on any installation myself, but I'm not sure if it's some kind of no-no to just assume the tests are good.

Aucun commentaire:

Enregistrer un commentaire