How to pass parameter to the test list for runwithnewresults


Normally we write script like this

Set TestList to { "test1", "test 2"}
RunwithNewResults eachTest of TestList

but I want to add parameter for test1, how can I do this?

I try
set TestList to { "test1 para"}
but eggplant fails to find script "test1 para".
2. set test1 to "test1 para"
set TestList to { test1} same error as above.

Must I add a new script, just writes as "test1 para", then use runwithnewresult to call this script?

Are there any other solution?


  • Hello df4747--

    RunWithNewResults takes a list as a parameter, unlike the run command which can take several strings or containers. So what you are going to want to do is place each test in a list with its parameters, like this:
    put (("test1", "para1", "para2", "para3"), ("test2", "para4"), ("test3")) into testList
    repeat with each test in testList
    	runWithNewResults test
    end repeat
    This should get you what you're looking for.

    Hope this Helps!
  • df4747df4747 Member
    Hi Allen,

    Thanks for your reply. but it doesn't work.
    When I change as your code, still error:
    unable to locate script named: ( test1, para1, para2,para3).
    Any other idea?
  • JonathanOSXJonathanOSX ForumAdmin admin
    Actually, RunWithNewResults takes the script name as the first parameter and subsequent parameters are passed to the script being called.. So in the simplest form it would look like this:
    RunWithNewResults "myscriptb", "param1", "param2"
    If you need to pass a dynamic set of parameters you will need to build up a list and use the as parameters operator to pass them as shown here:
    put "myscriptb" into myParams
    insert "paramA" after myParams
    insert "paramB" after myParams
    RunWithNewResults myParams as parameters
  • df4747df4747 Member
    Eggplant crashes, when I try this:

    Runwithnewresults "script","testdata\image"
  • JonathanOSXJonathanOSX ForumAdmin admin
    It sounds like whatever error occurred happened WITHIN your called script so at least we have the parameter passing working, can you confirm? Also, are you sure you don't want your slash going the other way (if it's an image path) "testdata/image"?

    Please send that exception as a bug to [email protected] providing your script if possible.
  • df4747df4747 Member
    I will check it more, and send to support if it happens again.
Sign In or Register to comment.