lundi 16 février 2015

tdd - creating tests for 3rd party code

How do I create unit tests if the method or procedure I'm testing against relies on a piece of code from a 3rd party? Say, I have a method that uses classes from a third party source that requires setup that can only be done in a functional test. How should I approach this? Most of the time, the third party dependency can't be mocked, but my method really needs to make use of it.


Also, should I avoid my unit tests or even my functional tests from harnessing actual data? Like, should my tests never connect to a Database API to temporarily add data, operate and test against it, then delete it afterwards?


Aucun commentaire:

Enregistrer un commentaire