Walter has over 30 years of experience in the IT industry covering large scale implementations. Walter has worked on the Broadcom’s Database and DevOps solutions for over 10 years. Walter is presently focusing on Test Data Management and Continuous Testing tool sets.

Become a JMeter and Continuous Testing Pro

Start Learning

Test Your Website Performance NOW! |

arrowPlease enter a URL with http(s)
Jan 12 2021

Integrating .NET Code with Service Virtualization and BlazeMeter VSE

We have developed a new facility that will provide the .NET developer community with the ability of creating, updating, and deleting (CRUD) capabilities for the virtual services provided by Service Virtualization and BlazeVSE. 


The .NET developers will be able to create these virtual services directly from their .NET code, which will improve their unit testing, as well as black box testing; since each developer will have full control of the type of virtual service desired based on the available virtual service platform, such as Service Virtualization (SV) or BlazeVSE (Blazemeter).


This new functionality will provide the .NET development teams with greater efficiency, since the developers can manage and use these virtual services directly from their Microsoft Dev Studio or Dev Studio Code IDE.


Supported Virtual Services

The following are the supported virtual services.


  • RR pairs
  • Zip file
  • Swagger
  • WSDL
  • MAR file


  • MAR file


Nunit Integration

For the SV4dotNet to be able to interact with the SV and BlazeVSE platforms, it needs to integrate with Nunit testing framework to accomplish this process. Nunit is the default unit testing framework, please make sure that you have this unit testing framework installed as part of your MS Dev Studio/Code IDE. Below is an example of what the Nunit tests would look like.




The SV4dotnet library has been designed to be a seamless integration in your MS Visual Studio IDE infrastructure.


Below is a diagram of the architecture, where the sv4dotnet.dll is added to a given .NET solution as a dependency. 


The actions of the SV4dotnet library are manage via the supplied configuration files:

  • SV.config – for Service Virtualization
  • BlazeVSE.config – for BlazeVSE 


As you can see in the diagram below, Nunit will start a test and as part of said test, the developer will call SV4dotNet to create a necessary virtual service prior to making a call to the code under development. Once the testing has been completed, the .NET developer can make the necessary call to delete the service as needed.


Each of the configuration files can be tailored to each developer, where they will provide the SV/Blazermeter server URL, the username/password; as well as additional fields that are specific to their needs.  This provides for additional flexibility in how each virtual service is personalized to the present testing needs.



SV4dotnet Runtime Configuration


The following steps are necessary for a successful integration of SV4dotnet into your .NET solution development environment.


1. Create Nunit tests project as part of your .NET solution

2. Download and add dependencies for the SV4dotnet components

  • SV4dotNet.dll
  • SV.config
  • BlazeVSE.config
  • Log4net.config


3. Install the following dependencies (you can download them via the nuget manager that is part of MS Visual Studio). You would need to work closely with your SCM team/dev management to make sure that you download and install the following packages:

  1. Authenticated Encryption 2.0.0
  2. Log4net 2.0.11
  3. Newtonsoft.Json 12.0.3
  4. SystemConfiguration.ConfigurationManager 4.7.0


4. Add a setup method as part of your test cases. This method will load the config (SV or BlazeVSE).


5. Add the necessary methods to create, update, and delete the virtual services (as needed).


Here is an example of how to setup the Nunit tests:


namespace PetStoreTest
    public class FindPetsTest
        //The below is the url used with the application under test - update this to the virtual service endpoint once you define it in config
        string url = "http://VSE Host Name:8001";
        //Configure the below parameters
        Configuration config;
        string user;
        string password;
        AppSettingsSection section;
        //Configure the below method to execute before the test methods
        public void Setup()
            //The below method to load the config you would like to use (Ex: for DevTest - SV.config and for Blazemeter - BlazeVSE.config)
            //Alternatively to read the below parameter in runtime, you can add it to runsettings file and read it from TestContext.Parameters["Parameter Name"]
            config = SVClient.SVLoadConfig("SV.Config");
            section = (AppSettingsSection)config.GetSection("appSettings");
            user = section.Settings["username"].Value;
            password = SVScrambler.SVScramble(config);
            //Call method below to Create Virtual Service
            //Functionality can be "Create", "Update" or "Delete" depending on what you plan to do
            //path1 and path2 arguments are associated with files for creation of virtual service for SV -
            //In this example, we use Request Response zip file path as path1 - Update it to the path on your machine
            //file argument is associated with files for creation of virtual service for Blazemeter VSE
            HttpResponseMessage response = SVClient.SVProcessRequests(config, user, password, "Create", "demoservicezip", null, "C:\\Migration\\CustomerValidation-TestScriptData\\", null, null).Result;
        [Test, Order(1)]
        public void FindPetsbyStatusTest_newentry()
            HttpResponseMessage response = PetStore.findPetsbyStatus(url, "newentry").Result;
            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);

        [Test, Order(2)]
        public void FindPetsbyStatusTest_onhold()
            HttpResponseMessage response = PetStore.findPetsbyStatus(url, "onhold").Result;
            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
        //Call method below to Delete the Virtual Service - Optional
        //This method requires the arguments - functionality as 'Delete' and the service name to be deleted in addition to config, username and password. 
        public void Destroy()
            HttpResponseMessage response = SVClient.SVProcessRequests(config, user, password, "Delete", "demoservicezip", null, null, null, null).Result;



Here is an example of Nunit “test.runsettings” file that will would allow you to load the desired configuration file dynamically.


<?xml version="1.0" encoding="utf-8"?>
	<!-- Parameters used by tests at runtime -->
		<Parameter name="SVConfig" value="BlazeVSE.Config" />
		 <!-- <Parameter name="SVConfig" value="SV.Config" /> --> 


Special Note


The SV4dotnet also includes support for secured SV portal (https). If you are going to be working in said secured SV environment, you will need to obtain a signed certificate from the SV admin team. The certificate will have a suffix of “CER” or “CRT” and be X-509 complaint for SV4dotnet to use it and be able to establish a trusted connection with the secured SV portal.


Click here to start using BlazeMeter now.

arrowPlease enter a URL with http(s)

Interested in writing for our Blog?Send us a pitch!