Overriding Dataset Values in Other Projects
One challenge that you may encounter with your test automation is test cases that are common across all teams with datasets that are specific to a team, and one team’s data should not be viewed by another team.
To address this, you can start by creating test cases and data templates in the Common project, and then creating datasets and execution sets in other projects. The key is to use the same name for all the datasets, so that the project-specific datasets can be specified on the execution sets, which will override the default datasets specified on the test cases.
For example, in Common project, we will create a test case called “dataset_override_test” which prints a value injected from a data template called “dataset_override_test“
Create a unique dataset name that can be used to distinguish each project.
As a dataset value, we will use “This value is from Common project“
Afterwards, we will switch to an entirely different project than Common either from the left panel or by hovering over the user and clicking the name of the displayed project.
After selecting the project, click Change and click Yes
In the other project, hover over Repository and click Data Templates
Create a new Data Template with the exact name which was used in Common project
Add a different value in your dataset which will be used in this project. We will use “This value is from Test project“
Confirm that your data templates have the same names and that you see both of them
Hover over Executions and click Execution Sets
Click + Add to create a new execution set, enter a name and select the desired pool
Click Test Data Selection tab
Search for the test case which was created in Common
Drag the test case into the Selected Test Cases in the middle of the screen
Click on the checkbox in the middle of the screen next to the test case name. You will now see the dataset selection on the right side of the screen.
Notice that the displayed label shows that the project you are currently in is called Test and that the dataset name reflects the name of the dataset created in this project, not Common.
Save & Close then execute the set in the cloud by clicking on the checkbox next to it and choosing Cloud Run.
To view the results, click on the name of the execution set.
After execution completes, expand your results to see which value was printed. As we can see below, the value from Test project was printed, so the value from Common was overridden by the one created in this project.
The same can be reproduced in local and independent executions.