So far we have shown in our blogs how to create manual test cases. The Test Suite also offers us in the Solution Manager a possibility to perform automatic test cases with the help of CBTA.
To create an automated test case, two things must be created: The test configuration and the test script.
To record a test with CBTA, the following prerequisites must be fulfilled:
- Setup in Solution Manager for Automated Test Cases is complete,
- The frontend component required for execution is installed and
- The system under test (SUT) is maintained in the Solution Manager and a profile for a test user has been added to it.
HOW DO YOU CREATE A TEST CONFIGURATION?
The soldoc transaction opens the solution documentation from the SAP GUI. Now you have the option to add the test cases directly under the business processes or in the library. Before creating a test configuration an executable must be added to the library of executables or inside the process step in which the automatic test is to be added. An executable can be a transaction, Fiori application, Web Dynpro application or URL, and so on. If the executable was created in the library, in the next step it has to be assigned to the corresponding process step. Executables created in a process step are automatically added to the library.
Within the process step, you can create a test configuration using a right-click and then navigate to New → Test Cases → Test Configuration (Create).
In the launchpad of the Test Suite under Test Repository – Test Configurations and Test Repository – Test Scripts, all test scripts and configurations created in the solution documentation are displayed and can be edited and viewed. However, it is not possible to create a test configuration or test script from there, the creation has to be done in the solution documentation. (see: SAP Note 2554923 – What has changed in the process for creating a test script/configuration between SAP Solution Manager 7.1 and 7.2)
In the following window all mandatory fields have to be filled in, using CBTA as the test tool.
First, an executable is assigned to the test configuration. This step is not necessary if only one executable is assigned to the process step, since then it is added automatically. Otherwise, an executable can be assigned to the test configuration via the Assign Executable button.
After this step, the fields under System in Test, Technical Data and Additional Test Options should be filled. Now you can save the data with Save.
For some executables it is necessary to specify a login scheme. Some of the existing ones can be selected as default, but otherwise a new login scheme has to be created, e. g. for external tools.
HOW TO RECORD A TEST SCRIPT?
To include a test script, a test configuration has to be open and in edit mode. With the button Launch CBTA the recording can be started. In Internet Explorer, a bar appears at the bottom of the window where you have to click Open and the Test Creation Wizard window opens. Clicking on Next opens the selected executable and starts recording. To record the test case, the user performs all steps that are supposed to be part of the test case, and these all get stored in the test script.
Note: To record a test script with CBTA for an executable that does not use the SAP GUI, you must first activate the following service in transaction sicf: taf_applauncher.
If you want to end the recording, you can simply log off the user from the SAP GUI and click on Next in the Test Creation Wizard until the last page is reached. On the last page, the test script is saved and after the status of all points has changed to Successful, the process is finished via Finish button.
After a refresh, you can look at the recorded steps and parameters under Test Script and Parameters.
With Execute, the test script can now be tested and an execution log is automatically displayed after execution. If everything went smoothly, you can save the test configuration with Save.
HOW CAN A COMPOSITE TEST BE CREATED?
A composite test is created if several test scripts are to be retrieved in a test script that serves as a container. The test scripts in the composite test are then executed sequentially. To create a composite test, at least two test scripts are required. First, a further test configuration is added, but this time Composite Test is selected as the test tool.
In the Test Script tab, you can select the test scripts to be used in this composite test. To add a test script to the test, select the test script and then click on the Add button. This is repeated until all required test scripts are included. Afterwards, the test scripts should have been added under Test Script Steps. The order of the test scripts is determined inside Test Script Steps. They are executed in order from top to bottom.
Test scripts that have export parameters can be connected to another test script that requires import parameters. So the export parameter is passed as an import parameter. For this purpose you use the area under Test Script Steps on the Parameters tab. There the parameters can be connected by specifying Local as the use and the name of the other parameter under RefParameter. This is done for both of the selected scripts. The test can then be saved and used.
Now you can run the composite test once and check it. As with a normal test configuration, the SAP GUI opens and the test can be started by choosing Execute. Once the test has been started, all test scripts are automatically called and run in sequence. After all test scripts have been run, the execution log for the complete composite test is displayed automatically.
Find out more about the analysis tools and how to use them in our next blog.