Run the automation script suite of Robot Framework using Python script by handling login logout for both pass and fail test cases

I have developed automation test script using Python-Robot Framework-Selenium Library. My Test suites are running properly in pycharm. In every script I have added login in the start and logout at the end of every script.

Now I want a single file of Robot Framework OR Python where it should handle login and log out of all the Robot test script suites. Every script should logged out wheather its passed or failed in middle. After that it should logged in to the next script and run it.

Currently if my test failed due to data or missing locator, my script stops and application is not getting logged out and application gets closed.

One more thing, as per clients requirement, when user logged in to the application, the same user is not allowed to logged in with same credentials and hence in next script logged in is not working and it shows as “User is already logged in”. I can not ask to make any change in this requirement.

In part this is what you’ll want to take a look at:

http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#toc-entry-285

Test Setup
Test Teardown

Hopefully that answers your query.

Thanks

1 Like