Writing test code to check records in the database when testing the API

I am writing test code to test a client-server application. The test application consists of

  • an application running on Tomcat or another Java EE application server, and
  • client banks that expose the API.

I mainly write test code that uses this client API to connect to the server.

In addition to intensive testing of API operations, my bosses advised me to connect to the database on the server and check that the fields are filled in correctly. I did this for some of my test cases, but he did not find any errors in regression.

Errors are caught when any particular functionality fails, but is still detected in the code that the API itself checks. It seems that checking database data is not very useful, especially given the extra effort required to write and maintain all this code.

My question is:

Is there any real benefit to writing test code to connect to the database and verify records in this way? Do you pay the benefits of writing such code?

+3
source share
4 answers

Reading the database is not required for such tests. You can achieve better results by experiencing this:

  • Saving queries returns success status.
  • .
  • reset ie. .

, , , , . , , .

+3

, , , . API , , .

, .

, - . ?

, , .

, , , , , .

+2

. API, .

0

Asking the API to test itself is like asking someone if they are honest, and getting them to answer "because I'm honest" and accept it. This is circular reasoning. Is there a way out of this cycle? I feel embarrassed about accepting the results of something whose validity has not been thoroughly tested.

0
source

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


All Articles