How do i Log information to a common File when running nested scripts from a master script ?
Normally in a Master script you want to have each script generate it’s own Result file then so you call it using RunWithNewResults.
If you call another script (using the Run statement) then those actions will be logged in the result for the script that called it. On drawback to that is that if one script fails they will all fail. If you want to trap potential errors in the master script then you can use a TRY…CATCH…END TRY structure to trap and report errors.
Thanks for the Information on the Log Files.
Can you tell me how to update the “NumberOfFails” value from within the Script. Trying to get Jenkins to realize an error has occurred.
You don’t set it directly, but anytime you use the LogError command it will increment it by 1. It will also increment by 1 if an exception is raised and not caught causing the script to end (e.g. an ImageNotFound error occurs)
If the script finishes and and the error count is at least 1 then the process will return an error code > 0 and Jenkins will recognize that as a failure.