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
- MAR file
- MAR file
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
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:
- Authenticated Encryption 2.0.0
- Log4net 2.0.11
- Newtonsoft.Json 12.0.3
- 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:
Here is an example of Nunit “test.runsettings” file that will would allow you to load the desired configuration file dynamically.
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.