-
Notifications
You must be signed in to change notification settings - Fork 59
5. Email Support
Ishaan Kumar edited this page Dec 14, 2016
·
6 revisions
User can get notification about test results via email by writing a yaml file containing mail details. Starting from v1.1 support for conditional mail is also added. This enables user to receive mails based on the outcome of the whole test suite.
Sample mail file, send_mail.yml:
to: [email protected]
from: [email protected]
sub: "Sample Jsnap Results, please verify"
recipient_name: Foo
passwd: 123
server(optional): smtp.gmail.com
optional (by default gmail server is configured in jsnap,
if u want to send from some other email account apart
from gmail, then please specify that server)
port(optional) : specify port, by default it is SMTP port 587
sender_name: "Juniper Networks"
Then include this file in main config file.
Sample config.yaml
# for one device, can be given like this:
hosts:
- device: 10.2.1.1
username : abc
passwd: pqr
tests:
- test_is_equal.yml
- test_is_in.yml
mail: send_mail.yml
####v1.1 Addition :
Conditional mail
For utilizing the conditional mail facility following syntax needs to be used:
mail:
pass: <filename>
fail: <filename>
all: <filename>
-
pass
: Send the mail only when all the test cases pass -
fail
: Send the mail only when one of the test cases fail -
all
: Send the mail regardless of the test case result
Sample Email:
Hi Foo,
Test Performed on Device: 10.2.1.1
Overall Result:
===================
Final Result: TEST FAILED !!
Total Tests Passed: 1
Total Tests Failed: 1
Test details dated March 27, 2016 is as follows:
Test result for show interfaces terse lo*:
===========================================================
Test Operation: is-equal: FAILED
Test case failed for
xpath: //physical-interface[normalize-space(name) = "lo0"]
Node Name: admin-status
Expected Node Value: down
Actual Node Value: ['up']
Test Operation: is-in: PASSED
Test case passed for
xpath: //physical-interface[normalize-space(name) = "lo0"]
Node Name: oper-status
Expected Node Value: ['downoo', 'up']
Actual Node Value: ['up']
Regards
Juniper Networks