Need to report failed case in ROBOT FRAMEWORK report (LOGS.HTML)

1,036 views
Skip to first unread message

chetan lashkari

unread,
May 27, 2015, 5:04:44 AM5/27/15
to robotframe...@googlegroups.com
Hi,

Thanks for the documentation, I have tried the way it was mentioned in the document but my purpose is a little bit different.
Whatever given in documentation was okay and helpful for me.

Here I am giving example of where I am facing the problem and what do I want :

In my test library which contains following code
ex1- Lib.py

def elementVerfication();
try:
eltext = driver.find_element_by_xpath("//*[@title='1Sign In / Sign Up']").text
except NoSuchElementException as e:
# logger.write("Test Failed",level='FAIL',html=True)
BuiltIn().log(e.msg, level='FAIL', html=True, console=True, repr=True)
In this case ex1, test case is passing since there it is reporting error in logs.html but test case and keyword is getting passed.
ex2- Lib.py

See screenshot-1 for report logs.html.

def elementVerfication();
try:
eltext = driver.find_element_by_xpath("//*[@title='1Sign In / Sign Up']").text
except NoSuchElementException as e:
# logger.write("Test Failed",level='FAIL',html=True)
BuiltIn().fail(e.msg)
TestExmaple.robot
Test Case 2 - Scroll Up, find element & click on it
elementVerification
Run Keyword And Continue On Failure should be equal as strings ${text} SIGN IN / SIGN UP
clickSignIn
expliciteWait
In ex2, it is simply executing the fail and terminating the program, my other statement/keywords in the robot file is not executable in this case.

WHAT DO I WANT:-

As given in ex1, I want it to report in logs.html but also I need to fail it.
Either test case should fail or keyword should fail.

Could you please help me how I do fail test case in except block so that my remaining code will also work and test would fail too and it is logged in report as well.


I have tried to use

Quick Start Guide but related to my there is no explanation.

In my case, it is NoSuchElementFound Exception which is related to selenium, and once it will occur then program will terminate.
If handled then it will go ahead and will not show any fail in report as I mentioned.

I have seen the below section in documentation 

class MyError(RuntimeError):
    ROBOT_SUPPRESS_NAME = True
But still it is not helpful

I hope it is understandable.
Thanks in advance.
screenshot-1.png

Tatu Aalto

unread,
May 30, 2015, 4:13:37 AM5/30/15
to lashkar...@gmail.com, robotframework-users

Ugh

Have you read this: http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#continuing-test-execution-despite-of-failures

-Tatu
Send from my mobile

--
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-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages