Working with Variants in CBTA and using them in Test Plans (Step-by-step guide)
2023-10-5 21:34:55 Author: blogs.sap.com(查看原文) 阅读量:3 收藏

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:

  1. Open SAP GUI and log in to the system where you can modify TDCs
  2.  Execute Transaction SECAT
  3.  Select Test Data and fill in a name starting with Z then press F5
  4. Select Local Object and continue
  5. In the attributes tab fill in Title and select Application Component. I use: CA-WUI-APF
  6. Move to the Parameters tab. Create as many parameters as you need and add their default value
  7. 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
  8. Save the test DATA container
  9. Now go to your test configuration that you want to use with TDC
  10. Go to Test Data tab. Press EDIT and select Test Data Assignment Wizard
  11. 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
  12. Press Select Test Data container – the buttons are on the bottom you might need to scroll down
  13. Select your TDC and press on the button above stating Assign Parameters
  14. 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.
  15. Select the proper mapping and click Assign Manually
  16. 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
  17. If everything is right you should see a green field with the mapped parameter and the values that will be used
  18. Click Save Test Data Assignment to TC
  19. Go back to your test configuration – you should be able to see the TDC and Variants assigned in the Test Data Tab
  20. 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:

  1. First Open the Solution Documentation
  2. Find your test configuration and EDIT it on the right-hand side
  3. You have to change the value of Test Data Variants.
  4. By default, it stays with the default value. You can input 1,2,3 – the different variants or input  * which means all.
  5. 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.

Thats it.


文章来源: https://blogs.sap.com/2023/10/05/working-with-variants-in-cbta-and-using-them-in-test-plans-step-by-step-guide/
如有侵权请联系:admin#unsafe.sh