Forum Discussion

MistaWizard's avatar
MistaWizard
Occasional Contributor
8 years ago
Solved

ajax plugin

Hi all,

 

Is there a way to view the ajax-content inside of soapUI?

 

I'm trying to view the web application but all i can see is the barebone HTML. I'm using REST to login and call the servlet but i see no data from the database this way, this is handled by the java i believe

 

many thanks,

seb

  • Hi,

     

    OK, I think I see what you're looking to do and why you wanted to request the web page in order to trigger the AJAX update.

     

    Like you have described, it would probably be more straight forward to use something like the HTTP Request TestStep to instead directly test the endpoint that the AJAX code calls (presumably the one who's shown in the screen shot) - something like this:

     

    Where you would obviously replace the URL with your one and the posted content with your own. Looks like your AJAX call does:

    Request URL=https://e1.pncie.com/payments/recordFinancialAccount.do

    Method=POST

    Media Type=application/x-www-form-urlencoded

     

    Not sure if there is any security to deal with, but I can make a GET request to that URL with a broswer, so maybe not.

     

    Assuming you can replicate the AJAX POST request like above (with correct request body content), something like this seems a better use of SoapUI than the Groovy / Selenium approach.

     

    Regards,

    Rup

     

     

5 Replies

  • rupert_anderson's avatar
    rupert_anderson
    Valued Contributor

    Hi,

     

    Its quite an interesting idea, but if I'm understanding you right, you're trying to call a web page (that contains some AJAX / client side JavaScript functionality) using a REST request and wanting to see the results of the AJAX script in the response tab? If so, I don't think this would be consistent with any web service behaviour that SoapUI is designed to test. I mean that SoapUI would effectively have to request the HTML page and when the response comes back, allow the AJAX script to execute (from inside the response tab) and request the missing content, thus completing the normal web browing experience.

     

    Instead have you considered using a Groovy TestStep to maybe run some Selenium web driver code to make the request? I think I might have seen posts of people doing stuff like this with SoapUI...

     

    Just my take,

     

    Regards,

    Rupert

    • MistaWizard's avatar
      MistaWizard
      Occasional Contributor

      You are absolutely correct, that what I want.

       

      Thank you, I have played around alot with selenium and soap but was hoping to steer away from selenium just for an ajax call. Looks like I can't though, as i've been trying for a while and google doesnt even know so...

       

      I will have a look at using a groovy step, maybe there is a way to view the data from ajax that way.

      • rupert_anderson's avatar
        rupert_anderson
        Valued Contributor

        OK, no problem, its quite an interesting/unusual usage, but should be possible somehow using Groovy. I only did a quick search, saw this one, not sure if it helps getting you started:

         

        http://stackoverflow.com/questions/30732190/how-to-automate-soap-ui-in-selenium-web-driver

         

        I guess the trick is to, one way or another, invoke a browser session of some sort so that your client side JavaScript (AJAX) is able to execute once the initial page request is complete..

         

        What do you want to do once you suceed with requesting the completed web page? Did you want to do some kind of checks / Assertions on it? Does it tie into some kind of API TestCase?

    • gmm4shu's avatar
      gmm4shu
      Occasional Visitor

      I wanted to get clarification regarding your ajax plugin response. We have an application for which a web page update is requested by client side JavaScript code. Because of its significance to our application, we would like to instrument this request using SOAPUI. With this capability, we could test the update service independently of our application. I have captured the network traffic from when the page update is issued by the application, so that a basis is established from which the SOAPUI test instrumentation could be set up. After some effort, it appears that the HTTPRequest step , if set up properly, should be able to issue the request , so that we can review the response to verify the server side logic associated with the update.

       

      Could you clarify that SOAPUI should be able to provide this test capability ? I tried to extract parameters using the push button, but didn't get a response. Unfortuantely, I don't have anything that comes close to and interface spec for the service, so the network capture (from IE ) is all I have to guide the setup. If I'm on the right track, perhaps there is an example or two that you could point to that would assist in this effort. With what I have done with this so far, I get a response from the server side, but it indicates a 404 error instead of the data we are looking for. We've been able to independently test this interface, to the extent that it appears to work, but the available mechanism(s) are not as convenient as the HTTPRequest test step, which can be easily integrated into an existing test suite of related REST / SOAP interfaces. Thanks in advance For Your help.

      • rupert_anderson's avatar
        rupert_anderson
        Valued Contributor

        Hi,

         

        OK, I think I see what you're looking to do and why you wanted to request the web page in order to trigger the AJAX update.

         

        Like you have described, it would probably be more straight forward to use something like the HTTP Request TestStep to instead directly test the endpoint that the AJAX code calls (presumably the one who's shown in the screen shot) - something like this:

         

        Where you would obviously replace the URL with your one and the posted content with your own. Looks like your AJAX call does:

        Request URL=https://e1.pncie.com/payments/recordFinancialAccount.do

        Method=POST

        Media Type=application/x-www-form-urlencoded

         

        Not sure if there is any security to deal with, but I can make a GET request to that URL with a broswer, so maybe not.

         

        Assuming you can replicate the AJAX POST request like above (with correct request body content), something like this seems a better use of SoapUI than the Groovy / Selenium approach.

         

        Regards,

        Rup