Is public API validation enough for unit testing API component?

My software (application) provides API (webservices) using httplistener. From the unit test point of view, is it enough to check API functions through web requests?

I ask about this since I read that the best practice is to test only the public methods of the class. In this case, I do not test the public methods of the class, but the public API functions from the entire component.

Thanks for any advice.

+3
source share
3 answers

. . - -, , . Webmethods , MVC.

, . , , , .

+4

, . API, , API.

, ? , ( API), - , , .

+2

" , , . , API- ."

, . API - API.

API Public API - - API - , .

API: . , . .

Some people will discuss the definition of "unit" for unit testing. Some argue that a “unit” is always an autonomous class and nothing more. I do not see how this is true, but some people will argue this.

The unit is atomic or indivisible. This is the unit when your test does not reflect the structure of the device.

+1
source

Source: https://habr.com/ru/post/1718091/


All Articles