Rerun Postman Test without re-submiting the API Request - debugging

Is it possible to rerun the tests created in the post response test without
resubmitting the request?
For example you submit an API request in Postman, then it comes back with
some data.
I want to just re-run the scripts against this data.
Could be really useful in debugging these post-response scripts.
I want to rerun Tests in area 1 without hitting the Send button
(area 2). That way I can test the javascript correctness of my Test scripts without having to wait for server responses.

You can use https://postman-echo.com/post and their API will echo the request you send. So basically you create the actual request once and then use the result in the ECHO call to do the development.
More info here:
https://docs.postman-echo.com/?version=latest
I'm afraid there is no better way at the moment.

I was looking for the same thing and came across this tip on the PostMan Community.
https://community.postman.com/t/re-run-test-script-without-re-sending-request/9160/8
Basically you:
Make your request
Save your response as an example
Create a PostMan mock from that response
Rerun and build up your test against the mock (and any variants, like failure cases)
Run against the original and verify everything is good.
While this workaround helps get the job done, I do wish that they could just make it so that you could hold the original state of the response and the env, run your tests, reset to the original state, rerun your tests and tweak until it all works.

You can write test entire test or the part you want to execute twice in a function and call that function 2 times, that the easy and low effort and maintenance way I am looking

Related

Can Charles map incoming request using saved session?

In my team, QA will test the application, if there's a bug, QA will record a charles session and provide the file to developer.
Now as a developer, I want to quickly reproduce the bug. Currently what I do is manually save the response, then use the "map local" tool to create a "map local" relationship between the request and response.
But it's tedious and cumbersome if there're multiple requests I need to mock. I'm thinking is it possible just simply tell charles, "hey charles, Use the current recorded session as source, if any future request match one of the recorded request, just use the recorded response. if none request match, let it pass through".
Then when I get a charles session file, it'll be very easy for me the set up the mock response. I can start troubleshooting the bug in just seconds.
I'm not sure if this can help but basically, if QAs spot any bugs, they can use the "export flow" feature and then share with you these exported files. When you import such files, you would be able to reproduce quickly without setting up as the request/ response have already been saved.
However the tool I'm using is Proxyman instead of Charles. You can find the detail instruction at
https://proxyman.io/blog/2019/07/How-I-use-Proxyman-to-report-bugs-more-effectively.html. Hope it helps!

Is there any way to start with a POST request using Selenide

I'm trying to start a Selenide test with a POST request to my application.
Instead of a simple open(/startpoint)
I would like to do something like open(/startpoint, stuff=foo,stuff2=bar)
Is there any way to do that?
I'm asking this because the original page which posts to this start point depends on external providers that are often offline (development environment) and so will often fail too early (and are not the subject of the test)
No, Selenium doesn't have the ability to do a POST request, unless you loaded a dummy HTML page with a <form> tag on it (as a unit test) and a submit button (such as src/test/resources/FormPage.html). So, the alternative is to build a HTTP post query from scratch using Apache HttpUtils library. I usually use the latter method (as an integration test), although the former would work I think.

Facebook tests users with user to user requests

I asked this question last week but only got 8 views.
A part of the application I'm working on requires creating a ton of user-to-user requests and validating they all get processed correctly in the application. This requires countless hours of QA work and could be automated with a simple script like
users_api = Koala::Facebook::TestUsers.new(config)
users = test_users.create_network(10, true, "email,user_likes,publish_actions")
users.permutations(2) do |u1, u2|
graph = Koala::Facebook::API.new(u1['access_token'])
requests_types.each do |req|
graph # .user_to_user_request(u2, req) Oh noes I can't do this part
end
end
Everything I've seen points to the fact that it's impossible to create user-to-user requests in a script, even for test users. Is there any other (automated) way to do this?
Edit
What I'm trying to find is a way to create user-to-user requests. The validation would still be manual by the QA team. The problem we're facing is that they need to create 90 requests and make sure they didn't skip a single one, then validate the data.
Solution to this is tricky one. You probably have two solutions, depending on what you need.
First one is to manually provide access tokens for tests. That would require creating several fictional users or gathering access tokens from friends via Api Explorer. This is of course very inconvenient, but probably needed for second idea so I'm mentioning it. The question is how much users will you need to test? In most situations 3-4 users should be enough to provide test case.
Second idea will require actually running tests suite once using first idea and recording results using gems like webmock or fakeweb. This will allow you to remember what API response will serve and using it in later tests without need to regenerate tokens. This should also speed up your tests significantly as will avoid waiting for each request from FB API.

Block specific AJAX requests with browser or OS

I'm trying to test a product to make sure it fails correctly and therefore want to be able to block a specific AJAX request from returning any data. I could modify the source to make the request fail but I have to prove it works without changing the code.
How could I go about blocking a specific url from returning data?
This might help - its a fire fox plugin - have not tried it but it looks good - it says it allows you to edit and alter requests- addons.mozilla.org/en-US/firefox/addon/tamper-data

Will selenium record firebug and tamper data manipulations?

I am writing an automated test script. So far, Selenium has helped me. Now,I have a test case where I should tamper the request and add a parameter and then submit the request. I did it manually by using tamperdata.
I want to automate this test case now. The problem is, selenium is not recording my actions of adding a parameter and then submitting the request. I understand selenium is a record-playback kind of tool. can some one confirm me if it cannot record tamper data or am doing wrong?
If it cannot, how do you people automate these kind of test cases.
Selenium really is not designed for such a type of work. If a regular user can't make a tampered request (without Firebug etc.), then Selenium usually can't, too. Anyway, you can have FireBug: How do I run Firebug within Selenium WebDriver (Selenium 2)?. Controlling it, that's where the problems come - and I don't think it's worth the research.
One way to do this could be HttpUrlConnection in Java, making and sending the request in Java ... see those SO questions: How to send HTTP request in java?, Using java.net.URLConnection to fire and handle HTTP requests

Resources