Day 18: “What are cookies and how are they commonly used on an e-commerce website?”
Reference: Website Cookie Testing & Test Cases for Testing Web Application Cookies
This is a pretty good article, so I can’t do better than quote and summarize:
Basically cookies are locally cached files that store user identity and other information.
I knew that.
I didn’t know about the two types of cookies, or at least I never really thought about it.
#1) Session cookies:
This cookie is active till the browser that invoked the cookie is open. When we close the browser this session cookie gets deleted. Some time session of say 20 minutes can be set to expire the cookie.
#2) Persistent cookies:
These are cookies that are written permanently on the user machine and lasts for months or years.
There are a few applications listed, but we are interested in ecommerce:
To implement shopping cart:
Cookies are used for maintaining online ordering system. Cookies remember what user wants to buy. What if the user adds some products to their shopping cart and if due to some reason the user doesn’t want to buy those products this time and closes the browser window?
In the above instance when next time the same user visits the purchase page he can see all the products he added to the shopping cart during his last visit.
There are lots of test cases in the article. Here are a few of my favorites:
Disable cookies and see how the site works. We need to make sure the site delivers the appropriate message, informing the user that cookies are required.
Partially accept cookies i.e. if your site writes 10 cookies, accept only 5 by using “manually accept” settings in your browser. See if this causes pages to crash or data to become corrupted.
Corrupt cookies - manually edit the cookie files in order to corrupt them, and see what effect this has on the site.
Validate Expiration dates - make sure cookies expire when they are supposed to
Validate persistence - Check cookie types and make sure they are persistent if required.
-Dave K
(Note: Thanks to the testers slack people for assuring me that the sesame street reference is not lost on our international audience).