-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Feature] Make Debugging easy for API Testing #19177
Comments
You can set the DEBUG= |
@mxschmitt not really - can we add log=all flag for api testing so that it logs both requests and response along with headers and the time taken by these requests ? |
@mxschmitt no - Can we have both requests and responses logged as well ? like if we have POST request or a PUT request or even with a Get the Response to the console |
I mean the request body and the response body to the console. |
If you want to see more information about api requests, you can use Playwright tracing, there request and response information are attached: https://playwright.dev/dotnet/docs/trace-viewer |
But that is when we use playwright for UI testing but my request is exclusively when we do api testing alone. |
Usually you have assertions, which fail then when something goes wrong. e.g. wrong response body received. Relates #18891 which allows tracing for request api contexts. |
idea is to print a debug log like above how you print the headers in a similar format print both requests and responses. |
Why do we refer to assertions here it doesn't matter when we have chained requests it is very important to look at requests and responses and if we can print them to console it will make life easier for debugging , does that answer the need for this request to be implemented when we print the headers why can't we also print the requests and responses to the console ? |
Usually request and response bodies are very large. Most users dont want to see them, since its cluttering their output. We'll keep this for now open as a feature request to improve debugging for api testing. |
Not every time the requests and response bodies are big and that's the reason I was referring to have a flag to print them to console so that it's up to the one who is debugging it. |
Any new updates on this ? |
I have to agree with @bheemreddy181 - this would be a very useful feature for debugging purposes. |
Also would like to have a better api testing solution baked in the framework. You made UI a breeze now pls add API Testing to the roadmap. At least REST |
@Kranael we already use playwright for API testing right now. Agree they make things more efficient like adding debugging proxy etc for api testing. |
Again if I use specflow as the runnner i can't use the default debug env variable |
I also agree with @bheemreddy181 |
Any new updates on this feature ? |
any updates on this feature w.r.t API testing, please? |
@aslushnikov @mxschmitt it would be great if we can have some similar functionalities of https://github.com/ladjs/supertest for now really looking into extended debugging capabilities |
I agree I think this would be great to have. Ideally have this both for UI and api calls as an reporter that could either print it to console or to file (per test case) |
Would love this feature not just in Debug mode....think about it from this perspective....any time a test fails whether UI or API and the failure happens to be on a APIRequestContext....whats the first thing any dev is going to ask? How did you send the API Request? They will want to see the URL, Headers, Body, Params, etc etc... Being able to toggle this on for those that prefer to have this information output to the console would be a bliss. Dont make it a project toggable...should be an options within APIRequestContext. |
Same would love to have a feature to print the API request's Body and response's Body as currently im using console.log to print the response body every single time after manually converting the response to json. thats 2 lines every time I wish to see the response in the terminal for each tests. |
This is definitely a feature I am waiting for. Could you please add logging of URL, headers, params, body? |
Rather than focus on the logging, would it be possible instead to update the APIRequestContext object to support access of the request URI/headers/body? Alternatively, having an "originalRequest" object available would also be useful, e.g. |
Also it would be cool if the http logs are automatically attached in the test report. |
Can we have an ability to log requests and response with the time taken for the requests along with all headers to console embedded in the code itself may be via flag ?
The text was updated successfully, but these errors were encountered: