Micro Focus QTP (UFT) Forums
Transfer of unique data from one script to another - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Transfer of unique data from one script to another (/Thread-Transfer-of-unique-data-from-one-script-to-another)



Transfer of unique data from one script to another - GOM - 11-27-2009

Hi there,

I have been given the task of revieweing QTP as a test tool that will help with regression and so I have been having a play and am very impressed with the ease of use the tool allows.

I have a couple of questions in regards to the recording and playback options and so am hoping you guys might be able to help me out!

Let me explain the process I am recording and what I want QTP to do:

Script 1 - I record a user populating data fields in a form. This form is backed by an entity in the database which is automatically assigned an id e.g. 123456.

Script 2 - I record another user signing in, locating the entity id from a list, clicking on its URL (which has id 123456 as a parameter). This then opens the form so the user can continue filling in the form before submitting it

The above is only part of the end to end process that I want to be able to playback, however it hopefully gives a general understanding of what is going on.

As I have stated every time this process is ran a unique incremented id is generated for the entity used by the form. However this causes issues when doing playback as this number will have already be assigned etc etc. So what I need is a way round this, so when I do a playback of this script, the id that is generated at the start of the process is captured (using an output value?) and then transfered to the next script so the whole process can run from end to end and anywhere the orignal recorded id is displayed within the scripts will be over wrriten by the new id. Is this at all possible?

Also, how is it possible to dynamically find a URL in a page containing the above ID and then click it.

Or alternatively, is it possible to always select the last link displayed in a table on the web page? My entity is always displayed at the bottom of a table once it has been created.

Regards

GOM


RE: Transfer of unique data from one script to another - Ankur - 11-27-2009

Sure, all what you have described above can be achieved.

Run time Capture - If you intend to use the id no in the same run session you can go for Environment variables/OutPut Values/ or simply capture it into the run time data table.
If you intend to use the id no generated in one session into another run session then you may go for capturing the value into a txt file. The txt file creation, opening, reading, writing can all be achieved by FSO (FileSystemObject Model)

is it possible to dynamically find a URL in a page containing the above ID and then click it - Yes. Use child objects and using a looping structure, try to find the required value using instr function. Once found you can click on it.

is it possible to always select the last link displayed in a table on the web page? -
Find the no of rows in the webtable at run time using object.RowCount
Using ChildItems method, click on the required link

Hope it helps!


RE: Transfer of unique data from one script to another - GOM - 11-27-2009

Thanks for the speedy response!

From the methods you have described, do the commands etc have to be written by hand?

Unfortunately I do not yet have the knowledge to write scripts manually within QTP so is it possible to create the methods decribed using the toolbar options etc?

Regards

GOM