my application (Restful API, no UI interface at this moment) has the Cache Async in memory functionality at each GET, POST, PUT, DELETE. Does Postman or any API tools has the ability to test the cache function?

  • How do you cache a DELETE? or POST/PUT? Typically caching is used for GETs to make them quicker or use less resources. – Niels van Reijmersdal Oct 31 '19 at 12:10
  • Not sure about delete operations (however still sure it is possible) but "write" cache is a kind of something people use in real life. Basically there is a "fast" layer that the user operates with which is periodically dumped to the persistent memory. – wec Oct 31 '19 at 13:06

No, how would they know the reponse is cached.

  • Call API with parameters
  • Verify results
  • Stop data storage (e.g. database)
  • Call API again with same parameters
  • Verify same results

How would you do it manually? Does that translate to an automated test?

  • Is the second time faster? (if you can measure that)
  • Can we make it testable by
    • introducing data in the output saying its cached
    • adding logs of each request to the datastore and verify it was not accessed by looking at the logs
  • I usually test by stop sql server then query again, if result returned mean cache works. – user12158726 Mar 27 '20 at 9:44

Since cache is intended to make the interactions faster, you could test if the data was cached on the server side with the help of indirect symptoms.

For example you could clean up the cache and perform some atomic operations with postman. Measure the request execution time (if your requests/operations are synchronous). Then warm up your cache (ask your devs to know what would be the best way to do that) and perform the same steps again. They should take significantly less time.

  • this is complicated as the application did many cache at different places. i would love to test it from any tool like POSTMAN and do not want to touch the codes as defect might invalid if we modify something we are unsure. – user12158726 Mar 27 '20 at 9:45

Deploy 2 separate services, first with cache enabled, second one without and compare the results.

  • i would not have feasibility to modify the API application. – user12158726 Nov 4 '19 at 0:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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