Answers for "unit test naming convention"

2

unit test naming convention

MethodName_StateUnderTest_ExpectedBehavior
	Example: add_twoPositiveIntegers_returnsTheirSum()
    Variant: Add_TwoPositiveIntegers_ReturnsTheirSum()
    Note: This is not camel case, so the question of whether to start each new chunk with a capital is up to you.

MethodName_ExpectedBehavior_StateUnderTest
	Example: add_returnsTheSum_ofTwoPositiveIntegers()
    Variant: Add_ReturnsTheSum_OfTwoPositiveIntegers()
    
itShouldExpectedBehaviorConnectingWordStateUnderTest
	Example: itShouldCalculateTheSumOfTwoPositiveIntegers()
    Variant: testItCalcultesTheSumof..

givenStateUnderTest_whenMethodAction_thenExpectedBehavior
	Example: givenTwoPostiveIntegers_whenAdded_thenTheyShouldBeSummed
    Variant: givenTwoPositiveIntegerWhenAddedThenTheyShouldBeSummed()
Posted by: Guest on November-07-2020

Code answers related to "unit test naming convention"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language