pact-jvm icon indicating copy to clipboard operation
pact-jvm copied to clipboard

running pact provider tests without PactRunner annotation

Open pawel-kaminski-krk opened this issue 5 years ago • 2 comments

hi, I am quite fresh to the library and I must admit that being forced to use @RunWith(PactRunner.class) in order to use pact is a bit ugly and too strong! And yeah! this is just my opinion but I hope some of you agree. :)

I was running through the code and I see that you provide a lot of runners including SpringPactRunner which shows the problem.

I would like to see something like PactRunner.runWith(this) which can initialize pact and generate tests for given pact definition based on given annotation

@Provider("X")
@PactFolder("somewhere")
@VerificationReports(value={"console", "markdown"}, reportDir="build/pacts")

Now I have lots of conflicts with my existing setup and I have to move pact to separate directory and hack my service configuration.

I think providing such functionality would make pact integration with any code much cleaner. and existing runners could just call same code adding its logic on top of that.

If I missed it, please point me to some examples or source code or lets talk how to improve pact for jvm. thanks.

pawel-kaminski-krk avatar May 17 '19 09:05 pawel-kaminski-krk

and giving it more though I think that probably such integration should work more as parametrised test generator rather than whole runner

pawel-kaminski-krk avatar May 17 '19 10:05 pawel-kaminski-krk

JUnit 5 supports this using the test extensions, so having the single runner is no longer necessary. I am hesitant to do any work with JUnit 4 as JUnit 5 is the platform going forward.

uglyog avatar Jun 01 '19 07:06 uglyog