Scenarios vs Scenario Outlines
How to avoid repetitive scenarios
Last updated
How to avoid repetitive scenarios
Last updated
At some point you may find yourself copying and pasting the same scenario, while only making small changes. This may be avoided by using Scenario Outlines instead.
Let me demonstrate it with an example. Let's say we need to test a user's ability to navigate to a Maximo application. We may write a scenario like this:
Here we test that the user successfully navigates to the Assets application. Executing it, we get this run report (click here to see this run report in testgrinder):
This looks good, but what if we also need to test user access to other applications like Locations and Work Order Tracking ? We could copy/paste the scenario with the necessary changes:
(You may see the run report for these scenarios here)
This is starting to get repetitive. And making numerous similar changes may lead to errors. Instead of copying we could switch to a Scenario Outline to avoid that. Here's the Scenario Outline that accomplishes the same task:
To transition to a Scenario Outline, add the word Outline after the Scenario, then introduce the Examples table after the steps. The Examples table has a header row with the column names (Path and Application in this example) and then zero or more rows (examples) with the values. Each table row needs to have a vertical bar ( | ) at the start, between the values, and at the end of the row. Here we have three rows, one for each application we test. To use the example values, you simply insert them in the appropriate parts of the steps while surrounding with angular brackets ( < and > ).
When running a Scenario Outline, testgrinder will treat it as several independent scenarios, one for each example row with the example values pugged in into the steps, and executes them concurrently.
Note that you may plug in example values not only in steps but also in the scenario outline name. This is useful for distinguishing each individual scenario outline run in the run report:
(You may see the run report here)
The usefulness of scenario outlines grows with the number of possible examples it needs to run. It may be a toss-up whether to have three scenarios or one scenario outline with only three example lines for a short scenario (like in the example above). But if your scenario is long, or you have lots of examples to run it on, the benefits of using a scenario outline become obvious.
One of the uses of scenario outlines is to simulate Maximo system load similar to that created by concurrent Maximo users. For example, you could write a scenario that approximates a typical Maximo user session, then convert it into an outline with the number of examples equal to the number of concurrent sessions you'd like to simulate. Run it, and observe how Maximo handles the simulated load.
Another common use of scenario outlines is for loading/modifying Maximo records in bulk. The steps would capture how the data is to be entered into Maximo, and example rows provide the data to enter. Examples being written as a table allow for an easy transfer of data from a spreadsheet - just add columns of vertical bars around the data.