When should you clear the browser cache?
carriann last edited by
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?
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.