cancel
Showing results for 
Search instead for 
Did you mean: 

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.

MaxiBelas
Member
1 REPLY 1

I checked the issue, it was a very simple fix.

In my comment on the issue, I mentioned how I was new to open source contribution, and would like to solve this issue.

The owner/top people for the repository didn't even say anything to my comment and just gave the issue to some other guy(possibly a person who has already contributed many times)

How do you get started as oss contributor as a newbie if you find an issue you can solve but then the repository owner just problems you over and gives someone else the issue.

Should I have not mentioned I was a newbie?

Am I expected to chat around/introduce/make friends in their IRC,mailing list before I am allowed to do this?

hype
Member