Forum Discussion

shwetha's avatar
shwetha
New Contributor
9 years ago

Send automatic email

Is there any way to send automatic email once the test runner is completed(test report) using soapUI

  • rupert_anderson's avatar
    rupert_anderson
    Valued Contributor

    Hi,

     

    Yes, this is certainly possible. I did two recipes (custom reporting & emails via SMTP/Gmail) like this in my book.

     

    I cannot share the code, but I can give you tips/pointers.

     

    The are several options, but generally it takes some Groovy scripting & access to an SMTP server of some kind.

     

    Here's one rough approach:

    1. Under the teardown script tab of either the TestCase or TestSuite, iterate over the TestCaseRunner.results collection e.g. for ( testCaseResult in runner.results ) {...}, build up your report as text/html/xml, whatever you need.
    2. Open an SMTP connection (plenty of java code examples that can be found and used in Groovy)
    3. Send your report data

    Does this make sense as a starting point? (its easier than it may sound)

     

    There is also a email TestStep plugin that you may be able to adapt:

     

    https://sourceforge.net/projects/soapui-plugins/files/soapui-emailteststep-plugin/

    https://github.com/olensmar/soapui-emailtestsstep-plugin

     

    Regards,

    Rupert

    • shwetha's avatar
      shwetha
      New Contributor

      Thanks for the reply.

       

      Need inputs for below,

       

      I have used groovy script to send Email but i want to know how to invoke groovy script for Testrunner command line and once the Testrunner is complete, it should attach the test report to the email and send it to the recipients

       

       

      Is it possible ??

      • nmrao's avatar
        nmrao
        Champion Level 3
        Prefer to use Project's Teardown script for the same.