What are some popular naming conventions for Unit Tests?
General
- Follow the same standards for all tests.
- Be clear about what each test state is.
- Be specific about the expected behavior.
Examples
1) MethodName_StateUnderTest_ExpectedBehavior
Public void Sum_NegativeNumberAs1stParam_ExceptionThrown()
Public void Sum_NegativeNumberAs2ndParam_ExceptionThrown ()
Public void Sum_simpleValues_Calculated ()
source: http://weblogs.asp.net/rosherove/archive/2005/04/03/TestNamingStandards.aspx
2) Separating Each Word By Underscore
Public void Sum_Negative_Number_As_1st_Param_Exception_Thrown()
Public void Sum_Negative_Number_As_2nd_Param_Exception_Thrown ()
Public void Sum_Simple_Values_Calculated ()
Other
- End method names with Test
- Start method names with class name