Write Status of Script to sendmail

Hi,

Just wondering how I would (in an email) indicate whether a test passed or failed after I have use ‘logerror’ to logerror during the test.

More or less, is the a function that simply say whether the script ended in a Success or a Failure? New to eggPlant so any help would be apprediated.

Thanks in advance

Hi niilankwei,

Below i have written a script that will email you whether your script has passed or failed. I have used the runwithnewresults command, which runs a given script, generating a separate Log file for it. If the script passes, you will get an email indicating that it passes, along with a log file. If the script fails, you will get an email indicating that the script has failed, along with a screenshot of when the script failed, as well as the log file.

Runwithnewresults "Tutorial 1"
put the result into Outcome
put the name of me into title
if the status of Outcome is not "Success"
	put Outcome's Logfile into screenError
	replace "Logfile.txt" with "Screen_Error.tiff" in screenError
	sendmail(to: "max.gerrard@testplant.co.uk", \
			from:"eggplant@testplant.com", \
			subject: title, \
			body: "The test script generated an error.", \
			smtp_host:"mail.testplant.com", \
			attachment:( screenError, Outcome's Logfile))
else
	sendmail(to: "max.gerrard@testplant.co.uk", \
			from:"eggplant@testplant.com", \
			subject: title, \
			body: "The test script ran successfully.", \
			smtp_host:"mail.testplant.com", \
			attachment: Outcome's Logfile)
end if

I hope this helps.

Hi niilankwei,

In addition to this, you will need to enter your eggPlant mail settings. This can be done by navigating to eggPlant preferences and entering your email details.

Thanks for that. Testing it out now. Hope it works within the script I’m using.

Cheers