How to write simplify path inside the list

While Creating a Master Script i need to define the test scripts as follows
set Testlist to ("Test1","Test2","Test3")
.
My problem is here is that,the path for all the test Scripts are very lengthy(for example- Test1 path is in path (Users/Shared/NewProject.suite/Scripts/FunctionlityA/Test1" ).
Is there any way to simply it.

I tried with
set Searchpaths to {"/Users/Shared/NewProject.suite/Scripts"}
set Testlist to ("~/Test1","~/Test2","~/Test3")
repeat with each testscript of TestList
RunWithNewresults testScript 
end repeat

Kindly Suggest me where I'm going wrong and what exact changes i have to make.

Thanks in Advance

Comments

  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    You're on the right track. Just use the '&' operator to combine the path and the test name and with a few other little tweaks you'll have it:
    set Searchpath to "/Users/Shared/NewProject.suite/Scripts/" 
    set Testlist to ("Test1","Test2","Test3") 
    repeat with each testscript of TestList 
        RunWithNewresults Searchpath & testScript 
    end repeat
    
    See if that works better for you. :)
  • EggplantMattEggplantMatt ForumAdmin admin
    You could also add the suites containing those scripts to the Helpers tab or add them programmatically to the "the InitialSuites" list and then you could just refer to them by their names without worrying about the paths.
  • Thanks a lot .
    It worked Kool !! :lol:
  • set Searchpath to "/Users/Shared/NewProject.suite/Scripts/" 
    set Testlist to ("Test1","Test2","Test3") 
    repeat with each testscript of TestList 
        RunWithNewresults Searchpath & testScript 
    end repeat
    

    The Above code works fine.when i open the Results of the Masterscript it shows only whether Master Script Sucess or Failure ,not each individual Script.It shows the path of individual Script .But i would like to capture individual test result for each test script in a seperate .csv files along with the Log & Log Error occured while running each Script.

    I tried with the following options as mentioned in the Doc
    set Testlist to ("Test1","Test2","Test3") 
    repeat with each testscript of TestList 
        RunWithNewresults Searchpath & testScript 
    
    put the result into Outcome 
    put testScript & ":" && status
    of Outcome && Return after
    currentReport
    
    if the status of Outcome
    is "Failure" then 
    run "CleanupScript" 
    end if
    
    end repeat 
    
    Log "Final Results" 
    
    repeat with each line of
    currentReport
    log it
    end repeat
    

    when i ran this code it says there is no such things "of" and "after".kindly guide me with proper coding way to get the desired output.
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    It looks like many of the commands got broken into several lines somewhere along the way. It should look more like this:
    set Testlist to ("Test1","Test2","Test3") 
    repeat with each testscript of TestList 
        RunWithNewresults Searchpath & testScript 
    
        put the result into Outcome 
        put testScript & ":" && status of Outcome & Return after currentReport 
        
        if the status of Outcome is "Failure" then
            run "CleanupScript" 
        end if 
    
    end repeat 
    
    Log "Final Results" 
    
    repeat with each line of currentReport 
        log it 
    end repeat
    
  • It Worked gr8!Thanks :lol:
  • set Testlist to ("Test1","Test2","Test3") 
    repeat with each testscript of TestList 
        RunWithNewresults Searchpath & testScript 
    
        put the result into Outcome 
        put testScript & ":" && status of Outcome & Return after currentReport 
        
     end repeat 
    
    Log "Final Results" 
    
    repeat with each line of currentReport 
        log it 
    end repeat
    

    1. In this above code Results file has only the Sucess & Failure results of the individual tests.I would like to display Log ,LogError message afterevery testcase results.

    Like

    Final Results
    Test 1 : Success
    Log : "Validate Sucess : SAVE Button enable after changes "
    Test 2 : Failure
    LogError : "Validation Failed : CANCEL Button diabled "

    2. If the master Script failed to run at anypoint of time.Atleast i would like to see the individual results of scripts run so far.but,above code doesn't works that way.Kindly help me out
Sign In or Register to comment.