28 September 2017

Coolpointer.019 Unit test naming convensions



      7 Popular Unit Test Naming Conventions by Ajitesh Kumar shows few naming conversions for unit test. I used different conversion.  I follow Phil Webb's approach which is methodNameShouldExpectedBehavior. I tried few ways that I learnt on web and at work but this method works best for me as it helps me identify precisely what I am testing, where and what result I expect, so when test fails it helps me look to root of problem quicker.


methodName is my "when" which explain me what I am testing
ExpectedBehavior is my "then"
and optionally I added given which is my "Given?"

for example:
methodNameShouldPerformExpectedBehaviourWhenThisConditionOccured




7 Popular Unit Test Naming Conventions by Ajitesh Kumar  







No comments:

Post a Comment