Many testers reflexively clear the browser cache before running a test on a web application. Yet, we cannot necessarily expect that actual users of the application will approach it with a clean cache in production, and it would be desirable to verify that the application still works well in the presence of cached items.

When and why should web application testers clear the browser cache prior to a test, and when should they leave the cache uncleared?

4 Answers 4


Test code cycles much faster than production code, and it's not uncommon for there to be major changes to how an application works during the early stages of its development.

Clearing the cache ensures (mostly - server-side caching can cause problems) that the tester is looking at the code they think they're looking at.

I typically don't clear cache before manual testing - I expect the coders I'm working with to have the correct flags in their code to minimize caching issues. If I don't see what I expect, I'll clear cache and retry. This method also alerts me to any potential problems deployment could cause.

For automation, I always clear cache before starting so the code I'm running against is the code I expect to be running against.

Outside those general rules, I look at what the application is supposed to cache and not cache, and adjust what I do with the browser caching depending on that.


The most appropriate answer to this is (according to me) - whenever you want to!

You clear cache to get rid of the old CSS and js saved on your local machine (cached), which allows the updates CSS and js to load. When you are testing, the code may get update more frequently and maybe that is why testers clear the cache more often as you have written. Although end users will not do that frequently and testing may not depict the actual user scenario with cache not cleared, but after all testing is always about possibilities and not certainty. You can try and run your software with clearing the cache and see what the result will be like and then compare it with the results received after clearing cache.

In any case the final answer will always be - it depends...


You are entirely correct that clearing the cache makes your test environment artificially different than the standard user scenario. Often, though, testers will value consistent results over strict adherence to the standard environment. Inconsistent failures is the #1 cause of tester hair loss.

Personally, I think its fine as long as you have some kind of testing (customer beta, for example) that does exercise the different environments.

Now that you've got me thinking about it, someone should invent a browser plugin that snapshots all the cookies and lets you restore specific, interesting sets of cookies. Then you could have consistency and more realistic environment.


Definitely before running a new test one should clear the cache as it fetches the last visited website UI especially if you are making changes to the website after testing. But that also is required if you are testing the web apps directly to the browser through system not from any tool inbuilt window for browser testing. Some tool provide their own window while performing cross browser testing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.