Posts

Showing posts from October, 2018

Writing unit tests faster

Image
Introduction When you are writing tests, the name of the test is very important because the person who is executing the test should be able to detect what was fine or wrong at a glance. For this reason, it is a good practice to follow the convention format: TestedMethodName_InputData_ExpectedResult By using this format, we can see in a line the method to test, the input used and the result expected, so it will be easy to identify what was wrong. Another good practice is following the "Arrange", "Act", "Assert" convention ( http://wiki.c2.com/?ArrangeActAssert ), so when we are reading a test, we can identify easily each part of the test. To make more visible each part, unit test usually include one comment per each state of the test. Finally, if you are using different test categories, for example to classify unit tests and integration tests, you should use the word TestCategory("YourCategory") in your metadata definition. Using the ...