Giter Site home page Giter Site logo

wiremock-maven-plugin's Introduction

wiremock-maven-plugin

Central status

Ultra-lightweight, super-simple WireMock Maven Plugin.

Please note the above badge shows current version of WireMock Maven Plugin, not version of WireMock itself. See releases tab for information which WireMock version is used by WireMock Maven Plugin.

Quick start guide

  • Add your mock definitions to the following folders:
src/main/resources/mappings/
src/main/resources/__files/
  • Add plugin to your pom.xml:
<build>
    <plugins>
       <plugin>
          <groupId>uk.co.automatictester</groupId>
          <artifactId>wiremock-maven-plugin</artifactId>          
          <version><!-- check maven central badge above for most recent released version number --></version>
          
          <executions>
             <execution>
                <goals>
                   <goal>run</goal>
                </goals>
                   <configuration>
                      <dir>target/classes</dir>
                      <params>--port=8081 --verbose</params>
                   </configuration>
             </execution>
          </executions>
          
       </plugin>   
    </plugins>
</build>

See WireMock manual for detailed information on available command line options.

  • Run your tests:

mvn clean verify

Maven will copy your resources from src/main/resources/ to target/classes/. Wiremock Maven Plugin will start WireMock on localhost:8081 at pre-integration-test phase and use your mock definitions. Your tests executed at integration-test phase will have mocks ready to use. When Maven process execution finishes, WireMock will be stopped as well.

See pom.xml for a simple example and pom.xml for an example with WireMock extension.

If you want to build most recent version locally:

mvn clean install

If you want to start and stop WireMock manually, but prefer Maven to download it for you, this is how you need to configure your project:

<build>
    <plugins>
        <plugin>
            <groupId>uk.co.automatictester</groupId>
            <artifactId>wiremock-maven-plugin</artifactId>
            <version><!-- check maven central badge above for most recent released version number --></version>
            
            <configuration>
                <keepRunning>true</keepRunning>
                <dir>target/classes</dir>
                <params>--port=8081 --verbose</params>
            </configuration>
        </plugin>
    </plugins>
</build>

Now when you run it with mvn clean compile wiremock:run, you should see the following line in the console output:

[INFO] WireMock will keep running until interrupted manually...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.