Skip to content

Commit 513dbad

Browse files
committed
WireMock: document and mention in NEWS.txt
No functional changes. [ci skip]
1 parent 0c99160 commit 513dbad

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

NEWS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- (functionality) add support for specifying Zagorski catalog numbers
2323
- (functionality) user may specify how many stamps from a series in his/her collection
2424
- (functionality) paid users may specify a price that he/she paid for a series
25+
- (infrastructure) use WireMock in integration tests for mocking external services
2526

2627
0.3
2728
- (functionality) implemented possibility to user to add series to his collection

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ If you are programmer/sysadmin or you just feeling that you are able to run a lo
4545
* *Validation*: JSR-303 (Hibernate Validator)
4646
* *Logging*: Slf4j (Logback)
4747
* *Unit tests*: Groovy and Spock Framework (for Java code), jasmine (for JavaScript code)
48-
* *Integration tests*: Selenium2, RobotFramework, TestNG and fest-assert
48+
* *Integration tests*: Selenium2, RobotFramework, WireMock, TestNG and fest-assert
4949
* *Others*: Lombok, Togglz, WebJars

docs/wiremock.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# WireMock
2+
3+
## What and why
4+
WireMock is a simulator for HTTP-based APIs. We use this tool in the integration tests for mocking
5+
external services. For example, for testing import of the stamps series from sites.
6+
7+
## Running on TravisCI
8+
WireMock is automatically running/stopping during integration tests execution (`mvn verify`).
9+
10+
## Running manually
11+
In order to run the server as a standlone process:
12+
* uncomment `<keepRunning>` option in the `pom.xml` file
13+
* execute the `mvn wiremock:run` command
14+
15+
After that the mock server will be available on 8888 port.
16+
17+
## Troubleshooting
18+
* [run the plugin separately](#running-manually) to be able to test it with a browser/curl
19+
* append `--verbose` flag to the options from `<params>` tag in the `pom.xml` file. This instructs
20+
WireMock to produce more detailed output to the console
21+
22+
## Configuration
23+
WireMock is fully configured by the `wiremock-maven-plugin` in the `pom.xml` file:
24+
25+
* the server is listening on `8888` port
26+
* you can refer to the mock server from within RobotFramework test cases by using `${MOCK_SERVER}`
27+
variable.
28+
* static files are reside inside the `src/test/wiremock/__files` directory
29+
* mocks and stubs are reside inside the `src/test/wiremock/mappings` directory
30+
31+
By our convention the files in these directories should have the same hierarchy as their
32+
RobotFramework test cases. For instance, the mocks/files used solely by
33+
`category/creation/logic.robot` test case, should be placed into
34+
`src/test/wiremock/__files/category/creation/logic` and
35+
`src/test/wiremock/mappings/category/creation/logic` directories.
36+
37+
In the case, mocks/files are being used by the different test cases, they should reside in a
38+
directory that is the base for all such test cases.
39+
40+
## Links
41+
* http://wiremock.org/
42+
* https://github.com/tomakehurst/wiremock
43+
* https://github.com/automatictester/wiremock-maven-plugin

0 commit comments

Comments
 (0)