Saturday 15 February 2014

Guidelines of SAP TAO Test Automation


Overview

Before the application of SAP TAO there was a clear separation of roles for test automation. There is the Subject Matter Expert (SME), who defines the business process and brings in the necessary understanding of the application to be tested and the entire system – and there is the Automation Engineer (QTP expert, VBs expert) who defines and manages the resources that are needed to create and work with business components as well as create VBS functions or debug in QTP.

With SAP TAO this roles are not that differenced anymore because there is no need to create complex visual basic script in QTP anymore. SAP TAO simply scans SAP screens and generates the visual basic script which links to the TAO libraries.

 
SAP Test Acceleration and Optimization (TAO)
SAP Test Acceleration and Optimization generates automatic tests during regression testing of SAP solutions, quickly. SAP Test Acceleration and Optimization creates tests and components from the screens of a transaction or the views of a CRM web application, and parameterizes them. These tests are for a single transaction or CRM web application and can be combined into a scenario test. SAP Test Acceleration and Optimization also maintains components and tests by integration into the Business Process Change Analyzer in SAP Solution Manager.

                  HP Application Lifecycle Management – Quality Center       (HP QC)

HP Application Lifecycle Management (ALM) is browser based test software that enables you to manage the application lifecycle from requirements through readiness for delivery from a single repository, consistent user experience and customizable dashboard. Cross-project reporting and asset sharing enable consistent processes, progress tracking and reporting, and asset sharing across projects. And dashboards and reporting capability let you track application readiness across the lifecycle, using KPIs to analyze data about milestones you define.
HP Quality Center offers software quality assurance, including requirements management, test management and business process testing for IT and application environments. HP Quality Center and HP Performance Center are components of the HP Application Lifecycle Management software solution set.

         HP Quick Test Professional (QTP)

 
HP QuickTest Professional software provides functional and regression test automation for software applications and environments and is part of the HP Quality Center tool suite.
HP QuickTest Professional supports keyword and scripting interfaces and features a graphical user interface. It uses the Visual Basic Scripting Edition (VBScript) scripting language to specify a test procedure, and to manipulate the objects and controls of the application under test.
 

Workflow

    SAP TAO

 In the following the different functionality of the used modules in TAO are described and a quick introduction will be given. For detailed information about these and other modules please read



Attenention
Press always on ‘Cancel’ when the following dialog “Configuration of Runtime Libraries” is shown.
This avoids an unwanted overwrite of the cBase library.

 

     Switching between central and local TAO library

When you have a local copy of the cBase files on your system for development purposes before you do changes on the central cBase do not use the TAO configuration to switch the path to avoid unwanted library backup etc. from TAO. Please do only change the value of the local file path or environment variable.

      Design

 In the Design module you can create new Process Flow Analysis (PFA). A PFA records all actions you are doing on the screen in a SAP transaction and creates the test script with it. Therefore one PFA belongs to one transaction. While the recording all used user interface objects according to the transaction are being inspected and will be processed in scripted business components. More to the topic components you can find under headline 3.3.2.1 Business Components.

Also an excel sheet will be automatically created for each PFA where you find all input parameters you used executing the SAP transaction, called DataTable. This table has an interface function to transfer all parameter values for the individual test executions. These excel files you can find in:

C:\999_SAP-TAO\DATA

While running a PFA a temporary XML file will be created called Tao Execution Context. It is located in:
This file logs all entries and transfers to the DataTable excel. Because a test case usually contains several PFAs it has to be ensured that the transactions are working with the resulting data from the previous transactions. This is enabled by specified QTP scripted business components with parameters to transfer the data. More on that topic is to find under headline 3.3.2.1 Business Components.
 


1               Preconditions for a successful PFA recording

In order to create a PFA you can use the following checklist as a help to make sure that you considered all the needed aspects.
ID
Checkpoint for PFA preconditions

1
Set your local Windows time zone setting to the time zone of the cbFC system under test to avoid date and time conflicts with dynamically created test data.
Different time zone settings between cbFC server and automation execution client.
2
Set your local Windows regional settings for date, time and number format to “Country Specified”.

3
Set your local Windows display language to “English (US)”





              Reuse of Components versus creating a new PFA

Before you create a new PFA you must always check if you can reuse an existing component. Do not create redundant PFAs.

              Creating a PFA

1.   Go to Design module
2.   Click on New in the Executable Objects section
Select the needed executable SAP transaction
Name for analysis is already populated with time stamp concatenated to it. You may change it.




1.   Click on New on the PFA tab
2.   Define a suitable name according to the PFA naming convention
          PFA_[Test Case ID]_[Transaction-ID]_[Variant]
          The Test Case ID is referencing the test case for which the component was initially created.
          The Variant indicated the different component variants for the same transaction
e.g. PFA_1.3.140_NAFTA_E_FB60_001
3.   Choose Start for Process Flow Analysis.
The transaction is launched on the managed system along with the following PFA controller 

1.       Execute the process flow as a business user. Use the Test Automation user credentials.
2.       Add necessary validation points by clicking on Add Checkpoint in the PFA controller and select the desired SAP GUI object on the screen. An iteration of the component CheckProperty will be created in the script.
3.       After executing the transaction completely, stop the PFA by clicking on Stop the PFA button in the PFA controller window.
4.       A report is generated which captures the activities performed by business user.
5.        Then click on upload. This activity will upload components for the screens touched by user, to HP Quality Center and creates a parameterized test case. An excel sheet is created where the values entered by the user are captured. The draft test cases will be having the library components e.g. Initialize script, launch and log on etc.
The PFA is uploaded to the folder specified in the TAO configurations.
6.        Rework Test Data Spreadsheet.

    Checklist for limitations of PFA with SAP TAO

In order to successfully record a PFA you must consider the limitations of SAP TAO PFA recording. The following checklist gives you advice how to avoid known limitations (compare SAP note 1378813 - List of Limitations of SAP TAO Release 2.0).
ID
Limitations of PFA Recording
1
SAP GUI Scripting related limitations
The limitations which apply to SAP GUI Scripting also apply to SAP TAO when recording Business Processes or executing Tests (Compare SAP Note 587202 - Restrictions when using SAP GUI scripting, Version 8 from 25.10.2011).
1a
This concerns for example the SAP GUI "Drag and Drop" functionality. In consequence it is neither possible to record Business Processes with TAO PFA when using "Drag and Drop", nor is it possible to execute Business Process tests which were created on those recordings.
1b
F4 search help control (amodal):
The control is not supported in the scripting. Instead, a standard dialog is opened. In some transactions, this dialog does not open and a short dump occurs due to an error in the application. Until a Support Package corrects the application, you can work around this error by choosing the "Help->Settings->F4" menu path to select the modal dialog manually.
1c
SAPscript:
The text control of the SAPscript component is not supported. It is replaced by a line editor, as described in Notes 64634 and 100358 (point 10). If you have additional questions, contact the component BC-SRV-SCR.
1d
Missing support in individual transactions:
Certain transactions use dynamic keywords when communicating with the SAP system; these dynamic keywords change each time the transaction is called. This problem may occur when you select entries from the menu of the toolbar control in particular. If the script that is recorded in this transaction is run again, errors occur due to invalid parameters (for example, in the method SelectMenuItem). Note 217437 contains a list of affected transactions from the MM area. If you have questions about this problem, contact the application component MM-PUR-PO-GUI.
1e
Missing support in individual transactions:
Certain transactions use dynamic keywords when communicating with the SAP system; these dynamic keywords change each time the transaction is called. This problem may occur when you select entries from the menu of the toolbar control in particular. If the script that is recorded in this transaction is run again, errors occur due to invalid parameters (for example, in the method SelectMenuItem). Note 217437 contains a list of affected transactions from the MM area. If you have questions about this problem, contact the application component MM-PUR-PO-GUI.

Extract from 217437 Version 9 from 27.06.2013:
ME21N (ME22N and ME23N) or ME51N (ME52N or ME53N)
2
Vertical Scrollbar of SAP GUI
Scrolling vertically on a SAP GUI is not supported when making use of the mouse pointer to push/pull the scroll bar handle and that scrolling triggers a server round trip: Although moving the scrollbar like that may be recorded successfully within TAO PFA, it will be impossible to use the subsequently created tests. This is amongst others due to window size dependencies of the scroll mechanism.
Workaround:
Please scroll with the help keyboard shortcuts or by means of mouse clicks on the scrollbar arrows.
3
Dynamic UIs
Inspection only supports static SAP GUIs (Dynpros). Dynamic SAPG GUIs which are composed at runtime will not be detected by the inspection, thus the inspection can not retrieve the structure information of such UIs from the Data Dictionary of the managed system. This limitation impacts also the recording with PFA as inspection is an inherent part of it.
[…]
Since SAP TAO 2.0 SP2 we do not recommend the usage of the UI Scanner anymore. Please use the PFA (Process Flow Analyzer) to record the business process and to subsequently generate components and tests: If possible, then screen components related to the dynpros will automatically be generated. If this is not possible (e.g. dynamic screens), then the test sequence uses technical components which completely represent the recorded scenario.

    Checklist for reworking a PFA recording with SAP TAO

In order to rework a PFA after recording you must use the following checklist to make sure that you considered all the needed aspects.
ID
Checkpoint for PFA Recording
1
Test Data Excel: Format it according to template.
2a
Add Excel formulas to the Test data excel for manipulating data, e.g. to extract a document ID from a status messages or change data formats
e.g.
To make sure that a String like Material_ID can be incremented you need to split it into letters and numbers so that you can increment the number. Afterwards you need to concatenate the two pieces back to one.
e.g.

How to extract the needed number out of a string:
2b
Avoid excel cell format “Number”. Dependent on your computers windows location setting the decimal point is either ‘,’ or ‘.’ which may lead to failures in test execution when a different windows location setting is used.
3
Test Parameters: Promoting Component Parameters to Test Parameters of InitializeContext and parameters with links to additional files (e.g. PI Simulation): Use component parameter name as test-parameter name.
4
Labels of GUI-Objects appear in a TAO execution report: Make sure the label names are meaningful to enhance the TAO execution report.
e.g.
5
Log-Off-Component: the Log-Off is used to be the last component in the structure
6
SetInExecutioncontext:
·         Add this component before the Log-Off-Component when you have to store values in the execution context.
·         Naming convention for execution context parameters: Use only upper case letters and separate the words with underscores, e.g. MATERIAL_NUMBER
·         If you have to add more than one parameter, then use an additional iteration instead of adding an additional component.

7
After each checkpoint the component CaptureScreen has to be added.
8
Delete unnecessary component e.g.:
-          Unnecessary recordings by mistake
-          The SetFocus Component before entering text into a field can usually deleted without impact.
-          Sometimes several instances of the same screen component with the same name are created. In that case summarize all inputs and use only one screen component instance.
9
When you have to change the components VB code, save the changed component with a different name according to the naming convention (add the post fix “_changed” to the component name) and add an explanation to the component description.
10
The created PFA’s should be stored – depending on their status - in the following folders in HP QC:

Development work area:
·         Folder „PFA\Design“
Approved area:
·         Folder „PFA\Ready“

The corresponding Data Tables, also depending on whether they are under construction or not, have to be stored in:
Development work area:
·         Folder "C:\999_SAP-TAO\DATA\01.UT"
Approved area:
·         Folder "C:\999_SAP-TAO\DATA\02.IST"

11
Once the PFA upload to HPQC is completed you will sometimes get a notification “The following PFA’s are obsolete. Do you want to consolidate them again?” select “NO”.
12
Screens with Collapse/Expand buttons e.g. for purchase order header and item details
à Automation was done with already expanded details, but after system refresh details are collapsed
·         Add a PressKey for expanding all details (maybe several keys like “F3”, “F5” etc. for each detail section) to the automation.
13
Table columns à Risk: After system refresh columns are not visible, because of reset views
a.         Add to automation: Select standard view and add required columns and do not save…
b.         Create a special view “Test Automation” with required columns. Be aware that this view disappears after a system refresh. So you have to document the view details somewhere or create a script to create that view…

     Consolidate

While creating a PFA for each action executed during the recorded transaction, a scripted business component was created and set to right order. After you uploaded the PFA to QC Test Lab you may want to change some settings or insert a custom component to the test script. If you run the test now each component gets opened separately in QTP and the contained VBScript will be executed. This costs a lot of performance and time.

To avoid this, the PFA with all its components should be consolidated to one component. This means that the VBScript of the different components gets concatenated and only have to be opened and executed once in QTP. This also brings a functional advantage to handle the test cases in QC. Consider that consolidation here means to consolidate all components of one PFA to one component. The consolidation of the different PFAs to an integration test will be done in QC Test Plan.

No comments:

Post a Comment