.net-corepact-netpactflow

How to publish pact to Pactflow .NET Core PactNet v4.5


I'm writing Pac testing POC for my project. I wrote consumer test, got pact file and try to publish it to PactFlow (we have Pactflow Enterprise - Cloud subscription). The problem is in PactFlow docs here https://docs.pactflow.io/ I see code example:

//Pact Publisher options var pactPublisher = new PactPublisher("http://<YOUR_BROKER>.pactflow.io", new PactUriOptions("<TOKEN>")); pactPublisher.PublishToBroker("/pact/to/pacts/dir", Environment.GetEnvironmentVariable("GIT_COMMIT"));

But there is no PactPublisher class in PactNet, I looked at source code https://github.com/pact-foundation/pact-net and in master and in release 4.x branches I don't see PactPublisher class

Is it possible to publish pact to PactFlow from .NET project? If yes, can anybody share publishing code, please. (another approach like CLI or github actions I didn't try yet, I'm on POC stage, I just want to make it work with one simple test for now).

Thanks in advance

I tried code from official documentation. Expected - code works, actual - it can't work, there is no such class in library


Solution

  • The PactPublisher class is deprecated now github link for pact doc

    There are multiple ways to publish pact contract to pact flow now. Some of the common one are:

    I have tried to establish pact publish and verification process using their APIs and library. Below is an article for it with explanation and sample code repository as well. https://medium.com/@ajaykumar1807/intro-to-pact-for-net-core-integration-with-pactflow-3e159388874c