6

Composite test script creation – CBTA Test Automation

 1 year ago
source link: https://blogs.sap.com/2023/04/26/how-to-create-a-composite-test-script-cbta-test-automation/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
April 26, 2023 4 minute read

Composite test script creation – CBTA Test Automation

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:

Pic1.jpg

Create 3 test scripts:

  1. Z_AUTO_GENERATE_PR_ AND_PO
  2. Z_STOCK_ORDER_CREATION
  3. Z_CREATE_PR_AND_PO

Go to SM_Workcenter -> Test Suite -> Test Repository (Test Script) -> Create

Pic2_LI.jpg

Assign Executable and test profile

InkedPic3_LI.jpg
InkedPic4_LI.jpg

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.

Pic5.jpg

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

Pic6.jpg
InkedPic7_LI.jpg

Test Script 2: Z_CREATE_PR_AND_PO

InkedPic8_LI.jpg
InkedPic9_LI.jpg

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.

Pic10.jpg
Pic11.jpg

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.

Pic12.jpg

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.

Pic13.jpg

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.

Pic14.jpg

Select create session button to create a new session for the second script and save the script.

Pic15.jpg

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!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK