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 Mock 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.

services overview

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.

transactions

When you are creating a Mock Service, you are required to associate the Mock Service with a Service. The Transactions that are available for your Mock 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.

Mock Service

A Mock Service can stand in for the live service for testing purposes. A Transaction-Based Mock Service is filled with a collection of Transactions, typically a subset of the Transactions in a Service. You run a Mock Service to deploy those Transactions. Once a Mock Service is created and running, you can associate it with your test, embed it in your test scripts, or provide it during test execution.

list of mock services

Mock Service Template

A template is a common collection of Transactions that you can use to generate a Mock Service for those transactions anytime you need one. Templates are persistent objects that can either directly create Mock Services or load transactions into a running Mock 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. Mock Services get predefined tags assigned automatically, so you recognize the Mock 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 Mock Service, transaction, or processing action, you can define environment variables for Mock 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 Mock Service Configurations.

The Learn More tab

The Learn More tab lets you create a Mock Service by uploading Transactions from a supported file type, such as Swagger or HAR. From the Mock Services tab, you can also create a Mock 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 Mock Service, you can select the specific Transactions that you want to include and then run the Mock Service to make them available for tests.

The Start Mocking Now Wizard

To make onboarding of Mock Services users as easy as possible, we are introducing “Create New Mock Service” wizard. It is an interactive and guided step by step journey of how to create new Mock Service. In five steps, you can create ready to use Mock Service with all necessary artifacts and settings.

Follow these steps:

  1. Log in to BlazeMeter and click the Service Virtualization tab.
  2. Click the Start Mocking Now button.
    start mocking now button
  3. Follow the instructions in 5 steps.
    the 5 mock service creation steps
  4. Click Run Mock Service.
    BlazeMeter will set up the Mock Service endpoint.

Your Mock Service is running. Copy the provided Example Request URL to your browser. To use the Mock Service, copy the provided Endpoint and use it in the place of the real service endpoint.