Integration testing in complex API scenarios

Asked

Viewed 103 times

0

Good afternoon,

For a simple scenario I delete all records from the database tables before performing each integration test.

My question is the following how to prepare the test database for complex environments, example to carry out the issue of an insurance policy are required many tables populated in the database.

In this case I would have to have a copy of the production database (d-1) to run the integration tests ?

1 answer

0

I program in Java. For integrated testing, we worry about creating the mass in the test itself and erasing the mass at the end of the test. For this we created a persistence utility, where I ask him for an entity, for example "Pessoa.class" and he returns me an object of type Pessoa, already persisted in the database. Also, this utility keeps a list of objects created during the test, so that in the after test, I can delete those objects. All this happens transparently.

The utility has a method "create Persistir(Class pClasseTO)" and a "clean-up()".

Thus, the test infrastructure is well simplified, and the test is much cleaner.

In my opinion, using copy of the production base is not a good deal, as you will not have control of the data mass, besides, you have much more information than you would need.

  • I understand, I can create excel files that contain the information needed to run the tests ?

  • It could also be, this is called testTable, even to use . txt for this. Just the columns are separated by | or ;. If you’re interested, check out my post: https://edermfl.wordpress.com/2015/12/17/testando-functionalities/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.