Versions of artifact au.com.dius:pact-jvm-consumer-groovy_2.11

pact-jvm-consumer-groovy_2.11

pact-jvm-consumer-groovy ========================= Groovy DSL for Pact JVM ## Dependency The library is available on maven central using: * group-id = `au.com.dius` * artifact-id = `pact-jvm-consumer-groovy_2.11` * version-id = `3.5.x` ## Usage Add the `pact-jvm-consumer-groovy` library to your test class path. This provides a `PactBuilder` class for you to use to define your pacts. For a full example, have a look at the example JUnit `ExampleGroovyConsumerPactTest`. If you are using gradle for your build, add it to your `build.gradle`: dependencies { testCompile 'au.com.dius:pact-jvm-consumer-groovy_2.11:3.5.0' } Then create an instance of the `PactBuilder` in your test. ```groovy import au.com.dius.pact.consumer.PactVerificationResult import au.com.dius.pact.consumer.groovy.PactBuilder import groovyx.net.http.RESTClient import org.junit.Test class AliceServiceConsumerPactTest { @Test void "A service consumer side of a pact goes a little something like this"() { def alice_service = new PactBuilder() // Create a new PactBuilder alice_service { serviceConsumer "Consumer" // Define the service consumer by name hasPactWith "Alice Service" // Define the service provider that it has a pact with port 1234 // The port number for the service. It is optional, leave it out to // to use a random one given('there is some good mallory') // defines a provider state. It is optional. uponReceiving('a retrieve Mallory request') // upon_receiving starts a new interaction withAttributes(method: 'get', path: '/mallory') // define the request, a GET request to '/mallory' willRespondWith( // define the response we want returned status: 200, headers: ['Content-Type': 'text/html'], body: '"That is some good Mallory."' ) } // Execute the run method to have the mock server run. // It takes a closure to execute your requests and returns a PactVerificationResult. PactVerificationResult result = alice_service.runTest { def client = new RESTClient('http://localhost:1234/') def alice_response = client.get(path: '/mallory') assert alice_response.status == 200 assert alice_response.contentType == 'text/html' def data = alice_response.data.text() assert data == '"That is some good Mallory."' } assert result == PactVerificationResult.Ok.INSTANCE // This means it is all good } } ``` After running this test, the following pact file is produced: { "provider" : { "name" : "Alice Service" }, "consumer" : { "name" : "Consumer" }, "interactions" : [ { "provider_state" : "there is some good mallory", "description" : "a retrieve Mallory request", "request" : { "method" : "get", "path" : "/mallory", "requestMatchers" : { } }, "response" : { "status" : 200, "headers" : { "Content-Type" : "text/html" }, "body" : "That is some good Mallory.", "responseMatchers" : { } } } ] } ### DSL Methods #### serviceConsumer(String co

Artifact Version Name Latest uploaded at
3.5.0-jre7.1 pact-jvm-consumer-groovy_2.11 2017-06-24 13:12:55 UTC
3.5.0-jre7 pact-jvm-consumer-groovy_2.11 2017-06-24 11:23:04 UTC
3.5.0 pact-jvm-consumer-groovy_2.11 2017-06-24 08:07:50 UTC
3.5.0-rc.3 pact-jvm-consumer-groovy_2.11 2017-06-20 23:37:45 UTC
3.5.0-rc.2 pact-jvm-consumer-groovy_2.11 2017-06-11 07:07:01 UTC
3.4.1 pact-jvm-consumer-groovy_2.11 2017-06-11 01:59:21 UTC
3.5.0-rc.1 pact-jvm-consumer-groovy_2.11 2017-05-25 03:39:08 UTC
3.4.0 pact-jvm-consumer-groovy_2.11 2017-05-18 05:35:09 UTC
3.3.10 pact-jvm-consumer-groovy_2.11 2017-05-18 03:58:57 UTC
3.5.0-beta.4 pact-jvm-consumer-groovy_2.11 2017-05-14 11:45:52 UTC
3.3.9 pact-jvm-consumer-groovy_2.11 2017-05-08 11:26:01 UTC
3.3.8 pact-jvm-consumer-groovy_2.11 2017-04-14 03:51:26 UTC
3.3.7 pact-jvm-consumer-groovy_2.11 2017-03-27 04:33:27 UTC
3.5.0-beta.3 pact-jvm-consumer-groovy_2.11 2017-02-05 05:54:35 UTC
3.3.6 pact-jvm-consumer-groovy_2.11 2017-01-26 06:36:45 UTC
3.3.5 pact-jvm-consumer-groovy_2.11 2017-01-14 06:47:49 UTC
3.3.4 pact-jvm-consumer-groovy_2.11 2017-01-04 05:00:44 UTC
2.4.18 pact-jvm-consumer-groovy_2.11 2016-12-30 01:39:31 UTC
3.3.3 pact-jvm-consumer-groovy_2.11 2016-11-06 03:43:41 UTC
2.5.0-beta.0 pact-jvm-consumer-groovy_2.11 2016-10-22 12:52:22 UTC
3.3.2 pact-jvm-consumer-groovy_2.11 2016-10-22 08:54:51 UTC
2.4.17 pact-jvm-consumer-groovy_2.11 2016-10-22 06:53:26 UTC
3.3.1 pact-jvm-consumer-groovy_2.11 2016-10-02 03:46:50 UTC
2.4.16 pact-jvm-consumer-groovy_2.11 2016-10-01 21:30:16 UTC
3.5.0-beta.2 pact-jvm-consumer-groovy_2.11 2016-09-21 12:33:56 UTC
3.3.0 pact-jvm-consumer-groovy_2.11 2016-09-07 10:48:32 UTC
3.5.0-beta.1 pact-jvm-consumer-groovy_2.11 2016-08-28 11:15:26 UTC
2.4.15 pact-jvm-consumer-groovy_2.11 2016-08-23 12:46:55 UTC
3.2.13 pact-jvm-consumer-groovy_2.11 2016-08-14 01:48:47 UTC
3.2.12 pact-jvm-consumer-groovy_2.11 2016-08-07 04:35:19 UTC