Query on how to skip testcases if the Suite Setup or Suite Tear Down Fails

25 views
Skip to first unread message

Archana Basutkar

unread,
Jun 18, 2024, 7:02:53 AMJun 18
to robotframework-users
Hi Team,
Greetings for the day!
Problem statement:
Currently for any Test Suite , all the testcases gets status : Failed 
when the Suite setup or Suite teardown fails .

In Robot framework 6.1.1 : Is there any provision to mark all the testcases as Skip when the Suite Setup or Suite Teardown Fails .

Any built in variable that can give me the status of Suite setup or Suite teardown as PASS or FAIL so that based on the value will call the "Skip" keyword.


Thanks in advance 

Regards,
Archana

Craig Despeaux

unread,
Jun 18, 2024, 1:22:55 PMJun 18
to robotframework-users
I'm not sure I follow skipping tests if the Suite Teardown fails because the tests have already been executed at that point.  However, if you wanted to skip tests, rather than fail them if Suite Setup fails, you could do something like this:

*** Settings ***
Suite Setup  Run Keywords  Set Suite Variable  $SUITENAME_STATUS  FAIL
...  AND  SuiteSetupKeyword
...  AND  Set Suite Variable  $SUITENAME_STATUS  PASS

*** Test Cases ***
Test Case
  Skip If  ${SUITENAME_STATUS} == "FAIL"
  Test Keywords

So if a failure occurs in your SuiteSetupKeyword or whatever list of keywords you put here, the last Set Suite Variable statement will never be executed and $SUITENAME_STATUS will be left at "FAIL".  Then all of your tests check the value of the suite variable with a Skip If statement.

There may be a better way to do it, but this is one way.

Craig

Craig Despeaux

unread,
Jun 18, 2024, 1:25:11 PMJun 18
to robotframework-users
Sorry, the Skip If statement should have been this instead:


Skip If  "${SUITENAME_STATUS}" == "FAIL"

Craig

Archana Basutkar

unread,
Jun 20, 2024, 7:34:05 AM (14 days ago) Jun 20
to craiged...@gmail.com, robotframework-users
Thanks a ton Craig .
Your solution has resolved the  setup issue .
I am able to skip all testcases when the parent suitesetup fails 

Thanks and regards,
Archana

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/robotframework-users/a94dcc43-ecbf-4f70-9867-b94eb05cb158n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages