Matt (pactflow.io / pact-js / pact-go)
Marcello Rigan
05/03/2022, 12:10 PMdescribe("Pact Verification", () => {
it("validates the expectations of ProductService", () => {
const opts = {
logLevel: "INFO",
providerBaseUrl: "<http://localhost:8080>",
provider: "ProductService",
providerVersion: "1.0.0",
pactUrls: [
path.resolve(__dirname, '../../consumer/pacts/frontendwebsite-productservice.json')
]
};
return new Verifier(opts).verifyProvider().then(output => {
console.log(output);
}).finally(() => {
server.close();
});
})
and there you add the request filter. My Setup looks different:,
@RestIntegrationTest
@Provider("X")
@Consumer("X")
@PactBroker(
providerTags = ["master"],
enablePendingPacts = "false",
host = "localhost",
port = "9292",
scheme = "http",
authentication=PactBrokerAuth(username = "X", password = "X")
)
class BXBXProviderTest {
@BeforeEach
fun before(context: PactVerificationContext) {
val myProviderUrl = "<Http://localhost:8080>"
context.target = HttpTestTarget.fromUrl(URL(myProviderUrl))
}
companion object {
@BeforeAll
fun setup() {
System.setProperty("pact.verifier.publishResults", "true")
System.setProperty("pact.provider.version", "1.0.1")
System.setProperty("pact.provider.tag", "master")
}
}
@TestTemplate
@ExtendWith(PactVerificationInvocationContextProvider::class)
fun pactVerificationTestTemplate(context: PactVerificationContext) {
context.verifyInteraction()
}
@Test
@State("given search results")
fun testGetAdverts() {
}
@Test
@State("given searchAgent found")
fun testSearchAgentWasFound() {
}
@Test
@State("given no SearchAgent was found")
fun testNoSearchAgentWasFound() {
}
Yousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Marcello Rigan
05/03/2022, 12:16 PMYousaf Nabi (pactflow.io)
Marcello Rigan
05/03/2022, 12:17 PMYousaf Nabi (pactflow.io)
Marcello Rigan
05/03/2022, 12:20 PMYousaf Nabi (pactflow.io)