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?
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
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.