You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
When using Serenity BDD with RestAssured, multiple base classes (e.g., ApiBaseOne and ApiBaseTwo) each set RestAssured.baseURI in their static blocks or constructors. Whichever class loads last overwrites the global baseURI. As a result, tests that expect different base URIs end up failing with 404/405 errors because they are hitting the wrong environment.
Steps to Reproduce:
Create two base classes that each set RestAssured.baseURI in a static initializer.
Run tests that call endpoints from both classes.
Observe that the second base class to load overwrites the baseURI for all subsequent tests.
Expected Behavior:
Each test should be able to use its own environment-specific base URI without being overwritten by another test.
Actual Behavior:
Tests for one API end up hitting the base URI of the other API, leading to HTTP 404 or 405 errors.
Workarounds Tried:
Using <parallel>none</parallel> in the Maven Surefire/Failsafe plugins did not fully resolve the issue.
Attempting to reinitialize RestAssured.baseURI in each test step still leads to overwrites if multiple base classes do the same.
Switching to a per-request RequestSpecification for each API solves the conflict, but a global approach with multiple different base URIs does not appear to be supported.
Environment:
Serenity BDD version: 4.2.16
RestAssured version: 5.3.0
Java 17
Maven 3.8.x
Additional Context:
The problem occurs whenever two different sets of tests require different base URIs in the same test run.
A single global RestAssured.baseURI works if the entire suite uses one environment, but not when multiple base classes each set their own URI.
Suggested Enhancement:
Provide a mechanism in Serenity BDD to handle multiple RestAssured base URIs without global overwrites (e.g., a recommended approach for multiple base classes).
Improve documentation or warnings when multiple classes set RestAssured.baseURI, to guide users toward a per-request or per-base-class specification solution.
What happened?
Description:
When using Serenity BDD with RestAssured, multiple base classes (e.g.,
ApiBaseOne
andApiBaseTwo
) each setRestAssured.baseURI
in their static blocks or constructors. Whichever class loads last overwrites the globalbaseURI
. As a result, tests that expect different base URIs end up failing with 404/405 errors because they are hitting the wrong environment.Steps to Reproduce:
RestAssured.baseURI
in a static initializer.baseURI
for all subsequent tests.Expected Behavior:
Actual Behavior:
Workarounds Tried:
<parallel>none</parallel>
in the Maven Surefire/Failsafe plugins did not fully resolve the issue.RestAssured.baseURI
in each test step still leads to overwrites if multiple base classes do the same.RequestSpecification
for each API solves the conflict, but a global approach with multiple different base URIs does not appear to be supported.Environment:
Additional Context:
RestAssured.baseURI
works if the entire suite uses one environment, but not when multiple base classes each set their own URI.Suggested Enhancement:
RestAssured.baseURI
, to guide users toward a per-request or per-base-class specification solution.What did you expect to happen?
this approach: https://johnfergusonsmart.com/environment-specific-configuration-in-serenity-bdd/
Serenity BDD version
4.2.16
JDK version
17
Execution environment
No response
How to reproduce the bug.
please see above
How can we make it happen?
Work on this myself and propose a PR (with Serenity BDD team guidance)
The text was updated successfully, but these errors were encountered: