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










0















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










share|improve this question


























    0















    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










    share|improve this question
























      0












      0








      0








      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










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 6 at 22:09









      amitksamitks

      11




      11






















          1 Answer
          1






          active

          oldest

          votes


















          0














          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/






          share|improve this answer






















            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
            );



            );













            draft saved

            draft discarded


















            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









            0














            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/






            share|improve this answer



























              0














              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/






              share|improve this answer

























                0












                0








                0







                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/






                share|improve this answer













                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/







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 6 at 22:40









                MicromuncherMicromuncher

                565317




                565317





























                    draft saved

                    draft discarded
















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

                    Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

                    Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved