QualityMate MSTest Integration Sample Web
Last updated
Last updated
What does this guide cover?
Creation of a test solution that integrates QualityMate with MSTest Framework.
The proper solution structure that you should use.
The QualityMate NuGets that you need.
A basic .runsetting
parameters file.
A simple Page Object and Test Case to run on a web browser.
The completed sample solution described in this article can be downloaded here:
This guide assumes that you will use our asset application.
To create our first Test Case with QualityMate MSTest Integration, we're going to:
Create a test C# project using the .Net Framework version 4.6.1 or higher and name it HelloWorldUiTesting
. If you're working on Visual Studio, information on how to do this can be found here.
The test class should be named TC_HelloWorld.cs
.
Create an Assets
folder inside the project folder.
Decompress the downloaded assets on the Assets
folder.
Set the assets files and web driver reference to copy to the output directory. To do this, open your project file (HelloWorldUiTesting.csproj
) and add the following lines:
Create a TestCases
folder inside the project folder in which we will save our test class.
Add the Mobilize.QualityMate.UiTesting.MsTest
package through the NuGet package manager.
The project folder structure should look like the following example:
It's time to create our first Page Object; we're going to do the following:
Create a folder named PageObjects
inside the project folder.
Create a Form1.cs
file inside the PageObjets
folder.
Add the following usings in the Form1.cs
file:
Create the UI controls that we are going to use on Form1
class like the following:
The fields specified in the code snip above represent each UI control of the assets' application.
We are going to specify the behavior of QualityMate by doing the following:
Create a MyRunParameters.runsettings
file inside the project folder.
Specify the parameters that QualityMate will use as the following example:
Load the MyRunParameters.runsettings
file on your IDE. If you're working on Visual Studio, information on how to do this can be found here.
Once we have a PageObject, we can create a new QualityMate script on the TC_HelloWorld.cs
file:
Add the following using statements in the TC_HelloWorld.cs
file:
The TC_HelloWorld
test class should be inherited from UiTest
class and has the TestClass
attribute.
Create the method HelloWorldScript(UiExecutionController controller)
, this method will let us interact with the UI using the controller with the next code:
Create a new test method HelloWorld()
that will call our script using the UiTest's Execute()
method.
Compile the test project and run the test case to see the magic happen. Great isn't it?