How to work with NUnit Assertion as step in Test Studio

Learn more about Test Studio here


After I written this post How to work with MS Unit Test Assertion as step in Test Studio , I got a question,

How can I use NUnit Test Assertion in a Test Step while automating test with Test Studio?

Answer of this questions is also lies in three steps,

Step 1:

Add reference of nunit.framework dll in Test Project

Step 2:

Create a coded step

Step 3:

Write Assertion in test

Add Reference

There are in two ways you can work on Test Studio. Either on Visual Studio plugin or on Test Studio standalone version.

Adding reference in Visual Studio is simpler. Right click on test project and from context menu select Add Reference. Browse to nunit.framework.dll library and add reference in test project.

Even though you have added reference in Visual Studio make sure that you have added reference in test project opened in standalone version else you will get exception.

To add nunit.framework.dll assembly in Test Studio standalone version you need to follow following steps,

Select Project option in top menu


Click on Show Settings in project tab


On clicking on Show Settings you will get Project Settings dialog box. In dialog box click on Script Options. To add assembly reference click on Add Reference.


When you clock on Add Reference Test Studio will open File Chooser dialog box. In that browse nunit.framework.dll assembly reference location in file system and select that to add as reference in current Test project.

Create a coded step

To create Coded Step in select Test and from menu


You will find coded step added as below,


Write Assertion in Test

Once Coded step is added you can write any assertion. To validate I am writing a very simple assertion as below,

You can view below code in Visual Studio,

[CodedStep(@"New Coded Step")]
 public void NunitTest_CodedStep()
 NUnit.Framework.Assert.AreEqual("Telerik", "Telerik");


In Test Studio standalone version codes step will look like as following,


Now go ahead and execute test. You should able to get test passed successfully as given below,


I hope you find this post useful. To speedup automated testing do not forget to download trail of Test Studio from here