More than last 12 months I am a great sponsor of the test driven development. But how i become a great devotee of TDD is very much interesting. I was given task to restructure the existing system. This is one of the most important features in our system. When i seen the existing code it was in a malicious situation. Lots of unwanted, complex complicated loops. So before starting the reconstructing the whole team sit together and decided we are going to start something new. It might slow down the process initially but will produce the quality work. Before witting the method we identified the feature's specification and requirements and exception handling phases. Then test cases are written based on the requirement. Then started working on the methods based on the test cases. First the entire test will fail because the method is written afterward.
Test method example
public void MethodWeAretesting_DescriptionOfInput_ReturnValueAndExpectedBehavior()
{
// Prepare test environment (i.e.: create test data)
...
// Calling method that we are testing
...
// Assertions
}
/// [TEST SCRIPT =test name ]
Public return type MethodName()
{
}
Once we written the methods we clearly given the indication which test method need to execute after making the change by giving /// [TEST SCRIPT =test name ]
Comments
Post a Comment