using Robotframework how to run specific test only if condition is satified

1,121 views
Skip to first unread message

nnc

unread,
Jul 21, 2015, 2:04:46 PM7/21/15
to robotframe...@googlegroups.com
Hi,
   I have tests written in python functions. I am calling these functions from the robot file. i need to run some specific test only if return value is not empty . How do i do this  ?

for ex:

below is how my robot file , where payment_with_creditcard     ,manage_booking_page  and  verify_confirmation_page  my python test method which i need to call. i want to do something similar to below
i want to do something like below


*** Settings ***
Documentation    endtoend Test suite
Library    pythontestlibrary
Test Setup    test set up
Test Teardown    test tear down
Suite Teardown    suite tear down


*** Variables ***

*** Test Cases ***


test1
${confirmation_no}    payment_with_creditcard    arg1    arg2    arg2
    RUN BELOW TESTS ONLY IF ${confirmation_no} IS NOT EMPTY
    *** Test Cases ***
    verify_confirmation_page    verify confirmation page    arg1    arg2
    manage_booking_page       manage booking page    confirmation_no    email

Andrew Palmer

unread,
Jul 21, 2015, 4:20:46 PM7/21/15
to robotframework-users
As far as I know, I don't think you can do it with test cases, but it does work for keywords, so for example, you may try something as:

${confirmation_no}    payment_with_creditcard    arg1    arg2    arg3
Run Keyword If    '${confirmation_no}'!='${EMPTY}'    verify confirmation page    arg1    arg2 
Run Keyword If    '${confirmation_no}'!='${EMPTY}'    manage booking page    confirmation_no    email

It's essentially the same thing you have above, but a single test case with 3 keyword calls. 

nnc

unread,
Jul 21, 2015, 4:30:40 PM7/21/15
to robotframework-users
yes, that worked .


Thankyou very much
Reply all
Reply to author
Forward
0 new messages