Monday, December 8, 2008

QTP Action Sharing Global Data Table

Store values from one action in the global Data Table and use these values as Data Table parameters in other actions.

Follow this below example to understand it in a better way:

Open a new test.
Make sure that in QTP, Data Table is visible. Go to Global tab in the Data Table and double click on A, first column heading.
Change Parameter Name dialog box opens. Enter Column1 and click OK.

In the Expert View of Action1 type:
datatable.Value("Column1",1)="Global"

Go to Insert (menu)-> Call to New Action. Insert Call to New Action dialog opens. Click Ok.

In the Expert View of Action2 type:

msgbox datatable.Value("Column1",1)

Now run the test.

Action1 is inserting a value into a data table and Action2 is picking up the same value.