-
-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EmptyStackException is thrown after sending Response using SerenityRest.rest() in BeforeClass step #984
Comments
Serenity RestAssured is a wrapper around RestAssured that helps report on REST activity within a test. When you call it outside of a test (i.e. in a @BeforeClass method), there is no test context to interact with. This is why it fails. I could write a patch so that it doesn't fail, but do you expect this REST query to appear in your Serenity reports? |
Thank you for explanations. On the one hand - no, I'm not expecting it to appear in Serenity report. I can add logging and find all necessary information in console output. To sum up my issue - for now I have to create separated query (only with RestAssured class) and log as much information as I can. |
Unfortunately, any steps invoked outside of the test lifecycle cannot appear in the reports (what test would they be associated with?) |
OK :) I understand. Then your proposition:
will be enough solution for me. |
Should be fixed in 1.6.8. |
Hello
In my project I want to in
@BeforeClass
method send post request and get database id from response. Then I want to use this id in all tests in Test class.To do that I'm sending following request:
When I run Test class prepared in that way I receive following exception:
before response status code is checked, but request is executed successfully - prepared data are present in database.
I found source of the problem - is using
SerenityRest.rest()
method to create Response. Without it (by using only RestAssured):whole code is working properly.
To reproduce this situation I prepare project (which is attached to this issue report) based on pom.xml from
serenity-demos/junit-webtests/
project.EmptyStackExceptionTest
class contains code where exception is thrown (usingSerenityRest.rest()
).NoEmptyStackExceptionTest
class contain code without exception (not usingSerenityRest.rest()
).Is there possibility to execute the same request in
@BeforeClass
method as in@Before
and@Test
methods or I have to create separated request for them (as in example project)?I would be grateful for your feedback.
Project to reproduce described problem:
restassured-exception.zip
The text was updated successfully, but these errors were encountered: