cancel
Showing results for 
Search instead for 
Did you mean: 

Jenkins file code to send email notification on error

SOLVED
Highlighted
Occasional Contributor

Jenkins file code to send email notification on error

I need to run my test project in TestComplete14 every night, and I need to be able to send result (Succeeded/Error(s) occurred) as a part of a email subject.
Currently, I run the test project in Jenkins as a scheduled nightly job and also use Jenkins file to send email notification for pass/fail build status .I want to go a step further and code Jenkins file to send email notification of Success if all test cases passed and Fail if there is given percentage of errors. I am having trouble to accomplish that. Can anyone help?

 

Below is the Jenkins file code, which I use currently for email notification for Build status -

post {

        always {

            echo "Notifying build result by email"

        }

        success {

            mail to: 'email address',

                 subject: "SUCCESS: ${currentBuild.fullDisplayName}",

                 body: "Test Complete Build passed."

        }

        failure {

           mail to: 'email address',

                subject:"FAILURE: ${currentBuild.fullDisplayName}",

                body: "Test Complete Build failed."

        }

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Manager

Re: Jenkins file code to send email notification on error

@Shehnaz As far as I understand this is not so much TestComplete-related. This is more so a question about Jenkins. 

I can try something like this - https://medium.com/@gustavo.guss/jenkins-sending-email-on-post-build-938b236545d2 


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

2 REPLIES 2
Highlighted
Community Manager

Re: Jenkins file code to send email notification on error

Thank you for posting your question @Shehnaz !

 

What do you think @tristaanogre @AlexKaras @Marsha_R @anupamchampati ?


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Community Manager

Re: Jenkins file code to send email notification on error

@Shehnaz As far as I understand this is not so much TestComplete-related. This is more so a question about Jenkins. 

I can try something like this - https://medium.com/@gustavo.guss/jenkins-sending-email-on-post-build-938b236545d2 


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors