How do I parameterize property values for spring boot test

592 views Asked by At

I am working on an aggregation framework using spring boot, which can be used to aggregate multiple kinds of I/O operations' results. Additionally, it has support for both non-blocking (reactive) & blocking aggregation layer, which is controlled by a property, which is in-turn used for conditional beans. For integration testing, I have been using this setup:

abstract class HttpUpstreamTests {
    // Setup & test logic
}

@SpringBootTest(properties = {
        "aggregation.reactive.enabled=false",
})
class BlockingAggregationIT extends HttpUpstreamTests {}

@SpringBootTest(properties = {
        "aggregation.reactive.enabled=true",
})
class NonBlockingAggregationIT extends HttpUpstreamTests {}

Now I have to add a couple more base classes:

abstract class MongodbUpstreamTests {
    // Setup & test logic
}
abstract class SqlUpstreamTests {
    // Setup & test logic
}

But of course, I can't make the IT classes extend from multiple abstract classes. One way would be to make all the upstrteam tests parameterized tests, but I can't seem to find a way to use that approach with different values of the property in @SpringBootTest(properties="aggregation.reactive.enabled=false"). Is there a way to use different properties as a parameter for parameterized tests?

0

There are 0 answers