You can add stubs from external mocking tools to use those definitions as Mock Services in BlazeMeter.
The following external tools are supported:
You can integrate Transactions between Mock Services and Wiremock or CodeSV in the following ways:
- Add Transactions from Wiremock or CodeSV to the Transaction repository by exporting them to a JSON file
- Add Transactions from Wiremock or CodeSV to the Transaction repository by uploading them directly from the code
- Refer to Transactions in the Transaction repository in your Wiremock or CodeSV code
Prerequisites for In-Code Sharing Between Mock Services and Wiremock or CodeSV
To interact with the Transaction repository directly from your Wiremock or CodeSV code, ensure that you meet the following prerequisites.
Note: These prerequisites are not required if you are simply uploading JSON files exported from Wiremock or CodeSV.
The Wiremock extension library is required to connect with Blazemeter Mock Services:
Use these dependency definitions to add CodeSV to your project:
Exporting Transactions to a JSON file
Export virtual endpoint definitions from your code into a JSON transaction file, which you can then import into the Transaction Repository through the Mock Services UI. Using this method, developers using mocking tools can share the artifacts they created in their code with other team members who can load them into the Mock Services UI, augment them as needed, and run them as Mock Services hosting the content imported from the code.
Note: The vanilla Wiremock library lets you export a JSON DSL file using the WireMock.saveAllMappings(); method. Any file exported using this approach could be imported to Mock Services.
After you export the definitions into JSON, you can add them as Transactions from a file to the Transaction Repository.
Upload Transactions to Transaction Repository from Code
You can directly upload in-code definitions of virtual endpoints to the Transaction Repository. Once the test with these definitions runs, they are converted from their in-code form into Transaction format and uploaded to the repository.
This is another way that developers using CodeSV or Wiremock can share the artifacts they created in code with other team members, who can use and augment them in the UI as Mock Services.
When you use this method, the Transactions included in the test are automatically loaded into the Transaction Repository.
Reference Transaction Repository from Code
For Transactions that already exist in the Repository, you can reference them directly from the code in your mocking tools. This lets developers use Transaction definitions that other team members created in their code.