Create a Virtual Service for AWS Testing

BlazeMeter includes a set of pre-built Transactions for testing AWS S3 cloud storage operations in your application. To find these Transactions, select the AWS S3 Sample service on the Asset Catalog page:

AWS S3 sample service

This tutorial describes how to use these Transactions to create a virtual service to test key S3 operations in your application. We'll use Templates to group positive and negative scenarios from the Service, from which we can then dynamically provision virtual services for each scenario as needed:

  1. Navigate to the Service Virtualization tab and click Virtual Services.
  2. Click the Add button next to Virtual Service Templates.
  3. Name the Template "AWS S3 - Positive Scenarios", select the AWS S3 Sample service, and give the Template a meaningful description as pictured:
    example aws service template
    When you select the AWS S3 Sample Service, the left pane of the Template populates with all of the transactions in that Service. Expand each Transaction to view details, for example:
    the AWS Store Object transaction
    Each pre-built Transaction contains a clear description so you understand what the request will do.
    If you need to know more details about the Request or Response, find the Transaction on the Transactions page.
  4. Move the following Transactions to the right pane:
    • Return object metadata (ok response)
    • Delete object (ok response)
    • Store object (ok response)
    • Retrieve object (ok response)
      AWS transactions added to the positive scenario template
  5. Click Save.
    The Template is created.
  6. Click Add again to create the Template for negative scenarios.
  7. Name the Template "AWS S3 - Negative Scenarios", select the AWS S3 Sample Service, and give the Template a meaningful description as pictured:
    sample aws template negative scenario
    When you select the AWS S3 Sample service, the left pane of the Template populates with all of the Transactions in that service.
  8. Move the following Transactions to the right pane:
    • Delete object (AccessDenied error)
    • Retrieve object (NoSuchBucket error)
    • Store object (OperationAborted error)
      AWS transactions added to the template of the negative scenario
  9. Click Save.
    The Template is created. Because we created Templates for these transactions, there are multiple ways you can leverage the Templates to become virtual services. Let's cover one way for each Template.
  10. Click Create Virtual Service to the right of the AWS S3 - Positive Scenarios Template.
  11. Name the virtual service "AWS S3 - PUT and DELETE", leave the AWS S3 Sample service selected, and give the virtual service a meaningful description as pictured:
    aws example positive scenario virtual service
  12. Remove the Return and Retrieve object transactions from the right pane.
    virtual service with some transactions removed
    As specified in the description, you only want to test a PUT and DELETE with this virtual service. The Template presented all positive scenarios, and from those you chose the Transactions required for this particular test.
  13. Click Save.
  14. Click Run Virtual Service.
    The virtual service is running and available to use for testing.
    the running AWS put and delete virtual service
  15. Redirect the application under test to use the endpoint for the virtual service instead of the live service.
    You can write and run a test or tests that uses the report.json object defined in the Transactions to test S3 functionality using the virtual service.
    Now, let's create a virtual service that a tester can use for negative testing when defining a test.
  16. Click the Add button next to Virtual Services.
  17. Name the virtual service "AWS Testing", add no Transactions, and click Save.
  18. Click Run Virtual Service.
    The AWS Testing virtual service is running and available. Now, when a tester needs a virtual service to test AWS S3, they can reference the virtual service and an associated Template within the test.
    the running aws virtual service
  19. Create a test in BlazeMeter, or update an existing test. Access the Configuration screen.
  20. Enable the Virtual Services Configuration.
  21. Click Add, and select the virtual service you created and the Template that contains the negative testing scenarios:
    a virtual service that was added to a test definition
    The virtual service is now built into the test and will include all of the Transactions in the negative testing Template.
  22. Copy the endpoint and redirect the application under test to use the virtual service endpoint in place of the live service before running the test.