How to create a composite test for an End-to-End business scenario using CBTA test scripts
Solution Manager 7.1 SP 7 or higher, ST-TST 300 SP0 or higher, CBTA 3.0 SP2 or higher (frontend), SAP GUI 7.30 or higher, ST-PI 2008 SP6 or higher, ST-A/PI 01P or higher.
The Component Based Test Automation is shipped with SAP Solution Manager 7.1 SP07 and higher. CBTA allows the creation of automatic tests like eCATT via a dedicated recorder. It supports scenarios on systems under test that are based on the SAPGUI, SAP CRM web-client, SAP ABAP WebDynpro, SAP Portal, SAP WEBGUI, BSP, SAP Java WebDynpro technology.
Unlike eCATT (record and playback approach), CBTA test scripts follow a modular approach. Therefore, test components can be reused and damaged test scripts be repaired fast. Apart from that, CBTA scripts can be created easily by business analysts while eCATT requires developers’ expertise to creation and maintain test cases. CBTA is composed out of 2 software components: An add-on to be installed on SAP Solution Manager 7.1 from SP7 onward, and a front-end component to be installed on the user’s desktop.
The following are the prerequisites that have to be met in order to use the CBTA script recording functionality for composite test scripts.
- Check the compatibility for CBTA for front end, ST-TST 300, SAP GUI, ST-PI and ST-API (Available on SAP service market place).The CBTA compatibility matrix can be downloaded from http://service.sap.com/testing > Additional Information. Also refer the SAP note: 1763697 for more details on installation and configuration.
- Install required SAP notes for both solution manager and managed system under category CBTA.
- Complete the configuration for CBTA on solution manager along with SUT- System Under Test (managed system) for which the test is to be executed.
- Maintain connection and credentials for SUT. Manage the SUT using CBTA setting under Test Management work center.
- Enable scripting for SAP GUI on both solution manager and SUT.
- Run self-checks for CBTA and SUT, also create SDC (System Data Container) for a project under which the business process is defined and want to assign the composite test script.
Additional information related to CBTA configuration in SAP Solution Manager can be found in CBTA Release Document and How-to Guide of CBTA.
Composite Test Configuration:
A composite test configuration comprises of test scripts (CBTA, eCATT or 3rd party test scripts), a system data container and a test data container (for data variant). You create a composite test configuration to create an end to end automated test case. The parameters can be passed between the scripts by changing their usage type. The data variant can be assigned using the test data container. The parameter values for which variant has to be assigned, must be of usage type ‘Exposed’.
In the above figure , the composite test script is made of three individual CBTA test scripts. Each CBTA test script is made up of two types of components.
Default components are delivered by SAP with the CBTA software. They are stored in the SAP Solution Manager repository for eCATT test scripts (you can also create custom components in custom libary and can be called for specific requirements). They are used for standard actions like entering a value in a field, pushing a push button, selecting a tab page.
Screen components are generated after the recording. For each screen, a screen component is generated during the inspection process. This process retrieves information on the screen from the System Under Test (SUT) and generates a screen component. It contains one parameter for each field of the screen. The value can be assigned to such a parameter for which the system enters it in the corresponding field during execution.
A screen component reflects a single version of a screen. To differentiate between the versions of a screen, the system uses the system data container (SDC) and the target components. The version of a screen is the same on all systems of the same SDC and target component. For other systems, other screen components are created. You can reuse default and screen components in several test scripts. When a screen is updated, its screen components can be repaired, to make the repair of test scripts easier.
You have to define the sequence of the test scripts (steps) to be executed and the values of parameters. The parameter value can be passed by setting the usage type to ‘Local’ and providing the appropriate reference to the succeeding script.
Creation and execution of Composite Test Configuration:
Here, for our example we will consider only first two steps of an end to end composite test example. We want to create a composite test script comprising 2 steps (scripts) with the following parameters:
Step -1 Create quotation (CBTA script 1):
Import parameters: Customer, Material, Quantity etc.
Export parameter: Quotation Number.
Step-2 Create sales order from quotation (CBTA script 2):
Import parameter: Quotation Number
Export parameter: Sales Order Number
First, you will require a test configuration where you can add these two steps. This can be created directly from Business Blue Print (where the Business Processes are defined) as an Ad-hoc execution approach. You can also create the same from the ‘Test Composite Environment’ under ‘Test Management Work center’. For our example we will go with the second option.
Go to the ‘Test Management’ work center. Select the ‘Test Configuration’ sub-view for Test Repository. Click on ‘Create’.
In the pop up window provide the name of the configuration. Select the test tool as Composite Test from the drop down. Also provide the name of the composite test script and click on OK.
Select the appropriate Application Component using the value help. For system under test, select appropriate system data container (SDC) and select the target system for which the composite test is to be executed. Save the configuration as shown in the figure below.
Now, we have to put 2 of the steps (scripts) in the sequence. First we have to create the quotation. The corresponding CBTA script ‘Z_CREATE_QUOTATION_VA21’ is already created. Under the tab ‘Test Script’, add the CBTA test script‘Z_CREATE_QUOTATION_VA21’ for ‘Test Script Steps’. Now, the next step is to create the Sales Order in reference to the quotation number. The corresponding CBTA script ‘Z_CREATE_SO_VA01’ is to be added as the second step.
To pass the value of parameter Quotation Number created by the ‘Z_CREATE_QUOTATION_VA21’ test script step to the ‘Z_CREATE_SO_VA01’ test script step we have to change the usage type of the parameters.
First, open the test script ‘Z_CREATE_QUOTATION_VA21’ by double clicking on the name.The test script will be opened in the new tab. Change it in the edit mode. Export the Quotation number created in the export Parameter ‘MESSAGEPARAMETER1’ by exposing it as shown below. Save the script and change it to display mode.
Now, go back to composite test part and select the second step.
‘MESSAGEPARAMTER1’ is the input parameter to the script ‘Z_CREATE_SO_VA01’ which will receive its value from the output of the script ‘Z_CREATE_QUOTATION_VA21’. Now we will map the output parameter quotation number from the first step (script) to the input parameter team of the second step (script).
To do so, go to the ‘Ref. Parameter’ column of the parameter ‘SALES_DOCUMNENT’ under the details of test ‘Z_CREATE_SO_VA01’. Press F4 help and you can see the exported ‘MESSAGEPARAMETER1’. Select the parameter and click ok. Set the usage type to Local and save. You can now see that the parameter is mapped with the reference of previous step (script) as shown in the figure below.
Now, for all the parameters for both the steps (scripts) for which you want to provide the input as a variant, make the usage type to ‘Exposed’ using the drop down. You can assign the data variants using the test data container (TDC). The test data container with different data variants can be assigned under the ‘Test Data’ tab.
The execution of the Test configuration can be done directly from the test repository by clicking on the “Execute” button. At the end of the execution of the test you can find the report log as shown in the figure below. You can also find details for parameters for each step (script).
Similarly, we can add the third step “Creating Delivery” with the reference of the created ‘sales order number’ at the end of the second step (script) to complete an end-to-end scenario for sales document. You can also create similar composite test scripts and pass the parameters in between.
About Author :
The author is part of RunSAP CoE team, having expertise in SAP Solution Manager functionality from ALM & RSlaF like Solution Documentation, SoDocA, Test Management, BPCA, BPMon, BP Analytics JSM etc.