UTBotJava icon indicating copy to clipboard operation
UTBotJava copied to clipboard

Warm up the database in Spring integration tests

Open EgorkaKulikov opened this issue 3 years ago • 1 comments

Description

It is better to create some "fake" operations of adding data to the database and removing it before real test generation. If some small values are used as id, fuzzer may just guess it, so generated test may not be reliable.

Even though we reset some Spring beans between the tests, database tables ids are not reset, so some warm up will highly likely help to avoid ids clashes.

EgorkaKulikov avatar Jun 30 '23 16:06 EgorkaKulikov

There may be other id generators non-related to Spring data repositories, that also require same warmup. I think more general solution may be to change the way we emit UtFuzzedExecutions. Right now for every unique Coverage the very first UtFuzzedExecution that achieved that Coverage is emitted. I think, if we have multiple UtFuzzedExecutions achieving same coverage we should ignore first few ones.

The drawback of such approach is that it leads to generation of unreproducible tests if some Coverages we observed only with guessed identifiers. That may be fixable by rerunning tests after minimization, while fully resetting context after every individual test.

IlyaMuravjov avatar Jul 03 '23 12:07 IlyaMuravjov