CBTA 3.0 SP 19.2
Solution Manager 7.2 SP 16
SAP GUI 800
Component Based Test Automation (CBTA) is a test automation tool in Solution Manager 7.2 and usage right is available to all enterprise customers. CBTA allows to create end-to-end test scripts for functional testing. It supports various UI technologies such as SAP GUI, Web/Plain HTML, WebCUIF, SAP UI5 & FIORI, Unified Rendering Light Speed (LS), BSP, Java Web Dynpro etc.
In this blog post, we will discuss about composite scripts. CBTA test scripts can be reused as child test scripts of other CBTA test scripts. Composite script consists of two or more child scripts. Each child test script is treated as a step of the parent test script. Parameter of one child script can be exposed and passed to other child script by changing their usage type.
Example, we have first test script for creating Stock Order and a second test script which takes Stock Order as input and generates Purchase Requisition and Purchase order as output.
Test Script 1: Z_STOCK_ORDER_CREATION
Creation of Sales Order - This Test Script which will take various input parameters and generates a Stock Order.
Input parameters – Sales Document Type, PO number, material number etc
Output parameters – Stock Order number
Test Script 2: Z_CREATE_PR_AND_PO
Creation of PR and PO - This script takes Stock Order as input parameter and generates Purchase requisition & Purchase Order.
Input parameters – Stock Order number
Output parameters – PR number, PO number
In such a scenario output parameter of first script needs to be passed to second script as input, as shown in below figure:
Create 3 test scripts:
- Z_AUTO_GENERATE_PR_ AND_PO
- Z_STOCK_ORDER_CREATION
- Z_CREATE_PR_AND_PO
Go to SM_Workcenter -> Test Suite -> Test Repository (Test Script) -> Create
OK
Assign Executable and test profile
Similarly, create 2 more scripts
Z_STOCK_ORDER_CREATION and
Z_CREATE_PR_AND_PO. Assign these scripts as CBTA Test Script steps to first script.
Launch CBTA and record the scripts.
After generating a test script from a recording, you can edit the parameters and their mapping in the Test Composition Environment (TCE) on the Test Script tab.
Test Script 1: Z_STOCK_ORDER_CREATION
Test Script 2: Z_CREATE_PR_AND_PO
Our Objective is to pass parameter Stock Order created in Test script 1 ‘
Z_STOCK_ORDER_CREATION’ to Test script 2 ‘
Z_CREATE_PR_AND_PO’.
Open Test Script 1 ‘
Z_STOCK_ORDER_CREATION’ in ‘Edit’ mode and select the CBTA default component from which we would like to extract the value. Check the Test tool execution report to correctly understand the parameter name.
Stock order value is stored in parameter “MessageParameter1. Make this parameter exposed so that it can be used by next script.
Select ‘Exposed’ in usage column and save.
Go to the composite script Z_AUTO_GENERATE_PR_ AND_PO and select Test script 2 ‘
Z_CREATE_PR_AND_PO’. Select the parameter ‘Order_Number_1’ and go to Ref Parameter column.
Press F4 help and you will see exposed parameter ‘MESSAGEPARAMETER1’ from first script. Select ‘MESSAGEPARAMETER1’ which is passed from Test Script 1 ‘
Z_STOCK_ORDER_CREATION’ and save the script.
Select create session button to create a new session for the second script and save the script.
Furthermore, we can add ‘n’ number of steps in the parent script and expose the parameters to next script to create an end to end business scenario.
Hope this blog post helps you in understanding the key concepts of test script recording and parameter mapping of a composite script in Solution Manager 7.2.
SAP Sources:
Component-Based Test Automation (CBTA) | SAP Help Portal
Happy learning!