Working with Variants in CBTA and using them in Test Plans (Step-by-step guide)
Variants are a really powerful tool in the CBTA automation process but they are not very well described. Here is what I found in my free time and digested it for more practical use:
First, you need to create your Test Data Container (TDC)
TDC is the place where you are going to store your parameters and their variants.
You can have multiple parameters in one TDC and multiple variants for them.
Here is an example:
Person ID Variant1: aaa Variant2: bbbb Variant3: cccc
Address Variant1: address1 Variant2: address2 Variant3: address3
Here we have 2 parameters with 3 variants.
How to create TDC:
- Open SAP GUI and log in to the system where you can modify TDCs
- Execute Transaction SECAT
- Select Test Data and fill in a name starting with Z then press F5
- Select Local Object and continue
- In the attributes tab fill in Title and select Application Component. I use: CA-WUI-APF
- Move to the Parameters tab. Create as many parameters as you need and add their default value
- Now move to the Variants tab and create as many variants as you need for your parameters and fill in their values. Have in mind that the ECATDEFFAULT is picking up the values you intputed in step 6
- Save the test DATA container
- Now go to your test configuration that you want to use with TDC
- Go to Test Data tab. Press EDIT and select Test Data Assignment Wizard
- Now you have to map the parameter you want to take the values(from the test configuration) with the parameters you have in the TDC
- Press Select Test Data container – the buttons are on the bottom you might need to scroll down
- Select your TDC and press on the button above stating Assign Parameters
- On the left side are the exposed parameters of your test configuration on the right side are the ones that you defined in your TDC.
- Select the proper mapping and click Assign Manually
- Then Move to Assign Variants. Here you can select which variants you want to map to your test configuration. Simply use the checkbox and move to the last step
- If everything is right you should see a green field with the mapped parameter and the values that will be used
- Click Save Test Data Assignment to TC
- Go back to your test configuration – you should be able to see the TDC and Variants assigned in the Test Data Tab
- Scrolling to the right and pressing the Reference button you can see which value will be assigned to which parameter
So now when you execute your test configuration you can go to the variants tab and select which variant you want to use.
If you want to use test variants for Test Plans you need to do the following:
- First Open the Solution Documentation
- Find your test configuration and EDIT it on the right-hand side
- You have to change the value of Test Data Variants.
- By default, it stays with the default value. You can input 1,2,3 – the different variants or input * which means all.
- When you add this test script into a test plan and * is selected – it will run the test with all variants. This means if you have 4 variants the test will be run 4 times and each time the value will be switched.
If you select 1 the test will be executed with only Variant 1.