0

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?

2
  • How do you cache a DELETE? or POST/PUT? Typically caching is used for GETs to make them quicker or use less resources. Commented Oct 31, 2019 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
    Commented Oct 31, 2019 at 13:06

3 Answers 3

1

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
1
  • I usually test by stop sql server then query again, if result returned mean cache works. Commented Mar 27, 2020 at 9:44
0

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.

1
  • 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. Commented Mar 27, 2020 at 9:45
0

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

1
  • i would not have feasibility to modify the API application. Commented Nov 4, 2019 at 0:54

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.