Command line arguments and eggPlant scripts

When running eggPlant scripts via the command line, is there any way I can access the command line arguments from SenseTalk?

Cheers

Sam

Comments

  • Nevermind, I found this: http://docs.testplant.com/?q=content/running-command-line

    BUT:
    Passing Parameters
    You can pass parameters to a single script, or the last of multiple scripts to be run. At the end of the runscript line, type -params, and then the parameters, separated by spaces.

    Example: /Applications/Eggplant.app/runscript /Users/Alex/appTests.suite/Scripts/test1.script -params "SUT1" "phonebook.txt"

    What do I use to access the variables passed in from the command line?
  • RyanDRyanD Member
    I think the parameterlist() function should work.
  • I used param(n) in the end.
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    The parameterList() and param(n) functions will both work fine. A slightly more elegant solution is to use a params declaration to give names to the incoming parameters. It must be the first (executable) line of the script, and looks something like this:
    params SUTName, dataFileName
    
    That would assign the first value passed in to a variable called SUTName, and the second value to dataFileName. This both assigns names to the values and also helps to document what the script is expecting.
Sign In or Register to comment.