citrusframework / citrusframework/citrus

Inconsistent request types in waitFor().http() and waitFor().execution().action()

Open
#564 0 comments 0 reactions 0 assignees View on GitHub
bug prio-low
Dominant language
Java
Stars
485
Forks
155
Avg merge
2d 10h
Merged PRs (30d)
7

Description

**Citrus Version**
2.7.8

**Expected behavior**
When I wait for a http server via `waitFor().http()` and `waitFor().execution().action()`, I expect them to request the server with the same http request method.

**Actual behavior**
```java
waitFor()
.execution()
.action(send(server))
```
requests with `POST`

```java
waitFor()
.http()
.url(server)
```
requests with `HEAD`

**Test case sample**
Both tests turn green, while expecting different HTTP methods on the server side.

*These tests can be found in the file `WaitTestRunnerIT` after #547 has been merged. Until then: e45e1071dbce485a0f5a13e863cfae751978d120*
```java
@CitrusTest
public void waitHttpAsAction() {

//GIVEN
String server = String.format("http://localhost:%s", serverPort);
httpServer.setPort(serverPort);
start(httpServer);

parallel().actions(
sequential().actions(
//WHEN
waitFor()
.execution()
.action(send(http -> http.endpoint(server)))
),
sequential().actions(
//THEN
http(http -> http.server(httpServer).receive().post()),
http(http -> http.server(httpServer).respond(HttpStatus.NOT_FOUND)),
http(http -> http.server(httpServer).receive().post()),
http(http -> http.server(httpServer).respond(HttpStatus.OK))
)
);

doFinally().actions(stop(httpServer));
}

@CitrusTest
public void waitHttp() {

//GIVEN
String server = String.format("http://localhost:%s", serverPort);
httpServer.setPort(serverPort);
start(httpServer);

parallel().actions(
sequential().actions(
//WHEN
waitFor()
.http()
.url(server)
),
sequential().actions(
//THEN
http(http -> http.server(httpServer).receive().head()),
http(http -> http.server(httpServer).respond(HttpStatus.NOT_FOUND)),
http(http -> http.server(httpServer).receive().head()),
http(http -> http.server(httpServer).respond(HttpStatus.OK))
)
);

doFinally().actions(stop(httpServer));
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the WaitTestRunnerIT tests described in the issue, using commit e45e1071dbce485a0f5a13e863cfae751978d120 if #547 is not merged. Compare the requests produced by waitFor().http() and waitFor().execution().action(send(...)), then run the two test cases. Done means both paths use the same HTTP request method and the server-side expectations pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.