Skip to content

Commit 1e1cfa5

Browse files
committed
feat: #213 Provide TestResult assertion helpers documentation
Signed-off-by: Laurent Broudoux <laurent.broudoux@gmail.com>
1 parent fd699ca commit 1e1cfa5

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,23 @@ Java library for Testcontainers that enables embedding Microcks into your JUnit
99
[![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/microcks-uber-image&style=for-the-badge)](https://artifacthub.io/packages/search?repo=microcks-uber-image)
1010
[![CNCF Landscape](https://img.shields.io/badge/CNCF%20Landscape-5699C6?style=for-the-badge&logo=cncf)](https://landscape.cncf.io/?item=app-definition-and-development--application-definition-image-build--microcks)
1111

12+
### Table of Contents
13+
[Build Status](#build-status)
14+
[Community](#community)
15+
[How to use it?](#how-to-use-it)
16+
- [Include it into your project dependencies](#include-it-into-your-project-dependencies)
17+
- [Startup the container](#startup-the-container)
18+
- [Import content in Microcks](#import-content-in-microcks)
19+
- [Using mock endpoints for your dependencies](#using-mock-endpoints-for-your-dependencies)
20+
- [Verifying mock endpoint has been invoked](#verifying-mock-endpoint-has-been-invoked)
21+
- [Launching new contract-tests](#launching-new-contract-tests)
22+
- [Using authentication Secrets](#using-authentication-secrets)
23+
- [Advanced features with MicrocksContainersEnsemble](#advanced-features-with-microckscontainersensemble)
24+
- [Postman contract-testing](#postman-contract-testing)
25+
- [Asynchronous API support](#asynchronous-api-support)
26+
- [Using mock endpoints for your dependencies](#using-mock-endpoints-for-your-dependencies-1)
27+
- [Launching new contract-tests](#launching-new-contract-tests-1)
28+
1229
## Build Status
1330

1431
Latest released version is `0.3.2`.
@@ -169,6 +186,23 @@ public void testOpenAPIContract() throws Exception {
169186

170187
The `TestResult` gives you access to all details regarding success of failure on different test cases.
171188

189+
Since version `0.4.0`, you can also use our `Assertions` helpers to quickly evaluate the `TestResult` details
190+
and get JUnit formatted detailed errors:
191+
192+
```java
193+
// Check global success and get details on all failed test steps for all test cases.
194+
Assertions.assertSuccess(testResult);
195+
// Check operation level success and get details on all failed test steps.
196+
Assertions.assertSuccess(testResult, "GET /pastries/{name}");
197+
// Check operation level success and get details only on this test step.
198+
Assertions.assertSuccess(testResult, "GET /pastries/{name}", "Millefeuille");
199+
200+
// Check operation level failure and get details on all failed test steps.
201+
Assertions.assertFailure(testResult, "GET /pastries/{name}");
202+
// Check operation level failure and get details only on this test step.
203+
Assertions.assertFailure(testResult, "GET /pastries/{name}", "Millefeuille");
204+
```
205+
172206
In addition, you can use the `getMessagesForTestCase()` method to retrieve the messages exchanged during the test.
173207

174208
A comprehensive Spring Boot demo application illustrating both usages is available here: [spring-boot-order-service](https://github.com/microcks/api-lifecycle/tree/master/shift-left-demo/spring-boot-order-service).

0 commit comments

Comments
 (0)