In a very similar fashion you can test API endpoint handlers: using a json file for the expected result that the endpoint should return: This ensures that the response looks 100% like the json that you want: you usually don’t test just a small part of it.