PACT provider verification with SpringBoot and @WebIntegrationTest

942 views
Skip to first unread message

William Keller

unread,
Jun 22, 2015, 8:36:38 PM6/22/15
to pact-s...@googlegroups.com
Hi,
  We've been trying to use Pact provider testing with SpringBoot (using @WebIntegration). The purpose for us doing this is that we want to verify the PACT file during the test phase of Maven, and not after project has been deployed (as we have been resorting to in the meantime). The beauty of SpringBoot is that during the test phase it runs the entire project (REST API's) for direct testing with the RESTful endpoints which can be accessed from JUnit tests. Does anyone have any experience with this scenario they can share? The last attempt I made was with the SpringMVC version (pact-jvm-provider-spring-mvc), however it was not immediately clear how we could go about this. Any help would be appreciated.

Cheers

Ronald Holshausen

unread,
Jun 22, 2015, 11:43:50 PM6/22/15
to William Keller, pact-s...@googlegroups.com
Hi William,

I have created a maven plugin that should be able to help. Have a look at https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider-maven. You should be able to get the verify running in the test phase so that you can take advantage of the springboot starting up and shutting the app down.

This email is confidential and intended solely for the person(s) to whom it is addressed.

--
You received this message because you are subscribed to the Google Groups "Pact" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pact-support...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Ronald Holshausen

DiUS Computing Pty Ltd

Level 10, 99 Queens Street
Melbourne, VIC 3000

Phone: +61 3 9008 5400
Mobile: +61 413 162 439

http://www.diuscomputing.com.au

Neeraja Potluri

unread,
Sep 14, 2016, 8:54:01 PM9/14/16
to Pact, william...@industrieit.com
Does this apply to gradle plugin also?

Could you please help and show how to configure pactVerify in gradle plugin to run in integration-test phase because that is when springboot app starts up?
Thanks

Ronald Holshausen

unread,
Sep 14, 2016, 9:32:49 PM9/14/16
to Neeraja Potluri, Pact, william...@industrieit.com
The integration test phase is a Maven concept. Gradle does not have phases like that, it just has tasks of different types.

Andrew Fitzgerald

unread,
Oct 13, 2016, 4:59:35 PM10/13/16
to Pact, william...@industrieit.com
I'm late to the party, but I've had some luck using pact-jvm-provider-junit provider instead of pact-jvm-provider-spring-mvc to run a full integration test.

Unfortunately I couldn't get the Pact runner to play nice with the JunitRunner, so I had to do some of the Spring context management manually.
See the gist below for the magical incantations necessary to get it running.
Reply all
Reply to author
Forward
0 new messages