How to return a response from Mock-Server and save it to a variable?2019 Community Moderator ElectionGetting raw HTTP response headersHow do I call one constructor from another in Java?How to get an enum value from a string value in Java?How to make mock to void methods with mockitoGroovy HTTPBuilder Mocking the ResponseHow to mock REST service response on the client side?Is there a way to mock backend response for Front End?Mock server responseHow to mock POST request using mock-http-server npm module in nodejs?Mocking a http response in kotlinFor Java testing, should I mock client or mock the server
Synchronized implementation of a bank account in Java
Optimising a list searching algorithm
Help rendering a complicated sum/product formula
When did antialiasing start being available?
Worshiping one God at a time?
gerund and noun applications
Would it be believable to defy demographics in a story?
Bash - pair each line of file
Writing in a Christian voice
World War I as a war of liberals against authoritarians?
What exactly term 'companion plants' means?
What can I do if I am asked to learn different programming languages very frequently?
Geography in 3D perspective
Recruiter wants very extensive technical details about all of my previous work
PTIJ: Why do we blow Shofar on Rosh Hashana and use a Lulav on Sukkos?
What favor did Moody owe Dumbledore?
Could Sinn Fein swing any Brexit vote in Parliament?
Question on point set topology
In what cases must I use 了 and in what cases not?
I seem to dance, I am not a dancer. Who am I?
How to generate binary array whose elements with values 1 are randomly drawn
Generic TVP tradeoffs?
Can other pieces capture a threatening piece and prevent a checkmate?
Can a medieval gyroplane be built?
How to return a response from Mock-Server and save it to a variable?
2019 Community Moderator ElectionGetting raw HTTP response headersHow do I call one constructor from another in Java?How to get an enum value from a string value in Java?How to make mock to void methods with mockitoGroovy HTTPBuilder Mocking the ResponseHow to mock REST service response on the client side?Is there a way to mock backend response for Front End?Mock server responseHow to mock POST request using mock-http-server npm module in nodejs?Mocking a http response in kotlinFor Java testing, should I mock client or mock the server
I am new to API Testing and do not understand mocking responses from API calls so any help would be appreciated.
I have searched for the information online and nothing much is available, it seems except for the mock-server documentation which I am not able to understand much.
I am trying to use Mock-Server to mock the api responses for Get/Put/Post requests for API Testing while the Devs are working on the api developemnet and I do not know how to store the received response in a variable.
What I need to do is to send a request (Get/Post) and receive a response (Body/Header/StatusCode) in a variable so that I can use it for further use (assertions etc)
Anybody having experience around how to use mock-server and can provide an example would be a good help.
I am using Maven/Java/TestNG
java unit-testing mocking mockserver
add a comment |
I am new to API Testing and do not understand mocking responses from API calls so any help would be appreciated.
I have searched for the information online and nothing much is available, it seems except for the mock-server documentation which I am not able to understand much.
I am trying to use Mock-Server to mock the api responses for Get/Put/Post requests for API Testing while the Devs are working on the api developemnet and I do not know how to store the received response in a variable.
What I need to do is to send a request (Get/Post) and receive a response (Body/Header/StatusCode) in a variable so that I can use it for further use (assertions etc)
Anybody having experience around how to use mock-server and can provide an example would be a good help.
I am using Maven/Java/TestNG
java unit-testing mocking mockserver
add a comment |
I am new to API Testing and do not understand mocking responses from API calls so any help would be appreciated.
I have searched for the information online and nothing much is available, it seems except for the mock-server documentation which I am not able to understand much.
I am trying to use Mock-Server to mock the api responses for Get/Put/Post requests for API Testing while the Devs are working on the api developemnet and I do not know how to store the received response in a variable.
What I need to do is to send a request (Get/Post) and receive a response (Body/Header/StatusCode) in a variable so that I can use it for further use (assertions etc)
Anybody having experience around how to use mock-server and can provide an example would be a good help.
I am using Maven/Java/TestNG
java unit-testing mocking mockserver
I am new to API Testing and do not understand mocking responses from API calls so any help would be appreciated.
I have searched for the information online and nothing much is available, it seems except for the mock-server documentation which I am not able to understand much.
I am trying to use Mock-Server to mock the api responses for Get/Put/Post requests for API Testing while the Devs are working on the api developemnet and I do not know how to store the received response in a variable.
What I need to do is to send a request (Get/Post) and receive a response (Body/Header/StatusCode) in a variable so that I can use it for further use (assertions etc)
Anybody having experience around how to use mock-server and can provide an example would be a good help.
I am using Maven/Java/TestNG
java unit-testing mocking mockserver
java unit-testing mocking mockserver
asked Mar 6 at 22:09
amitksamitks
11
11
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
http://www.mock-server.com/ has great documentation.
You can stuff the response code, body, headers, and errors into whatever variable you want (hashset, string, etc.) through URLConnection so long as you want to rebuild the raw response.
But it sounds like you want the raw response, in which case you should see Getting raw HTTP response headers
However, if you want to test APIs, you might want to check out tools like https://www.getpostman.com/
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55032957%2fhow-to-return-a-response-from-mock-server-and-save-it-to-a-variable%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
http://www.mock-server.com/ has great documentation.
You can stuff the response code, body, headers, and errors into whatever variable you want (hashset, string, etc.) through URLConnection so long as you want to rebuild the raw response.
But it sounds like you want the raw response, in which case you should see Getting raw HTTP response headers
However, if you want to test APIs, you might want to check out tools like https://www.getpostman.com/
add a comment |
http://www.mock-server.com/ has great documentation.
You can stuff the response code, body, headers, and errors into whatever variable you want (hashset, string, etc.) through URLConnection so long as you want to rebuild the raw response.
But it sounds like you want the raw response, in which case you should see Getting raw HTTP response headers
However, if you want to test APIs, you might want to check out tools like https://www.getpostman.com/
add a comment |
http://www.mock-server.com/ has great documentation.
You can stuff the response code, body, headers, and errors into whatever variable you want (hashset, string, etc.) through URLConnection so long as you want to rebuild the raw response.
But it sounds like you want the raw response, in which case you should see Getting raw HTTP response headers
However, if you want to test APIs, you might want to check out tools like https://www.getpostman.com/
http://www.mock-server.com/ has great documentation.
You can stuff the response code, body, headers, and errors into whatever variable you want (hashset, string, etc.) through URLConnection so long as you want to rebuild the raw response.
But it sounds like you want the raw response, in which case you should see Getting raw HTTP response headers
However, if you want to test APIs, you might want to check out tools like https://www.getpostman.com/
answered Mar 6 at 22:40
MicromuncherMicromuncher
565317
565317
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55032957%2fhow-to-return-a-response-from-mock-server-and-save-it-to-a-variable%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown