Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

How to deal with test data inside of test cases



I wanted to find out if TestRail has a feature for this or if you have any suggested best practices?

So we have test cases that we want to be fairly generic that can be used to test in different test environment and against different customer configurations. The test steps will be the same regardless of which environment we test in. The test data however will be different depending on the environment or the customer that we are testing against.

For example, say a test case has these steps:

  1. Enter a customer number
  2. Enter an equipment number
  3. Press enter to create contract

In the example above “Customer Number” and “Equipment Number” is the test data that would vary between environments. I don’t want to have to specify the test data inside of the test steps (e.g. For Environment1 use 8978, for Environment2 use 1420, etc.).

Is there a way to specify that the customer number in this case is a variable? and then we could tie that to some test data where the person running the test would know which customer number to use based on the environment they are currently running the test in?

Please let me know what the best practice or approach is for handling this in TestRail.



Hi Tarik,

Thanks for your posting. Variables or different case variants are currently not directly possible and we would indeed recommend storing additional test data directly inside the test case. You can either use steps or tables in this case:



So would you recommend creating a custom text field called “Test Data” and just using a table such as to specify the test data?

||| :Enviornment| : Variable | :Value
|| Environment 1 | CUSTOMER_NUMBER | 7822
|| Environment 2 | CUSTOMER_NUMBER | 8134
|| Environment 1 | EQUIPMENT_NUMBER | a35
|| Environment 2 | EQUIPMENT_NUMBER | b352

Just curious what other companies have done and what you would suggest is the best practice?



Hi Tarik,

Yes, that’s probably the best approach and you can add a separate custom field on the case level for this. This option is now in use by a quite a few customers since we introduced table support last year. An alternative is to use the steps field. The tables are usually more flexible but the steps allows you to assign a separate status to each step: