Вы находитесь на странице: 1из 62

eCATT (extended Computer Aided Test Tool)

What is eCATT? eCATT is an SAP Testing Tool used to automate & test business scenarios in R/3. Each test generates a detailed log that documents the test process and results. If the testing is smooth without any errors, this means that the business scenarios mapped in R/3 are correct. If the test results in error then the problem can be analyzed using the error log that is generated. eCATT enables automatic testing in SAP GUI for Windows and SAP GUI for Java. Features of eCATT: Following functions can be performed using eCATT:

Test transactions, reports and scenarios. Call BAPIs and function modules. Test remote systems. Check authorizations (user profiles). Test updates (database, applications, GUI). Set up customizing tables. Test the effect of changes to customizing settings. Perform load testing. Check system messages. Integrated with Test Workbench, so allows proper management of scripts using SCAT transaction. Supports CATT migration to eCATT. All eCATT Objects are Repository Objects. Therefore one can take advantage of Standard SAP Transport Tools. eCATT Objects can easily download & upload in XML with XSD format. There can be several versions of Test Scripts, which allows different implementations with different releases. The separation of Test Scripts, Test Data & System Data allows for a considerable degree of reuse.

Why eCATT? CATT is no longer supported by SAP for the creation of new developments. Hence all the test scripts developed in CATT are now need to migrate/Update to eCATT. Comparative to manual testing, the following are advantages of using eCATT:

Due to automation, testing time is reduced to a large extent. Due to automation, less manpower is required for testing. This helps financially. Due to automation, manual errors are reduced to large extent. Hence results in error free testing. This helps, as no further problems will occur while the usage of R/3 system by end users and hence increases the efficiency.

Proved to be extremely useful in implementation projects.

In regression testing, automated test scripts are an ideal method of quickly detecting errors. Automatic test logs make it easy to reproduce test results, enabling fast analysis and planning of further activities, leading to cost savings for the customer.

Differences between CATT and eCATT? Till date, CATT could only be used with the R/3 system. eCATT (which is available with SAP Web Application Server 6.20) covers the automatic testing in SAPGUI for Windows and SAP GUI for Java. For other GUIs and Applications, eCATT provides an interface for external tools. This allows companies to perform automated tests from an SAP system in a complete IT solution landscape across system boundaries. These new options enable complete automation of solution landscapes under standard Windows and Web-based user interfaces- resulting in low-cost operation of an IT Solution. eCATT requisites

Web Application Server (WAS) 6.20 or more. SAPGUI 6.20 or more. R/3 4.6C or more. (Target system must have sufficient support package level (Details available in SAP Note 519858) or SAP R/3 Enterprise Release 4.7).

Before creating Test Scripts using eCATT, some system settings need to be done: Maintain table T000. 1. Go to transaction SM31 2. Enter T000 and chose MAINTAIN.

3.

In the Change View Clients: Overview screen, select the relevant client and choose Details

4.

In the CATT and eCATT Restrictions field, select CATT and eCATT allowed.

5. Click on SAVE. Enabling scripting at the Front-end

1.

On

any

SAP

GUI

screen,

choose

Customizing

of

Local

Layout.

2. Choose Options 3. Choose Scripting Tab

4. Select Enable Scripting

5. Click Apply and then OK. Enabling Scripting on the Application Server

1. Go to transaction RZ11. 2. On the Maintain Profile Parameters screen, enter sapgui/user_scripting.

3.

Choose Display.

4. If the Current Value is not set to TRUE, then click on Change Value:

5. Enter TRUE in the New Value. 6. Click on SAVE. eCATT Vs Mercury QTP

SAP eCATT is a automation tool meant for functional testing in SAP. It comes with WAS. Latest version is WAS 6.40. It is made in ABAP. QTP is Mercury's tool, which is a third party tool for automation testing. The language used here is VB Script. Both the tools are good. But the only drawback with eCATT as of now is that it can execute web based SAP transactions except WebDynpro. So if the testing of SRM, CRM etc is involved, one is forced to use QTP. QTP takes the wrapping of eCATT and executes in SAP.

If only SAPGUI based transactions are involved in testing than eCATT is the best tool to be used. And if web based transactions are also involved, forced to go for QTP.

CreatingasimpleeCATTTestScriptforMM02transaction
ASimplescenariooneCATTTestScripttotheStandardTransaction.

Inthisscenario,IwouldliketoexplainaboutcreateTestScriptforMM02. Procedure
Start transaction SECATT. On the eCATT initial screen, select the System Data radio button and enter a name for your new system data container in the field beside it. For this tutorial, we will refer to it as ZTEST_SDC.

OntheAttributestab,enteratitleforthesystemdatacontainerforexample,SystemLandscapefor MM02.

IntheSystemDatatab,youwouldnoticeadefaulttargetsystemcalledNONE. Saveyoursystemdatacontainer.

CreatingYourTestScript
Inthissection,youwillcreateanemptytestscriptandassigntoitthesystemdatacontainerthatyou createdearlier.Youwillthenexecutethetestscript.

OntheAttributestab,enterthefollowinginformation:
Title : Test Script for MM02

Component

:BCTWBTSTECA

System Data Container : ZTEST_SDC

LeavetheTargetSystemfieldempty.

Saveyourtestscript. ChooseExecuteButtonandExecutetheTestScript.
The Start Options are displayed. Accept the defaults but make sure that Log Display has been selected.

Select the checkbox Highlight All Called GUI Elements. This option is cosmetic but will help you see whichelementsarebeingselectedduringreplay.Leavetheotherdefaultoptionsastheyare.

Executethetestscript.Thelogwillthenbedisplayedandshouldlooksomethinglikethefollowing:

GetbacktotheTestScriptEditor. .

RecordingtheTransaction
StartingtheRecorder

nthetestscripteditor,choosethePatternfunctiontodisplaytheInsertStatementdialog.

Inthedialog,changethegrouptoUIControl,chooseSAPGUI(Record)forthecommand.

Specify the transaction MM02 that you want to record. Additionally, select the check box that will automatically generate a new SAPGUI command after every screen change ( You must first deselect manualgeneration).

ChooseStartRecordingorEnter

ClickonYes.

Anewsessionisautomaticallycreated.Youcan,andshould,switchbackandforwardbetweenthetwo sessionsusingthetaskbarasshownbelow. EntertheMaterial

SelecttheBasicData1 BasicData1Screenasshown.

ChangetheGrossWeight.

SaveandClosethescreen EndingtheRecording

Select the Close Recorded GUIs check box and thenchooseStopRecording. TherecordedsessionclosesandyounowseetheSAPGUIcommandsinthecommandeditorofthetest scripteditor.

Abovethecommandeditoristheparameterlist.Youcanusethebuttonatthetopleftofthissectionto togglebetweenthedisplayofnormalparametersandthecommandinterfaces.

ChooseSave.

ExecutingYourTestScript
Inthetestscripteditor,chooseExecutebutton.

ChooseExecuteButtonintheStartOptionsscreen.Checkthelog.

StartingeCATTwithTCDRecordingMethod

Step1: Use the Transaction code SECATT to test the data using eCATT (Extended Computer Aided Tool). Provide Test Script name in the initial screen of eCATT. Here, in the scenario I have given Test Script as ZDEMOTEST and version as 1.


Click CREATE button. Step2: In the next screen, we have TWO tabs.
1. 2.

Editor Tab where we can write our own ABAP code and use the eCATT special commands. Attribute Tab where we can provide Title, Component to which we are testing data.

Step3: Click the Pattern button on Application tool bar to select recording method. Select TCD (Recording) method. Step4: Select the pattern button. A pop-up box appears where you have to select GROUP as UI Control. And COMMAND as TCD (Recording) as shown. Provide the transaction as MM01 and press enter. Then the system automatically proposes Interface name and dont change this Interface name. In this scenario system proposes MM01_1. Now, click OK button to start recording.


Step5: After the recording is done, you will get message the Recording Ended and press YES.

And the following screen appears.

Save and check syntax check. Step6: First of all execute the script without parameterization to confirm errorless recording. At the run time, a start options window appears. Select the following options as shown.


And in UI Control Tab,


Click on Execute button. Step7: After execution of the transaction, if the recording is free from errors, then the success log would be displayed. Suppose if there are any errors in recording of the transaction then the detailed error log would appear. If the transaction has executed successfully, you would get the following messages.

StartingeCATTwithSAPGUIRecordingMethod

Step1: Use the Transaction code SECATT to test the data using eCATT (Extended Computer Aided Tool). Provide Test Script name in the initial screen of eCATT. Here, in the scenario I have given Test Script as ZDEMO_TEST and version as 1.

Click the Create button. Step2: In the next screen, we have TWO tabs.
1. 2.

Editor Tab where we can write our own ABAP code and use the eCATT special commands. Attribute Tab where we can provide Title, Component to which we are testing data.

Here, I selected the component MM-PUR-SQ- SLI (Source List).

Step3: To do the recording, click the Pattern button in the application tool bar. Here, we can do recording in TWO ways.
1. 2.

SAP GUI(Recording) TCD(Recording)

Now, we use SAP GUI (Recording). Step4: Select the pattern button. A pop-up box appears where you have to select GROUP as UI Control.


And COMMAND as SAP GUI (Recording).

Click OK button. Step5: Click YES.

The following screen will appear.


Select all check boxes of Automatic Generation. Provide the T-code to which we have to be started recording. Now select Start Recording button to start recording of the corresponding transaction code we have mentioned. You will get pop-up box and click YES to continue recording. Step6: After recording, a SAP GUI command and its associated command interface will be inserted in the test script editor.

Save and check syntax check. Step7: First of all execute the script without parameterization to confirm errorless recording. At the run time, a start options window appears. Select the following options as shown.


And in UI Control Tab,


Click on Execute button. Step8: After execution of the transaction, if there is no errors are found while recording, then you will get success log. Suppose there is error in recording of the transaction then the detailed error log will appear.

CreatingasimpleeCATTtestscriptusingABAPObjects

I would like to explain about eCATT scenario on ABAP Objects. In this scenario I am explaining from Test Script Creation about ABAP Objects and the Command is Createobj. For this scenario we need to know about global classes or at least you should know about standard classes and I am not explaining about System data container. I explained in my previous scenario. Creating Test Script.

Go to Transaction SECATT. Enter the test script named ZTEST_OOABAP.

Enter the Title, Component and System data Container.

Procedure
1. 2. 3. 4. 5. 6. 7. 8.

In the parameter list, create a parameter with the reference type that you want to instantiate. In the command editor, set the focus where the command is to be entered. Choose Pattern. In the Group field, choose ABAP Objects. In the Command field, choose CREATEOBJ. If you want to create a parameter, enter the name of the wanted class in the Class field. In the Object Instance Parameter field, enter the parameter name. Choose Enter.

9. 10.

In the Interface field, accept or change the suggested name. Choose Enter.

The above process as shown in below screen

Save and Test the Object.

In the Start Options screen. Press the Execute Button.


The result is as shown below.

ParameterizationineCATT

In eCATT script we can pass 3 types of parameters. Import Export Local variables

Import Parameters: Import Parameters are input values to the test script. These variables are the local to the script i.e. Import Parameters can access only in eCATT script editor but not in ABAPENDABAP block. These are version independent.

Export Parameters: Out put result values after executing the script are caught in Export Parameters. These variables are the local to the script i.e. Export Parameters can access only in eCATT script editor but not in ABAPENDABAP block. These are version independent. Local Variables: Local Variables are used in both eCATT script editor and ABAPENDABAP block. These are version dependent i.e. local variables defined in one version is not automatically defined in other version. After the recording has been done for the particular transaction without parameterization, we need to check whether the recording is error free or not. Once it is confirmed error free then we go for parameterization of required fields. Usually we go for parameterization for reusability of eCATT script. Different set of data can be passed via parameters and recorded script can be used again and again. Parameterization in TCD mode: Fields having mode S (Set) under each dynpro of command interface contains some values entered during the recording. These are the values need to be parameterized as Import, Export or Local as shown below. Replace the value P in VALIN with I_MBRSH parameter.

And now double click on the parameter I_MBRSH then the following screen will appears.

Select Local and click YES. The output result of transaction is assigned to Export parameters. These are very useful in chaining of transactions where the output of transaction is input to another transaction.

In this mode, last dynpro of the dynpro list just before the MSG node in the command interface contains the output messages as shown below.

Here we have to change the mode O (Field output) to mode G (Get) and assign Export parameter in VALIN as shown below.

Parameterization in SAPGUI mode: Now double click on each step of command interface of SAPGUI command from the test script editor. In this case, first double click on ME01_200_STEP_2. Then you will get following screen.


Now replace value of material number T-BW06-02 with parameter. Here, T-BW06-02 is replaced with I_MATNR.

Now double click on I_MATNR then you will get pop-up box as shown.

Click YES. The entry appears in Parameter list and provides parameter reference.

The output result of the transaction in this mode can be captured using MESSAGE.ENDMESSAGE node.

Click the Pattern button from the application tool bar and select MESSAGEENDMESSAGE option as shown.

And click OK. Now the following screen appears.

Now place the command interface between MESSAGE.ENDMESSAGE command to capture the export parameter.

Here, the material number is captured in parameter1 (MSGV1). Now we can assign this value to export parameter as shown below.

CreateTestscripttocreateaSalesOrder

Purpose: This document details on how to create a Test Script to Create a Sales Order. We can call this script as Unit Script as it deals with a single transaction. If the script is a combination of multiple unit scripts then we can call it as an Integration Script. Transaction: SECATT Here are the steps to follow. Step 1: Go to transaction SECATT Choose Radio Button Test Script and give some name like ZSD_CREATE_SALESORDER_TS (In general we will follow the naming convention Z<module>_desc. of script_TS (TS for test script)).

Click the create button as shown in above screen shot. Step 2: In the next screen give some description for the Script. Also specify a Component. We can choose the area related to the transaction we are using from F4 help. In this case I have chosen Sales Orders component.

We can specify a System Data container (not mandatory). We can choose one of the options from F4 help.

Now save the script. Save as Local Object. Step 3: Now select the tab Editor. Write proper comments and place the cursor in the next line and click the button as shown in the below screen shot.

Or we can choose Pattern and use SAPGUI REC (SAPGUI Recording). The below pop-up will come. Un-check Manual Generation and check other check boxes. Click Start Recording.


Step 4: Click OK in the below pop-up.

The below message will come in the status bar.

Now generate a new Session.

Step 5: Wait for a while. The below pop-up will come.


Click Yes and wait for the below pop-up to come.

Leave the pop-up as it is and go to the new session created. Step 6: Enter the T-Code and press Enter.


Step 7: Enter the below details and press Enter.

Step 8: Enter the below header details (before you are recording try to create one Order manually and note down all the mandatory and other useful fields and note the values. Then create the recording using SECATT. This will save us lot of time. If we encounter any errors while recording the eCATT, we have to re-record the entire thing.


Enter data and press Enter. Step 9: Now we need to fill item details. At anytime try to use only one item as it will simplify parameters list and is less prone to errors.

Enter data and press Enter.

Step 10: Press SAVE button.

The below message will come on status bar.

So with this we are done with our recording. Now come out of the screens by using Cancel button.

Now press End Recording in the below screen.

Step 11: Now we can the recorded screens list in SECATT as shown below.

The below button will toggle us between parameter interface and command interface. Click the button to see both interfaces.

Step 12: Double click on the screen as shown below.

Now by expanding the links in the screen we can be able to see the data parameters we have entered while recording.

Now we will replace the values using parameters as shown below. Expand the node and double click the element highlighted in the below screen.

The below screen will come. Replace the value ZCR with I_AUART parameter name.

Change the value to parameter for all the fields in all screens. If we want the value to hard coded as it is as in recording then leave the value. Step 13: Now create parameters.

Press Enter. That will create Import Parameter I_AUART. Create all parameters like this. And save the script.

Check the script to see if there are any errors.

Save the script and come out of the script. With this we are done with the Creation of the Test Script. Now in order to test the script we have to create Test Data container as well as Test Configuration. Note: While recording the script make sure that all the fields you want to record, you should place the cursor in the field and enter data or change the default data (re-enter the same default data). Then only it will record. Dont repeat entering data. It will record the data twice. First prepare test data and then record it carefully to avoid redundancy.

CreateTestDatacontainer

Purpose: This document explains how to create Test Data Container for a Test Script. Here I have been using the Test Script, Create Sales Order ZSD_CREATE_SALESORDER_TS as reference to this Test Data Container. Transaction: SECATT Here are the steps to follow. Step 1: Go to transaction SECATT Choose Radio button Test Data and enter name of the Data Container to be created. Here the name will be same as Test Script name except that it ends with _TD instead of _TS.

Click Create button. Step 2: Enter some description as well as component. (Same as Test Script).


Save the script (Local Object) and Click on Parameters Tab. Step 3: Here create all the Import parameters of the Test Script as parameters.

Save the script and Go to Variants Tab. Step 4: Click on Create Variant button.


Step 5: Enter the below details.

And press save. Here we can create as many variants as we wish. With this we are done with the creation of Test Data Container. Save the data container and exit. Now we have to create Test Configuration to test our Test Script.

Create"TestConfiguration"

Purpose: This document details on how to create a Test Configuration to Test the Create a Sales Order test script. Transaction: SECATT Here are the steps to follow. Step 1: Go to transaction SECATT Choose Radio button Test Configuration and enter name of the Configuration to be created. Here the name will be same as Test Script name except that it ends with _TC instead of _TS.


Step 2: Enter some description and component. (Same as Test script).

Save the Configuration. Step 3: Go to Configuration Tab.


Give any appropriate System Data Container from F4. Give the Test Script name we have created earlier ZSD_CREATE_SALESORDER_TS. Step 4: Now in the test data block. Press Create button and enter the details as shown below.

Press Save button. Step 5: Now go to Variants Tab and press the button Add variants as shown below.

The below pop-up will come. In that choose V1 and click the button Attach as Variants.


Then the variant V1 will be shown in the second part of screen that is Configuration Tab. Now press Enter button.

Save the configuration. With this we are done with the Creation of Configuration successfully. Step 6: Executing the configuration.

We can execute the configuration using the above Execute button. Press that button. The below pop-up will come. In that choose options as given in the below screen shot.


Press Execute button. Press Ok for the SAPGUI attach pop-up. Once the eCATT execution is completed, Log will be displayed. It should come with Green Color. Then only it is executed successfully. Otherwise some error should have come.

eCATTIntegrationscripttocreateasalesorderaswellasdelivery

Purpose: This document details about how to create an Integration Script to Create a Sales Order as well as Delivery. As this script is associated with more than one transaction we are calling it as an Integration Script. With the integration test script we can test the business scenarios like Sales process (Create Order, Release Order, Create delivery, Pick & Pack, PGI, Invoice creation, Release invoice). We can enhance this Integration script for Creating Billing Document and other unit scripts based on our requirement. There is no restriction on the number of unit scripts to be used in an Integration Script. For starting development of this script first you must develop 2 unit scripts. One is for Creating Sales Order (VA01) and other is for Creating Delivery (VL01N) with the Sales Order reference. We need not create Test Data and Test Configuration for the above Unit Scripts. Because we will run those scripts using Integration Script. Here I am considering the Unit Scripts as below. Create Sales Order YSD_CREATE_SALESORDER_TS Create Delivery -- YSD_CREATE_DELIVERY_TS

Transaction: SECATT Here are the steps to follow. Step 1: Go to transaction SECATT Choose Radio Button Test Script and give some name like YINT_VA01_VL01N_SALESCYCLE_TS (In general we will follow the naming convention Z/Y-INT_first 2 tcodes used_desc. of script_TS (TS for test script)).

Click the create button as shown in above screen shot.

Step 2: In the next screen give some description for the scenario and also specify related component. We can choose the area related to the transaction we are using from F4 help. In this case I have chosen Sales component.

Now save the script as local object or use the relevant package. Step 3: Now select the tab Editor. Write proper comments and place the cursor in the next line and click the button Pattern as shown in the below screen shot.

Step 4: The below pop-up will come and choose command REF.

In the test script name give the Sales Order script name and press enter, system will propose the interface name (if you want you can change the interface name) and press enter.

Now our script will look like this.

Step 5: In the REF command first parameter is script name and second one is Interface for that script.

Now double click on the interface name YSD_CREATE_SALESORDER_TS_1. (We can give this name as our wish in the step 4). Now the screen will look like this.

Step 6: Double Click on Importing.

It will show all the Importing parameters in Sales Order script. Create parameters in integration script and link those with this interface importing parameters.

Step 7: Save the script. Now observe that here is Exporting Parameters also there. Double click that Exporting. It shows Sales Order number will be exported from Sales Order script. Here we can have a brief look at how to capture Sales Order number and export that from Sales Order script. If we can observe the sales recording in one screen we will get a message like Sales Order <xxxx> created like that. That will be recorded in script as message, like below

Use the commend MESSAGEENDMESSAGE to capture the messages occurred during the execution. Below is the code to capture the same.


Here E_VEBLN is a parameter of type E. Step 8: Now come to the integration script again. We have to take the exported sales order number into our integration script and use the same as a parameter to delivery Script. So create a variable V_VBELN type V.

And specify the variable name in Exporting parameter of Sales Order script interface as shown below.


With the above step we are completed with integrating Sales Order script in our main script. Step 9: Now we will integrate Delivery script. Now place the cursor in the next line of REF and click pattern button again. This time give the Delivery test script name.

Press enter Our script will look like this now.

Step 10: Double click on the YSD_CREATE_DELIVERY_TS_1 (Interface). Here is the importing parameters list.

We are already having Sales order number in a variable called V_VBELN. SO give the same there. For shipping point create one import parameter. Also for exporting delivery, create one more variable V_DELIVERY.

Save the script. Now we are done with the integration. Step 11: Now we will see some data validations etc... We can through an error and stop script execution if any of the Mandatory parameters are not specified. For that we can write code like this.


Step 12: One more validation is, if Sales Order is created successfully then only we should call Delivery script. Otherwise we can skip that step. For that we can write logic as below.

Save the script and come out. With this we are done with the creation of Integration script. Now we have to create test data as well as Test Configuration. For that we can follow the same steps as shown in the previous tutorials.

DebuggingineCATT

1. How To Handle Debugging Mode in ECATT? Solution:

Execute the test script.

In the start options, select the debugging mode Execution with immediate debugging.

2. How to Keep Break Point in Ecatt ? Solution:

Enter The Script Name in Script Line Tab

Enter the Statement, which we need for Break point.

Press F8

Вам также может понравиться