Tuesday, February 1, 2011

Create "Test script" to create a Sales Order

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_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 .

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.

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.





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. Don’t repeat entering data. It will record the data twice. First prepare test data and then record it carefully to avoid redundancy.

No comments:

Tutorials on SAP-ABAP

Adobe Interactive Forms Tutorials

Business Server Pages (BSP)

Userexits/BADIs

Web Dynpro for ABAP (Step by step procedure for web dynpro,Tutorials on Web Dynpro,)

ALV Tutorials

Blog Archive

goodsites