citrusframework / citrusframework/citrus

Extract is called before validate in http requests

Open
#930 2 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Java
Stars
485
Forks
155
Avg merge
4d 22h
Merged PRs (30d)
6

Description

**Citrus Version**
3.4.0

**Expected behavior**
Validate should be called first, otherwise the error message is confusing.

**Actual behavior**
extract is failing before validate is failing

**Test case sample**

First example: is failing because status code is wrong (error message is fine)
```
testRunner.run(http()
.client(myClient)
.send()
.post("/path"))
.message()
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.body(new ClassPathResource("whatever.json")));
testRunner.run(http()
.client(myClient)
.receive()
.response(HttpStatus.OK)
.message()
.type(MessageType.JSON);
```

Second example is failing in extract method instead of validate
```
testRunner.run(http()
.client(myClient)
.send()
.post("/path"))
.message()
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.body(new ClassPathResource("whatever.json")));
testRunner.run(http()
.client(myClient)
.receive()
.response(HttpStatus.OK)
.message()
.type(MessageType.JSON)
.extract(JsonPathSupport.jsonPath().expression("$.id", ${myId}"));
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.