is it possible send email in Robot Framework

5,154 views
Skip to first unread message

nattu...@mahathiinfotech.com

unread,
Aug 31, 2017, 8:31:20 AM8/31/17
to robotframework-users
Hi All
     Is it possible send email in Robot Framework.  if test case successful mean  i need to send email the test case passed successfully else i need to send email  test case failed . Please explain 

Tatu Aalto

unread,
Aug 31, 2017, 3:19:47 PM8/31/17
to nattu...@mahathiinfotech.com, robotframework-users
Ugh

Many things are possible from Robot Framework, but your need has a problem. To know that has test case passed or failed is known only when execution ends. Because test execution has ended, you can't call any keywords to send the status. Also the report and the log are generated after the test execution has ended.

But there are alternatives to your need. For example we use Jenkins to send emails, with the status of the test execution, to the development team. Also it should be relatively easy build custom runner script, which uses Robot Framework listener API [1] to listen test case status or parses the required information out from the output.xml. 

-Tatu
Send from my mobile

On Aug 31, 2017 15:31, <nattu...@mahathiinfotech.com> wrote:
Hi All
     Is it possible send email in Robot Framework.  if test case successful mean  i need to send email the test case passed successfully else i need to send email  test case failed . Please explain 

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

nattu...@mahathiinfotech.com

unread,
Sep 1, 2017, 3:24:06 AM9/1/17
to robotframework-users

Thanks for Your information Tault Aalto. please explain with any one example, how to send email while executing the test. 

Tatu Aalto

unread,
Sep 1, 2017, 5:21:05 AM9/1/17
to nattu...@mahathiinfotech.com, robotframework-users
Ugh

I can't because I don't know how to do it. If you really need it, I would look into the listener API direction.


-Tatu
Send from my mobile
On Sep 1, 2017 10:24, <nattu...@mahathiinfotech.com> wrote:

Thanks for Your information Tault Aalto. please explain with any one example, how to send email while executing the test. 

--

Denis Lrv

unread,
Sep 6, 2017, 9:55:56 PM9/6/17
to robotframework-users
nattu,

One possibility is to use the "Run Keyword If Test Passed" and "Run Keyword If Test Failed" keywords in your teardown.
Ex:

Run Keyword If Test Passed    SendPassEmail
Run Keyword If Test Failed    SendFailEmail

Where in SendPassEmail and SendFailEmail keywords you send the email
I have never sent an email in a keyword but you could try this lib

here are example from the source code



Another possibility, would be to implement a tool / script that parse the xml test result and send email.
xml schema is documented.


Regards

Shiva Prasad Adirala

unread,
Oct 26, 2018, 1:25:52 AM10/26/18
to robotframework-users
I have similar requirement so using python file I have achieved requirement (need to execute .py file after robot execution)


How to send email after test execution

  1. Copy robotemail.py to file
  2. Create a bat file (which executes robot command and .py file in sequence)

    robot test.robot &&
    python robotemail
    .py

  3. Execute bat file
  4. Email will be sent to recipients

Ru

unread,
Feb 27, 2020, 10:04:16 PM2/27/20
to robotframework-users
Hi,

I've had tried your sample source code, but I have encountered an error "not atttribute" _prepare_connection

no attribute 0.png

under SmtpLibrary when I ran the script.


See the screenshot below
Reply all
Reply to author
Forward
0 new messages