Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New Test Parameters
#1
Not Solved
Hi

Can we create the test parameters using vb sscript without adding them in Settings->Parameters tab in QTP? If yes, please let me know the process.
Reply
#2
Not Solved
there is no direct method to do this, however you can use QTP AOM to achieve this. e.g
Code:
Test.Actions.Item(1).ActionParameterDefinitions.Add "InParam", "Param1", 0, 0, "Input Value"

for more detail, search for "ActionParameterDefinitions" in qtp help.

Reply
#3
Not Solved
Hi,
Isn't above script for adding action parameters ,not test parameters?Please correct me if I am wrong.
Reply
#4
Not Solved
Hi Saket ,

My requirement is to create test parametersSad. Not action parameters
Reply
#5
Not Solved
Hi,
Plz use this method for test parameters.


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

'Open a test
qtApp.Open "C:\TestInputParams"

' Retrieve the parameters collection defined for the test.
Set oParams = qtApp.Test.ParameterDefinitions.GetParameters()

oParams.Item("InputDataFile").Value = "C:\NewTestData.xls"

' Run the test with changed parameters.
qtApp.Test.Run , True, oParams
Reply
#6
Not Solved
This still requires the parameters to exist by creating them manually before running the test. As far as I am aware though this is the only way of setting params via a launch script and they cannot be created externally.
Reply
#7
Not Solved
It's actually quite easy for Environment parameters to be created (they are the ones found under "File\Settings\Environment\User-defined" and are visible/editable in ALM/QC).
Code:
'Instantiate the QTP OTA
    Set App = CreateObject("QuickTest.Application")
    App.Launch
    App.Visible = True

'Open a test as required
    App.Open "C:\Program Files\HP\QuickTest Professional\Tests\trial", True

'To add an environment variable to a test
    App.Test.Environment("MyNewParam") = 2

'To change an existing variable just re-write over the variable
    App.Test.Environment("MyNewParam") = "Two"

'Exit safely ;)
App.Test.Save
App.Test.Close
App.Quit
Set App = Nothing
Not sure how you would delete a variable though...
Also not sure why it bypasses the ParameterDefinitions methods or if they are different in a way that would benefit the user to use them separately.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Set data parameters Mik2s 1 1,534 03-07-2019, 10:18 PM
Last Post: supputuri
  Part of parameters missing when passing between actions skumar007 1 3,032 10-10-2014, 02:00 AM
Last Post: skumar007
  Launching .exe file with parameters magnifyingone 1 3,218 08-28-2014, 06:39 PM
Last Post: dplank
  Need Help Understanding Parameters alex228015 0 2,304 03-18-2014, 12:30 AM
Last Post: alex228015
  Using ALM parameters to drive QTP Brian.Osborne 0 5,094 06-19-2013, 11:23 PM
Last Post: Brian.Osborne

Forum Jump:


Users browsing this thread: 1 Guest(s)