test-events-wiremock


License

License

Categories

Categories

Wire Data Data Structures
GroupId

GroupId

nl.stokpop
ArtifactId

ArtifactId

test-events-wiremock
Last Version

Last Version

1.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

test-events-wiremock
test-events-wiremock
Project URL

Project URL

https://github.com/stokpop/test-events-wiremock.git
Source Code Management

Source Code Management

https://github.com/stokpop/test-events-wiremock.git

Download test-events-wiremock

How to add to project

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

Dependencies

runtime (3)

Group / Artifact Type Version
nl.stokpop : event-scheduler jar 3.0.1
org.apache.httpcomponents : httpclient jar 4.5.13
org.apache.httpcomponents : httpmime jar 4.5.13

test (2)

Group / Artifact Type Version
junit : junit jar 4.13.1
com.github.tomakehurst : wiremock jar 2.27.2

Project Modules

There are no modules declared in this project.

test-events-wiremock

Events to load and change wiremock stubs during load tests.

Properties:

  • wiremockFilesDir the directory where to find the wiremock files
  • wiremockUrl the wiremock urls, comma separated
  • useProxy on port 8888, for example to use with fiddler

Custom events:

  • wiremock-change-delay use to change delay of wiremock instances at specific time

Example wiremock response with a dynamic delay:

{
  "request": {
    "method": "GET",
    "url": "/delay"
  },
  "response": {
    "status": 200,
    "body": "Hello world! from Wiremock, with delay :-)",
    "fixedDelayMilliseconds": ${delay},
    "headers": {
      "Content-Type": "text/plain"
    }
  }
}

Put this in a file at in the files dir and it gets uploaded with the specific delay.

Define the delays in a eventSchedulerScript, example in use with events-gatling-maven-plugin:

<eventSchedulerScript>
    PT0S|wiremock-change-delay|delay=400
    PT30S|wiremock-change-delay|delay=4000
    PT1M30S|wiremock-change-delay|delay=8000
</eventSchedulerScript>

This means: set delay to 400 milliseconds at the start of the Gatling load test. Then increase the response time to 4000 milliseconds after 30 seconds. And increase response tim to 8000 milliseconds after 1 minute and 30 seconds.

Use with events-*-maven-plugin

You can use the test-events-wiremock as a plugin of the events-*-maven-plugin by putting the test-events-wiremock jar on the classpath of the plugin.

You can use the dependencies element inside the plugin element.

For example (from example-pom.xml):

<plugin>
    <groupId>nl.stokpop</groupId>
    <artifactId>event-scheduler-maven-plugin</artifactId>
    <configuration>
        <eventSchedulerConfig>
            <debugEnabled>true</debugEnabled>
            <schedulerEnabled>true</schedulerEnabled>
            <failOnError>true</failOnError>
            <continueOnEventCheckFailure>true</continueOnEventCheckFailure>
            <scheduleScript>
                ${eventScheduleScript}
            </scheduleScript>
            <eventConfigs>
                <eventConfig implementation="nl.stokpop.event.wiremock.WiremockEventConfig">
                    <name>WiremockEvent1</name>
                    <wiremockFilesDir>src/test/resources/wiremock-stubs</wiremockFilesDir>
                    <wiremockUrl>http://localhost:9999</wiremockUrl>
                    <useProxy>false</useProxy>
                    <testConfig>
                        <systemUnderTest>${systemUnderTest}</systemUnderTest>
                        <version>${version}</version>
                        <workload>${workload}</workload>
                        <testEnvironment>${testEnvironment}</testEnvironment>
                        <testRunId>${testRunId}</testRunId>
                        <buildResultsUrl>${buildResultsUrl}</buildResultsUrl>
                        <rampupTimeInSeconds>${rampupTimeInSeconds}</rampupTimeInSeconds>
                        <constantLoadTimeInSeconds>${constantLoadTimeInSeconds}</constantLoadTimeInSeconds>
                        <annotations>${annotations}</annotations>
                        <tags>${tags}</tags>
                    </testConfig>
                </eventConfig>
            </eventConfigs>
        </eventSchedulerConfig>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>nl.stokpop</groupId>
            <artifactId>test-events-wiremock</artifactId>
            <version>${test-events-wiremock.version}</version>
        </dependency>
    </dependencies>
</plugin>

You can substitute event-scheduler-maven-plugin by event-gatling-maven-plugin, event-jmeter-maven-plugin and others when available.

Try this by calling:

java -jar wiremock-standalone-[version].jar -v --port 9999

and

mvn -f src/test/resources/example-pom.xml event-scheduler:test

Works with the Stokpop event-scheduler framework:

Versions

Version
1.2.0
1.1.2
1.1.1
1.1.0
1.0.0