The LoadRunner Add-in for Developers lets you create an NUnit test in Visual Studio for use with LoadRunner.
To create an NUnit test in Visual Studio:
Install the IDE for Dev add-in for your Microsoft Visual Studio version from the download or DVD Additional Components\IDE Add-ins Dev folder. For example Additional Components\IDE Add-Ins Dev\LRVS2012IDEAddInDevSetup.exe.
In Visual Studio, open your unit test. This test should comply with the following guidelines:
- It is a class library
- There is a reference to the NUnit library, nunit.framework.dll, using nunit.framework;
- At least one of the classes in the project should be a TextFixture (using the [TextFixture] annotation)
In the code, instantiate the LoadRunner API function. For example,private LoadRunner.LrApi lr = new LoadRunner.LrApi();
Select DevOps Vuser > Add LoadRunner API Reference to add protocol-specific or general API functions to your test. Alternatively, select Add LoadRunner API Reference from the context menu. Add LoadRunner functionality, such as transactions, think time, messaging, and so forth.
Build the LoadRunner project as a DLL file, which will be saved in the same folder as the project.
Select DevOps Vuser > Run Vuser to run the test with the LoadRunner engine. In the Visual Studio Output window, select Show output from: LoadRunner Information to view the runtime data.
(Optional) Add the DLL as a unit test to an existing or new LoadRunner scenario.
For details, see New Scenario Dialog Box.