learningQA
learningQA

Reputation: 681

Why is it advisable to maintain a clean browser state for each test in automated tests?

It is advisable that for each test we should maintain a clean browser state so that browser sessions cannot be shared between tests.

The user uses a web application. The usage flow is converted into various use cases and we design test cases for them. The user doesn't clean the browser the browser state before he/she goes to another use case. The browser state is being shared between use cases.

Why it is advisable to clean the browser state after a test where the user doesn't.

Upvotes: 0

Views: 362

Answers (1)

Breaks Software
Breaks Software

Reputation: 1761

It depends on your goal. If you are conducting functional regression testing of product features, you are essentially conducting an experiment. When conducting experiments you want to have strict control over as many variables as possible, so that when the experiment fails you'll have a better chance at figuring out what broke.

If your goal is to test the product's behavior in a browser with a variety of states, then you should put the browser into the specific state that you want to test.

"People do the darndest things", so you would run a 'beta test', or conduct user experience trials, or release the product into the wild for people to just use it. you would not attempt to automate that sort of testing for the simple reasons that it's complex, and will drive you crazy trying to reproduce any found problem to the extent that someone could identify and resolve the problem.

Upvotes: 6

Related Questions