Test Data Management

In this guide you will learn how to automatically keep your test data up to date so that your performance tests are ready to run any time.

To follow along you need our command line tool to be installed. If you are on macOS it is as simple as brew tap stormforger/forge && brew install forge. We also offer our CLI for other platforms, please check our installation guide.

As always, if you have any questions, feel free to get in contact any time!

Test Data Management with StormForger CLI

Keeping your test data up to date can a bit challenging. But on the other hand it is a crucial part to be ready to run performance tests anytime and also to be able to run test on a regular basis, for example using our scheduling feature.

Let's say you have a performance test defined for your web shop where you need product information to navigate to product detail pages. We will need the internal ID, one stock keeping unit identifier (SKU) and the matching product SEO-slug which is used in product page URLs. Here is an example of this data in CSV format:

id,sku,slug
346556,616da072-38a1-4002-ab57-d06a4930e627,acme-earthquake-pills
537925,a6588a43-5e6e-4cad-b408-809745af0e27,acme-disintegrating-pistol
892976,de154984-6e4b-4c44-9481-db2204d11694,bird-seed

Here is a quick example snippet on how to work with the data (for more details check our documentation on data sources. We will load the product detail page and then add the product to the basket:

var products = session.ds.loadStructured("shop/blackfriday.csv");
var product = session.ds.pickFrom(products);

// visit product page at /p/2342-product-slug
session.get("/p/:id-:slug", {
  params: {
    id: product.get("id"),
    slug: product.get("slug"),
  }
});

// add product to basket
session.post("/cart/add", {
  payload: JSON.stringify({
    id: product.get("id"),
    sku: product.get("sku"),
    amount: 1,
  })
});

Your QA environment is a living system and changes all the time (new products get created etc). In order to perform daily performance tests against this environment you also have to keep shop/blackfriday.csv up to date. Otherwise your test might be producing more HTTP 404 Not Found then you indent to!

One way would to do that manually by uploading new test data. Or, you could automate it!

Putting Things Together

Let's say you have a script in place called script/export-product-data.sh which prints out test data for products from the QA system in the format we require. You can combine this with the forge datasource push command like this to upload it to StormForger:

$ script/export-product-data.sh > tmp/products.csv
$ forge datasource push acme-inc tmp/products.csv \
  --name shop/blackfriday.csv \
  --fields id,sku,slug
Uploaded shop/blackfriday.csv successfully!

List of Data Sources

If you now add a job to your build system like Jenkins to run regularly (e.g. daily or every hour), you can automatically push a fresh version of test data to StormForger to be always ready to run tests.

forge datasource (or forge ds for short) can do a lot more. Check out more features and options using forge datasource help.

Get started icon

Get Started

New to the StormForger?
With these guides you’ll be up and running in no time!

FAQ icon

FAQ

Already took a look at our FAQs?

Support icon

Support

Are you stuck? Talk to us! We're humans.

We are using cookies to give you the best online experience. If you continue to use this site, you agree to our use of cookies. By declining we will disable all but strictly required cookies. Please see our privacy policy for more details.


Accept Decline