Add CSV to Flow
Last updated
Last updated
When you're ready to take your automation testing to the next level, it's time to start thinking about testing your flow with multiple variations. This means creating different versions of your test cases and running them against different versions of your software. Doing this can help you find bugs that only show up in specific combinations of your software.
This is important because it helps to ensure that your tests are comprehensive and that they cover all possible scenarios. Creating multiple variations of your tests also allows you to test different parts of the API in isolation, which can be helpful in identifying issues.
Loadmill provides a quick, easy method in testing different iterations of your flow by simply uploading a CSV file containing the different iteration values.
Here's an example for a user management application. This app allows you to add and remove users from your dashboard.
To start with, let's try 5 different email addresses, as well as 5 first names and 5 last names. We'll divide the task into 4 easy steps.
The following table shows the variations we want to test.
The expected_outcome will not be uploaded to the test. This is simply to show you the expected outcome for each variation tested.
first_name | last_name | expected_outcome | |
---|---|---|---|
variation1@loadmill.com | John | Doe | pass |
variation2@random.com | Doe2 | pass | |
variation3 | VariationThree | fail > wrong email | |
variation4@ | John4 | Doe_4 | fail > wrong email |
variation45@company | John_ | $ | fail > wrong email |
The "Create a user" API contains hard-coded values that need to be substituted with the parameter names from the CSV headers (email, first_name and last_name).
To do that, replace the string value to ${...parameter name...}. The ${} wraps the values you set on your CSV file by pointing the parameter name to the column header name.
Request Body (before)
Request Body (After)
Now that you're done, the last step is to upload your CSV file by clicking on the CSV button.
By running the suite, we see the 5 iterations of the flow we created, each sending the server the values from the uploaded CSV.
We notice that the last two test iterations have passed when the expected outcome would have been to fail. That is a crucial part in testing your server as it allows you to understand how your API behaves in those scenarios.
Overall, creating multiple variations of your API tests is important because it helps to ensure that the API is functioning correctly and that it meets all expectations. By doing so, you can avoid potential issues and ensure that your API is ready for production.