How doe we name test methods where we are checking for more than one condition?
Posted
by Sandbox
on Stack Overflow
See other posts from Stack Overflow
or by Sandbox
Published on 2010-06-10T01:40:55Z
Indexed on
2010/06/10
1:52 UTC
Read the original article
Hit count: 323
best-practices
|unit-testing
I follow the technique specified in Roy Osherove's The Art Of Unit Testing book while naming test methods - MethodName_Scenario_Expectation. It suits perfectly well for my 'unit' tests. But,for tests that I write in 'controller' or 'coordinator' class, there isn't necessarily a method which I want to test.
For these tests, I generate multiple conditions which make up one scenario and then I verify the expectation. For example, I may set some properties on different instances, generate an event and then verify that my expectations from controller/coordinator is being met. Now, my controller handles events using a private event handler. Here my scenario is that, I set some properties, say 3
condition1,condition2 and condition3
Also, my scenario includes
an event is raised
I don't have a method name as my event handler is private. How do I name such a test method?
© Stack Overflow or respective owner