Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extract data from test and use it in another test
#8
Solved: 10 Years, 9 Months, 2 Weeks ago
if you are using QTP AOM then you can easily do this
see if the code below gives you an idea

Code:
Set qtApp = CreateObject("QuickTest.Application")
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions")
qtApp.Launch
qtApp.Visible = True

qtResultsOpt.ResultsLocation = "D:\results"

qtApp.Open "C:\QTP\Script\Script1"

' parameters collection defined
Set pDefColl = qtApp.Test.ParameterDefinitions

Set oParams = pDefColl.GetParameters()

'added parameters Run the script
qtApp.Test.Run qtResultsOpt, True, oParams

'Extract the output Parameter
Set oParam = oParams.Item("OutputVal")

qtApp.Test.Close

qtApp.Open "C:\QTP\Script\Script2"


Set pDefColl = qtApp.Test.ParameterDefinitions

Set iParams = pDefColl.GetParameters()

Set iParam = iParams.Item("InputVal")

'add input parameter taken from earlier test
qtApp.Test.Run qtResultsOpt, True, iParam

missed to assign ouput parameter to the input parameter for second run in the code
try this -
Code:
Set qtApp = CreateObject("QuickTest.Application")
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions")
qtApp.Launch
qtApp.Visible = True

qtResultsOpt.ResultsLocation = "D:\results"

qtApp.Open "C:\QTP\Script\Script1"

' parameters collection defined
Set pDefColl = qtApp.Test.ParameterDefinitions

Set oParams = pDefColl.GetParameters()

'added parameters Run the script
qtApp.Test.Run qtResultsOpt, True, oParams

'Extract the output Parameter
Set oParam = oParams.Item("OutputVal")

qtApp.Test.Close

qtApp.Open "C:\QTP\Script\Script2"


Set pDefColl = qtApp.Test.ParameterDefinitions

Set iParams = pDefColl.GetParameters()

Set iParam = iParams.Item("InputVal")

iParam.Value = oParam.Value

'add input parameter taken from earlier test
qtApp.Test.Run qtResultsOpt, True, iParam

Reply


Messages In This Thread
RE: Extract data from test and use it in another test - by Saket - 10-06-2009, 03:39 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Send automatic email notification when test run started helmzshelmz 0 937 04-03-2020, 07:54 AM
Last Post: helmzshelmz
  Multiple rows of test data Bhuvana 0 1,190 01-03-2020, 09:30 PM
Last Post: Bhuvana
  Can we test Salesforce Standard form using QTP? yona34 0 949 05-22-2018, 10:57 AM
Last Post: yona34
  issue with IE when running test eiko 2 1,452 02-01-2018, 04:46 PM
Last Post: eiko
  Test runned from QualityCenter generated an error "Attempted to divide by zero." robertosalemi 1 2,376 10-14-2016, 08:38 PM
Last Post: robertosalemi

Forum Jump:


Users browsing this thread: 1 Guest(s)