Posted by Anuraj on Tuesday, December 23, 2014 Reading time :1 minute
Smart Unit Tests is a new feature in Visual Studio 2015, Smart Unit Tests helps developers to explore their .NET code to generate test data and a suite of unit tests. For every statement in the code, a test input is generated that will execute that statement. A case analysis is performed for every conditional branch in the code. When you run these smart unit tests, you can easily see which tests are failing and add any necessary code to fix them. You can select which of the generated tests to save into a test project to provide a regression suite. As you change your code, rerun Smart Unit Tests to keep the generated tests in sync with your code changes.
You can right click on the class file or method, and select Smart Unit Tests context menu option.
A parameterized unit test is generated for this method. The test data is created to exercise the code paths in the method. Smart Unit Tests runs your code many times with different inputs. Each run is represented in the table showing the input test data and the resulting output or exception. The dropdown list in the smart unit tests window will display all the public methods, for which test data is generated.
Developers can save the unit test generated, by clicking on the save button of Smart Unit Tests window.Smart unit tests also helps you to identify potential problems in your code as well.
You can find more information about smart unit tests in MSDN
Happy Unit Testing :)
What do you think? I would like to hear your thoughts, suggestions, and questions in the comments section below.