Introduction to Service Virtualization
Service Virtualization emulates the behavior of web services to remove dependencies during development and testing.
Terminology
To understand how to build virtual services, it is important to understand what BlazeMeter means by the following terms:
Transaction
A Transaction is a request/response pair that is associated with a given Service. For example, in the Swagger Petstore, GET /pet/{petId} and its associated response is a Transaction. The request in a Transaction can be a single request, or it can represent multiple potential requests using regular expressions.
Service
Within BlazeMeter, a Service is a logical grouping of Transactions. These Transactions can be anything, but typically, a Service is a grouping of Transactions that are related to a specific live service. Anytime you upload Transactions from a supported file type, you are prompted to either assign those Transactions to a Service or create a new Service.
The Transactions section lists all of the Transactions that are available to you. You can filter the list of Transactions by Service name to make it easier to find the specific Transaction that you are looking for.
When you are creating a virtual service, you are required to associate the virtual service with a Service. The Transactions that are available for your virtual service are determined by the Service that you select. You can either choose from existing Transactions in the service, or you can upload a Swagger, HAR, or WSDL file that has the Transactions that you need. For more information about file formats, see Adding Transactions.
Virtual Service
A virtual service can stand in for the live service for testing purposes. A Transaction-Based virtual service is filled with a collection of Transactions, typically a subset of the Transactions in a Service. You run a virtual service to deploy those Transactions. Once a virtual service is created and running, you can associate it with your test, embed it in your test scripts, or provide it during test execution.
Virtual Service Template
A template is a common collection of Transactions that you can use to generate a virtual service for those transactions anytime you need one. Templates are persistent objects that can either directly create virtual services or load transactions into a running virtual service when you associate it with a test.
Tags
In context of Transactions, a tag is a custom identifier that makes it easier to find the Transactions that you are looking for. In addition to filtering by service name, you can also search for transactions by their tags. Virtual services get predefined tags assigned automatically, so you recognize the virtual services that have optional settings enabled. These tags are "Think Time", "Redirect to Live", or "Stateful".
The Configurations tab
Rather than hard-coding recurring configuration values in a virtual service, transaction, or processing action, you can define environment variables for virtual services to use at runtime. Use the Configurations tab to create custom name-value pairs and refer to these properties in ${config.name}
format. For more information, see Virtual Services Configuration.
The Learn More tab
The Learn More tab lets you create a virtual service by uploading Transactions from a supported file type, such as Swagger or HAR. From the Virtual Services tab, you can also create a virtual service from an existing Service or a Template. If you want to add more Transactions to the Service, you can upload additional Transactions without having to switch tabs. As you create your virtual service, you can select the specific Transactions that you want to include and then run the virtual service to make them available for tests.
The Start Virtualizing Now Wizard
To make onboarding of Service Virtualization users as easy as possible, use the “Start Virtualizing Now!” wizard. It is an interactive and guided step-by-step journey of how to create virtual services. In five steps, you can create ready-to-use virtual services with all necessary artifacts and settings.
Follow these steps:
- Log in to BlazeMeter and click the Service Virtualization tab.
- Click the Start Virtualizing Now button.
- Follow the instructions in 5 steps to create the service, define the service, and configure it.
- Click Run Virtual Service.
BlazeMeter will set up the virtual service endpoint according your choices and run it.
Your virtual service is running. Copy the provided Example Request URL to your browser to review the response.
To use the virtual service, copy the provided Endpoint and use it in the place of the real service endpoint.