You can write test code using C# and Visual Basic .NET languages, and you can add your test code to projects of any supported type in Visual Studio.
In addition, TestLeft provides templates for creating tests in Visual Studio. You can run projects created via these templates by using MSTest, NUnit and xUnit.net unit testing frameworks. This way, you will be able to create and run TestLeft tests using the testing framework you already use in your company.
In this tutorial, we will create a test project based on the TestLeft MSTest Project template:
Add a new project to an existing Visual Studio solution or create a new project.
In the New Project dialog, make sure that the project targets .NET Framework version 4.5 or higher.
In the list of project templates, select the Test category and then select the TestLeft MSTest Project template.
If needed, specify the project name and location.
Visual Studio will create a new TestLeft MSTest project and add it to your solution:
To create TestLeft tests, you must have a reference to the SmartBear.TestLeft.dll library added to your Visual Studio project. The library is shipped with TestLeft and resides in the <TestLeft>\API\dotNET\ folder.
Our project is based on the TestLeft MSTest project template and has the needed reference by default:
If you create a project from scratch, add the reference manually.
SmartBear.TestLeft.dll library declares namespaces that provide base test classes and interfaces for all the supported application technologies. In the source file where you will create your test code make those namespaces available in the file's name scope.
In this tutorial, we will need the
SmartBear.TestLeft.TestObjects namespaces. They are already available in our TestLeftTest source file:
If you create a test module from scratch, or if you need other
SmartBear.TestLeft namespaces in your tests, make them available manually.
The project created by using the TestLeft project template has the sample
HelloWorldTest test method. Let’s delete it and create a new test method from scratch.