Integration tests in complex API scenarios

0

Good afternoon,

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

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

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

    
asked by anonymous 12.06.2017 / 20:44

1 answer

0

I program in Java. For integrated testing, we worry about creating the mass on the test itself and erasing the mass at the end of the test. For this we create a persistence utility, where I request an entity, for example "Person.class" and it returns me an object of type Person, already persisted in the database. In addition, this utility maintains a list of objects created during the test, so that in the after test, I can delete those objects. All of this happens transparently.

The utility has a "createPerform (Class pClasseTO)" method and a "CleanPerform ()".

So the test infra is well simplified, and the test gets much cleaner.

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

    
12.06.2017 / 21:04