How would you test a search API?

I’ve got an API where I provide the search term (and optionally a filter or two) and it returns the search results in JSON. Each item in the search results has a few fields.

I’ve got Elisabeth Hendrickson’s Test Heuristics Cheat Sheet to get me started exploring with different inputs. What else would you try? What would you look for in the results? What would you automate?

Along the same lines as test heuristic cheatsheet you could try using for interesting data to send into the API. Then with it being an API you could go down the postman route and start creating an automated test collection, where you can check for the results you are getting back but then also things like the time taken to receive the results.

For other things to try and what to look for in the results that would depend on your situation.
Is this a brand new search function or just a new API end point?
Are you in a position to check the accuracy and relevancy of the search results?
Are things like performance and load testing of importance?

Great idea! I have used that list of naughty strings before, but not in an automated context. I wonder how many of the options on that list would give me the same response. Or what causes processing time to be longer.

It’s a new search function. I haven’t gotten any guidance about what accurate or relevant results would look like, but it is something I’m worried about. Having tested other search features before, it’s what people notice more than performance. I wonder if I can get an environment where (perhaps destructive) load testing could be performed.