Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
How I can unit-test APIs? Is there any method for asserting API response in drupal 7?
You can find an example in the Examples for Developers module. Here are two excellent guides:
Required, but never shown