How to unit test business rules?
Posted
by Robert Lamb
on Stack Overflow
See other posts from Stack Overflow
or by Robert Lamb
Published on 2009-06-19T02:56:31Z
Indexed on
2010/04/06
16:13 UTC
Read the original article
Hit count: 293
unit-testing
|business-rules
I need a unit test to make sure I am accumulating vacation hours properly. But vacation hours accumulate according to a business rule, if the rule changes, then the unit test breaks.
Is this acceptable? Should I expose the rule through a method and then call that method from both my code and my test to ensure that the unit test isn't so fragile?
My question is: What is the right way to unit test business rules that may change?
© Stack Overflow or respective owner