Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Storing dynamic data at run time
#1
Solved: 11 Years, 4 Months, 1 Week ago
Hi Ankur,

We have recently started using QTP for testing of our web sites. We have different actions to define data for the required fields on the web site. There are certain scenarios where data can only be identified at run time. We need to capture this data and store some where for verification at later point.

Currently we are adding a new data sheet at run time. Run time data is stored in the data sheet by adding parameters at run time. Since the data sheet is added by main action in the script it is accessible by all reusable actions. Since data is defined at run time; I am afraid that it will exceed the maximum possible columns (256) in data sheet and will fail some time (based on entries in database).

Can you suggest any approach to store run time data in any other format and be able to pass this information to other actions for later use and modifications?

Thanks,
Rupesh
Reply
#2
Solved: 11 Years, 4 Months, 1 Week ago
Are you sure you have 256( or more) fields to feed data, at run time?

If at all thats the case, make use of environment variable. Environment variable are visible throughout the run and can be checked at any point.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Solved: 11 Years, 4 Months, 1 Week ago
Thanks Ankur, that was quite helpful.

For others who look at this thread, here is the code that I am using to add environment variables at run time to define the data at run time. Ankur if you a have easy way of doing this, please post.

code goes like this:
"
Code:
'Define data
On error resume next
temp_val = environment.Value("FName")
If err.number <> 0 Then
    environment.Value("FName") = "Rupesh"
End If

On error resume next
temp_val = environment.Value("LName")
If err.number <> 0 Then
    environment.Value("LName") = "Mishra"
End If

'Display recently define data
On error resume next
MsgBox "Name is : "  & environment.Value("FName") & " " & environment.Value("LName")
If err.number <> 0 Then
    MsgBox "Parameter FName not defined"
End If

On error resume next
MsgBox "Date of Birth : " & environment.Value("DOB")
If err.number <> 0 Then
    MsgBox "Parameter DOB not defined"
End If

"

This code will display two message boxes; first one with text "Name is : Rupesh Mishra" and second one "Parameter DOB not defined"

Thanks
Rupesh
Reply
#4
Solved: 11 Years, 4 Months, 1 Week ago
OK... here is next problem.

I stored run time data in different environment variables. I do this in every iteration. Since environment variables do not reset till the script is running I am facing problems. I need to reset environment for each of the iteration.

Is there a way to

1.) Identify how many environment variables are defined
2.) Find the names of these environment variables
3.) Delete them

QTP GUI allows deleting User defined internal variables. There should be a way to do it programmatically. If you know please post.

Thannks
Reply
#5
Solved: 11 Years, 4 Months, 1 Week ago
You can use File > Test Settings > Generate Script to get this done programmatically ( First make sure that you define atleast one "userdefined" variable under Environment variable settings) ---of course you need to tweak the code to make it work for you.

Otherwise you can do a workaround also,
Overwrite the environment variable and where overwriting is not taking place make them blank.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#6
Solved: 11 Years, 4 Months, 1 Week ago
Hi

1)Why not use a Simple flat(text) file and write all your values
The classic comma separated format

2)Why use colums in a excel sheet use the rows, rows are not limited.

Define a excel object and write it in the rows without importing
we can USE colum a for variable name colum b for value....
regards
Kishore
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QTP not recogonising object during run time Lavanya N 2 3,729 10-28-2015, 12:46 PM
Last Post: vinod123
  Writing to Run time data table Neetha 5 12,182 08-27-2015, 10:18 AM
Last Post: supputuri
  Webtable Checkpoint to get cell data from dynamic WbfGrid Neetha 1 3,482 08-20-2015, 11:43 PM
Last Post: ADITI1992
  How to Export run result viewer with CAPTURED DATA and save it in PDF,or Doc,or HTML akhandesh 0 2,958 07-16-2015, 06:03 PM
Last Post: akhandesh
  Storing runtime value into datasheet priyaUFTlearner 4 3,443 04-10-2015, 10:08 PM
Last Post: priyaUFTlearner

Forum Jump:


Users browsing this thread: 1 Guest(s)