You can include TestLeft test code in unit tests and run them by using various unit testing frameworks. This topic describes how to run TestLeft tests with NUnit:
About
NUnit is a unit testing framework for .NET applications. TestLeft provides an NUnit project template for Visual Studio that simplifies creation of NUnit tests that run TestLeft code. You will be able to run such tests by using the NUnit utility or from Visual Studio by using NUnit Test Adapter.
Requirements
-
You need to have NUnit version 3.2 installed. To learn how to install it, see the Installation section of the NUnit documentation.
-
To run TestLeft tests from Visual Studio by using NUnit Test Adapter, you must have the NUnit 3 Test Adapter extension installed in your Visual Studio. To learn how to install the adapter, see the Adapter Installation section in the NUnit documentation.
-
The NUnit project and test templates are available only for Visual Studio projects that target .NET Framework version 4.5 or higher.
Note: | If you use an earlier version on NUnit or if you use another unit testing framework, you can add TestLeft code to your unit tests and run them by using your framework manually, without using the templates. |
Creating and Running a TestLeft Test
-
Add a TestLeft NUnit Test Project to your solution:
-
In Visual Studio’s Solution Explorer, right-click the solution and then click Add New Project.
-
In the Add New Project dialog, select the Test category and then select the TestLeft NUnit Project type.
-
Click OK to add a project.
-
Visual Studio will add a TestLeft NUnit Project to your solution.
-
-
In the created project, add a reference to the nunit.framework.dll library:
-
The NUnit TestLeft project includes a reference to the SmartBear.TestLeft.dll library.
The project also defines a
TestFixtureBase
class. The class specifies methods to call before, after and when running a test. Use the class to create tests.Note: The project defines a sample test - HelloWorldTest. You can delete it if you do not need it or use it as a base to create your own tests. -
Write your test code. To learn how to create test instructions, see 2. Write Test Code.
-
Build the project.
-
Run the test:
-
After the test run is over, Visual Studio will automatically save the test results to the folder where the test assembly resides. It will store the test results in the unpacked HTML format. Open the index.htm file to view the test log.
See Also
Running TestLeft Tests From Unit Testing Frameworks
Using TestLeft
Writing Test Code