I am new to API Testing.

Are there any template for test case creation for API testing?

Any other advice on how to write a Testcase for API Testing?

  • If you are new to API testing, I would recommend to watch online video tutorials and then start practice on sample projects. You can find many sample projects on the internet! – Muhammad Ali Khamis Apr 24 '17 at 12:49

There might be some "best practices" for testing certain API kinds, but most of the time you test API like and other interface.

An "add user" API should be tested the same way as a "add user" UI control, and only then some more.


I'm sure there are some unit test guidelines, but for interface testing I have always found the best approach is to think of it exactly like a standard functional test and indicate all the data communication points. Once you have that you then abstract the "how to interact" part that would then target all the data communication points via the approved communication pathways which might be a single point or multiple points.

If you provide API specifics it would be easier to answer, but I find the approach above a solid approach for layering a standard functional approach with an interface verification approach that most testers can easily follow. I personally like to start the other way, but that's cause I have a development background as well. Usually I find testers can start at the top and work down easier though.

Also, once you have your test get development to review and tell you if the test accounts for 100% of the available communication pathways, or are their edge cases and layered approaches that are not accounted for. In general there should be a spec for it that should tell you all your connections, but it's always good to be sure there isn't anything hidden underneath and forgotten on the spec. If you can read code, getting access and looking yourself is fun(for me) to do, but whatever works best for you and your team.

  • You might also want to look up and read about the type of API it is. REST, SOAP, etc... – mutt Apr 24 '17 at 16:46

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