Archive

Posts Tagged ‘naming guidelines’

Guidelines for naming unit tests for TestDox analysis

February 28, 2010 Leave a comment

TestDox produces output based on the unit test classes and test methods it finds in your project’s assemblies.

As such, you can improve the TestDox output by naming your test classes and methods in a way that emphasises the expected behaviour or the intention of the code being tested.

If you’re following a test driven or behaviour driven development approach then you’re probably doing this anyway!

Note that these are just suggestions and are not required.

Test Classes

When naming test classes, make it clear what the trigger for the set of tests is.
i.e. the “When” in the story/scenario.
e.g. When_an_analysis_session_completes

Test Methods

When naming test methods, make it clear what should or shouldn’t happen in the scenario the test method represents.
i.e. the “Then” in the story/scenario.
e.g. it_should_output_how_many_test_methods_were_found