My problem is the following: We use Selenium IDE and RC at work to test the functionality of our website. Our website features a list that is saved on the server every time you add an item.It also allows users to log in.
When my selenium suite fails halfway (for example, because there was an error on the site), it may leave some items on the list, it may leave a user logged in, etc. The teardown scripts (log out, clear the list) are now part of the suite, but they wont be executed when the suite fails halfway. So when the next test starts, it does not start from scratch, as it should.This of course will make several steps in that suite fail, causing the whole test run to crash and burn.
One of the solutions I came up with was to, after each test suite, run several smaller teardown suites that are allowed to fail.
Example: Big Main Suite Fail Log out Fail clear list Success
This is what would happen on a test that fails halfway and left some items on the list
Big Main Suite Success Log out Fail clear list Fail
This is what would happen on a successful run.
Even though this solution would probably work, it's really terrible for your reports.
So I basically have 2 questions:
- What is the most elegant way of making sure that a suite starts from scratch, even though the suite before it failed?
- Is it possible to suppress "failure"messages of suites and cases that you don't mind failing?