Forum Discussion

hddping's avatar
hddping
New Contributor
7 years ago

Is it possible to render html with groovy script?

When testing my api, I get the response in html format.
I also need to render it, and in the next step I need to test the functionality of the html frame.

  • JHunt's avatar
    JHunt
    Community Hero

    It's not possible with SoapUI alone but look online for how to integrate Selenium with SoapUI.

     

    In that case, Selenium will handle the browser side of your test.

  • nmrao's avatar
    nmrao
    Champion Level 3
    What kind of services are you trying to test? HTTP / Rest or specify if others.
    • hddping's avatar
      hddping
      New Contributor

      nmraowrote:
      What kind of services are you trying to test? HTTP / Rest or specify if others.


      I'm testing Json in the Rest architecture. One of the steps involves getting the html frame.
      On the "clean" GroovyScript this is possible using GroovyServlet. But I do not understand how to run GroovyServlet in SoapUi.
      I see it this way:
      1. Receiving html data
      2. Running with GroovyServlet
      3. Test it with Selenium

  • JHunt's avatar
    JHunt
    Community Hero

    Oh, so when you say you want to render the HTML, do you mean that you want to serve it?

     

    You can do that with a MockService.

     

    Set up a SoapUI MockService that serves an empty response. Then write a Groovy script to get the JSON data which includes some HTML. Then the script should set the MockResponse content to the HTML Then it should start the MockService and start the Selenium test case.