WireMock groovy

WireMock api for groovy

Лицензия

Лицензия

Категории

Категории

Groovy Языки программирования Wire Данные Data Structures
Группа

Группа

com.github.tomjankes
Идентификатор

Идентификатор

wiremock-groovy
Последняя версия

Последняя версия

0.2.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

WireMock groovy
WireMock api for groovy
Ссылка на сайт

Ссылка на сайт

https://github.com/tomjankes/wiremock-groovy
Система контроля версий

Система контроля версий

https://github.com/tomjankes/wiremock-groovy

Скачать wiremock-groovy

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.tomjankes/wiremock-groovy/ -->
<dependency>
    <groupId>com.github.tomjankes</groupId>
    <artifactId>wiremock-groovy</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.tomjankes/wiremock-groovy/
implementation 'com.github.tomjankes:wiremock-groovy:0.2.0'
// https://jarcasting.com/artifacts/com.github.tomjankes/wiremock-groovy/
implementation ("com.github.tomjankes:wiremock-groovy:0.2.0")
'com.github.tomjankes:wiremock-groovy:jar:0.2.0'
<dependency org="com.github.tomjankes" name="wiremock-groovy" rev="0.2.0">
  <artifact name="wiremock-groovy" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.tomjankes', module='wiremock-groovy', version='0.2.0')
)
libraryDependencies += "com.github.tomjankes" % "wiremock-groovy" % "0.2.0"
[com.github.tomjankes/wiremock-groovy "0.2.0"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
org.codehaus.groovy : groovy-all jar 2.4.3
org.apache.httpcomponents : httpclient jar 4.4

test (4)

Идентификатор библиотеки Тип Версия
ch.qos.logback : logback-core jar 1.1.3
ch.qos.logback : logback-classic jar 1.1.3
org.spockframework : spock-core jar 1.0-groovy-2.4
com.github.tomakehurst : wiremock jar 1.54

Модули Проекта

Данный проект не имеет модулей.

Wiremock groovy

Build Status Maven Central

What it is

I love WireMock and use it extensively in integration tests. I also love how Spock allows to write very readable and clean tests. This project aims to create more suitable groovy API, that will allow more concise stubbing and verifying syntax in integration tests written in groovy/spock using WireMock, without using WireMock's default static imports API.

What it does

Currently there is only extremely thin wrapper for Wire Mock REST API, that is exposed as raw json builder. Examples of what can be currently achieved:

Stubbing

@Rule
WireMockRule wireMockRule = new WireMockRule()

def wireMockStub = new WireMockGroovy()

def "some integration test that tests feature using external REST resource" () {
    given:
    wireMockStub.stub {
        request {
            method "GET"
            url "/some/thing"
        }
        response {
            status 200
            body "Some body"
            headers {
                "Content-Type" "text/plain"
            }
        }
    }
    ...
}

Verifying

Verifying can be achieved by querying for count of matching requests that have been sent to WireMock server.

@Rule
WireMockRule wireMockRule = new WireMockRule()

def wireMockStub = new WireMockGroovy()

def "example verifying test" () {
    ...
    then:
    1 == wireMockStub.count {
        method "GET"
        url "/some/url"
    }
}

def "test using groovy truth if you need at least one request and shows example matcher" () {
    ...
    then:
    wireMockStub.count {
        method "POST"
        url "/some/url"
        headers {
            "Content-Type" {
                matches ".*xml"
            }
        }
    }
}

##Contribution

Project is in very early stage, pull requests and ideas in form of feature requests are welcome.

Building

  • Clone the repository
  • Run ./gradlew clean build (on Linux/Mac) or gradlew.bat build (on Windows)

Licence

Apache Licence v2.0 (see LICENCE.txt)

Версии библиотеки

Версия
0.2.0
0.1.1
0.1.0