NUnit Visual Studio 2017/2019 Test GeneratorThis is an extension for Visual Studio 2017 and 2019 that extends Visual Studio to allow you to create unit tests and IntelliTests using NUnit. It can generate tests using either NUnit 2.6.x or NUnit 3.0. Please note that IntelliTest is only available in VisualStudio Enterprise edition. Other versions of Visual Studio only have the Create Unit Test menu option. Please report issues on GitHub How to UseFor more information on using IntelliTest and this extension, please see the Microsoft documentation. Select a public method on a public class, then Right-Click to Create Tests Choose either Create Unit Tests or Create IntelliTestSelect NUnit or NUnit2 from the Test Framework dropdown.Note that you can adjust the settings for names and files to be generated. You can also choose to use an existing project or create a new one. If a new one is chosen, it will automatically add the relevant packages. It will then generate the project (or add to an existing) and create a new test class and test method if this is the first for the class under test. If a test method have been generated earlier for the same class, the new method will be added to that class. The result will look like this: It will add the using statements for both the NUnit.Framework (1) and the project under test (2). It will add the required attributes for testing (3) and it will add a test method with name equal to the method under test but with an added suffix "Test". It will add the requested statement inside the method, so next thing for you to do is just to fill out the real test code. Remember the AAA pattern here: Assume, Act, Assert. Happy testing ! |