2

Using the pact provider JUnit 5/Spring Boot support annotations, perhaps I am not searching well for the answer... I'm wondering if it's possible to annotate a pact provider verification test with multiple consumers using the @Consumer annotation.

Like I would want to be able to do something like the following

@Provider("provider-name")
@Consumer("consumer-1, consumer-2")
@PactBroker
@ActiveProfiles("test")
public class PactVerificationTest {

    @Test
    //test methods
    //...
}

The annotation takes a String as a value so unfortunately something like @Consumer({"consumer-1", "consumer-2"}) does not work either.

madeyejm
  • 472
  • 3
  • 14

1 Answers1

4

Like this:

@PactBroker(consumerVersionSelectors = {
        @VersionSelector(consumer = "my-consumer-1"),
        @VersionSelector(consumer = "my-consumer-2")
})

Use the latest library version and see documentation for more

Artem Ptushkin
  • 1,151
  • 9
  • 17