Reset results directory path through command-line option

Hi

The default results directory for a test suite is always set to <test>/Results. We can reset this default value through the test suite Settings tab in Eggplant IDE.

I develop my tests in IDE and re-run them in command-line mode. I'm wondering whether we can make use of any command-line option to overwrite the default results directory path for current run or not? I'm hoping that the results directory path is just overwritten for current command-line run, yet the original results path that we have in Eggplant IDE settings tab remains.

Is this possible? Please advice. Thanks.

regards
Ai Choo

Comments

  • JonathanOSXJonathanOSX admin ForumAdmin admin
    Results locations are stored on a per suite basis. This is stored in the SuiteInfo file in your Suite directory. You could modify it but that would be global across any copy of Eggplant that opens that suite.

    Unfortunately there isn't a CLI option to do what you are looking for, so we'll consider this a feature request that we'll try to work into a future release.
  • SenseTalkDougSenseTalkDoug admin ForumAdmin admin
    As Jonathan said, we'll consider adding a runscript command-line option for this in the future. In the meantime, it's possible to hack something together using a script. Here's a little script that will set the ResultsFolder in the SuiteInfo file of a script:
    (** SetResultsFolder.script
    This script sets the results folder of a suite. Call this script to set the results folder prior to running any scripts in the suite.
    **)
    params pathToSuite, newResultsFolder
    
    if pathToSuite is empty
    	answer folder "Select a Suite"
    	if it is empty then exit all
    	put it into pathToSuite
    end if
    
    if newResultsFolder is empty then
    	answer folder "Choose the results folder"
    	if it is empty then exit all
    	put it into newResultsFolder
    end if
    
    // find the SuiteInfo file
    set infoFile to pathToSuite & "/SuiteInfo"
    
    if there is no file infoFile then
    	put "There is no file " & infoFile
    	put "Unable to set results folder"
    	exit all
    end if
    
    // read the suiteInfo file
    put file infoFile into suiteInfo
    
    // find the current definition of the results folder
    put offset of "ResultsFolder = " in suiteInfo into startLoc
    put offset of return within suiteInfo after startLoc into endLoc
    
    // if results folder isn't already specified, prepare to insert rather than replace
    if startLoc is zero then set startLoc to endLoc+1
    
    // replace (or insert) the new definition
    put "ResultsFolder = " & quote & newResultsFolder & quote & ";" & return \
    		into chars startLoc to endLoc of suiteInfo
    
    // rewrite the suiteInfo file with the new result location
    put suiteInfo into file infoFile
    
    You should probably run this when the suite isn't open in Eggplant (otherwise Eggplant is likely to overwrite your change). If you call this script from the command line be sure to pass both the path to the suite and the desired results folder as parameters. Otherwise it will try to use the "answer folder" command to ask the user for them, but the ask and answer commands don't work when running from the command line.

    To do exactly what you've asked for you'll want to save the previous result folder setting somewhere (either by modifying this script or through some other mechanism) and then restore it again afterward. Good luck!
Sign In or Register to comment.