mardi 3 février 2015

Test part of complex structure with unittest and mocks

What will be the best way to test following:


We have a large complex class that we'll call ValueSetter which accepts string, gets some data from it and sets this data to several variables like message_title, message_content, message_number To perform this it uses another one class called Rule where are rules for particular case described with regular expressions.


What is needed: Because in each Rule there are about 5 cases to match, we ant to test each of them separately.


So far we need only to assert that particular Rule returns correct string in each case. What is the best way in this situation ?


Aucun commentaire:

Enregistrer un commentaire