Reputation: 360
Consider the following data driven test case:
TC001_Sign_in_test
[Documentation] testing sign in with various credentials.
[Teardown] ${None}
[Template] attempt sign in and check status
${corr_usrnm} ${corr_pswd} ${welcome_screeen}
${corr_usrnm} ${mispld_pswd} ${sign_in_error_label}
${corr_usrnm} ${EMPTY} ${sign_in_error_label}
${EMPTY} ${corr_pswd} ${sign_in_error_label}
${mispld_usrnm} ${corr_pswd} ${sign_in_error_label}
After my first step in the test where we login with correct username and correct password, my app is already signed in and I would like to sign out so I can work on the next incorrect password step.
I was wondering if it was possible to insert a sign out step between the correct password and incorrect password steps. I dont have to do it this way, I could put the successful step in the end and solve the problem easily or just create another separate test for successful login, but I would like to know if it was somehow possible to insert an action in between the two rows of the data table.
Upvotes: 1
Views: 44
Reputation: 2473
Simply add the logout step(s) to your template keyword, attempt sign in and check status
. If this is a keyword imported from a library you cannot modify for some reason, you can always create a wrapper user keyword that calls this keyword and then calls the keyword(s) required to logout
Of course since not all of your tests actually make a successful login, you may have to setup a condition based on the expected status passed to your template keyword.
Upvotes: 1