Hi All, Today I will talk about the benefits of TTD in VSTS Test Driven Development is the process to implement unit testing before a piece of code or application written This helps in many ways like easily trace the code defects , reduce time spend in debugging the code , avoid logical errors , maintain code quality and it gives confidence that your code can handle any kind of critical execution path i.e. .it builds confidence that the code will works without any error . TDD implemented through unit tests , this is nothing but a series of test cases thatÂ’s checks whether the business logic is functioning correctly and whether inputs produce the expected outputs. VSTS provides in-built support for writing unit test cases for your code by simple right click on your code and select Create Tests .This operation creates a test project with skeleton of a unit test is generated for you the next step is to add the test code that will be used to test the functionality of your code. You can view & manage test cases from Test Manager window ( Select Test| Window and select Test Manager ).The main purpose of test manager window is to view information about the tests in your solution. You can customize this view in various ways to see specific tests like view all the tests in your solution or just a filtered subset or can group them by properties or view them arranged in test lists. The final step is execute the test project the Test Result window show you the result of your test cases. Implementing unit test does not gives fully confidence that your code is a quality one ,. along with writing the unit case its very important that your unit test must cover all code path this can be validated through another tool called code coverage , job of this tool is to demonstrates which areas of your code were not covered by the unit tests. Once you run this tool just open your source code the uncovered line highlighted in red and code that was executed by a unit test highlighted in green. One important pointer most commonly we face is your unit case execute a if condition of a piece of code and the else part marked in red ( as uncovered ) so its important that your unit case project must covers all possible execution path of your code . Unit testing and code coverage tools are very much useful tool in our development activity , its gives strong confidence that your code will execute efficiently without any exception or runtime error. Cheers Anand
|