Reurn codes from runscritps?

Using the command line does anyone know what the different return codes are so I can determine success/fail? It seems to always return success even when a test fails according to the logs? Maybe it is supposed to be this way, and I just haven't thought of why? I can always go through and parse the logs for success or fail but it would be nice to have an easy check.

Comments

  • After all scripts and suites have finished running, Eggplant reports
    the number of successful scripts and suites back to the command line. A suite is
    successful if every script in it is successful.

    A return of 0 would mean nothing was successful.
  • So it is just the opposite of every othe pice of software? That doesn't seem very useful, especially if you then need to figure out how many scripts were run to determine if you were truly successful or not. Wouldn't it be better, if nothing else, to return the number of tests that failed. That was 0 would still be success and you could report the number of scripts that failed to your users? I not even sure I can make this work for now, as I would have to add every possible positive number to success codes or my scheduler would always consider it failing (unless that is every test failed) in which case it would think it worked....
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    Yes, in hindsight that probably wasn't one of the best design decisions we ever made. :oops: So, for the next release we've added an option that will let you request that it report the number of failures instead of the number of successes. :)

    Until then, I'm afraid you'll just have to get by with what you've got. One option would be to write a master control script that uses RunWithNewResults to run all of the scripts you've requested and then outputs the number of failures, something like this:
    params scriptsToRun...
    set failureCount to zero
    repeat with each script in scriptsToRun
        get RunWithNewResults(script)
        if it's status is failure then add 1 to failureCount
    end repeat
    if failureCount is not zero then put failureCount
    
    To call this script you'd do:
    runscript masterRunner.script -params /path/to/a/script /path/to/another/script
    
    (Disclaimer: the above code is untested, but should be close)
  • I knew you guys were good when I saw you were using our Jing to make some of the videos on the web site, but today has cemented it. Thanks so much to everyone for all their help on all my questions today.
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    I'm glad we could help!

    I just realized that I left out the CommandLineOutput option on the runscript command. You'll need this in order to see the output from the put command. So the runscript command should be like this:
    runscript masterRunner.script -CommandLineOutput YES -params /path/to/a/script /path/to/another/script
    
Sign In or Register to comment.