Reply
New Member
Posts: 1
Registered: ‎04-22-2021

How should I test my REST API?

I couldn't find the answer to the questions I'm going to ask. Let's say I'm developing a REST API.

  • Should I test every endpoint?

  • Every endpoint interacts with the database. Should my tests include a database connection?

  • Where do unit tests fit in a REST API, apart from request validation?

    • Every controller call goes like this:

  1. Receive request <-- here, I see I could have unit tests for validating request body and HTTP headers

  2. Process <-- here, no matter how deep this level can go, there's going to be interaction with the database, so any test here would mean integration test

  3. Return response

  • Considering the above for every call, how can there be unit tests apart from validating request? When there's database / external service interaction in the test, it's an integration test, right? So I don't see where else could there be unit tests.

New Member
Posts: 1
Registered: ‎05-01-2021

Re: How should I test my REST API?

Yes, ideally you should test every endpoint. And, yes, your tests should my tests include a database connection. You should check every point where an error might occur.

If you cannot do this at the moment, you can look for a freelance specialist to help you customize your tests. Https://cashloansnearby.com/ohio/dayton/ has addresses of payday loans and cash loans in Ohio so you can pay for a specialist consultation without any hassle