Forum Discussion

Praveen_Dsouza's avatar
Praveen_Dsouza
Occasional Contributor
17 years ago

Creating an HTML file in Groovy Script

Hi,
I want to add the "Success" or "Failure" message for each operation (Test Case) in a HTML file. I am trying to create this in a Groovy Script.
I am already creating the txt files in the Groovy Script which will contain the Request & Response.
Please let me know me how to create the HTML file with "Success" or "Failure" messages contained within for each test case. Please respond. Any response will be appreciated (even a question to understand it better).
Thanks, Praveen.
  • Praveen_Dsouza's avatar
    Praveen_Dsouza
    Occasional Contributor
    Thanks so much for the response. I know how to create a simple HTML file in Groovy Script. The only thing I want to know is how to get the "success" or "failure" message which is the result of the operations or TestCases. I tried response.getStatusCode() but this does not perform the necessary task. May be I need to fetch the assertion value but I don't know how to do that. Below code shows the file generation code; where 'bw' is "BufferedWriter" object. Please reply..

    bw.write("-------------------STATUS CODE---------------------");
    bw.newLine();
    bw.newLine();
            bw.write("");
    bw.write(httpResponse.getStatusCode());
          bw.write("");
    bw.newLine();
    bw.newLine();
    bw.write("-------------------STATUS CODE---------------------");
  • Praveen_Dsouza's avatar
    Praveen_Dsouza
    Occasional Contributor
    Thanks for the response. I have 18 WebService operations (TestCases). I have 18 Groovy Scripts. I run these test cases through the PustToTest. I am trying to create 1 HTML report which will contain "Success" and "Failure" messages as shown in the screen shot (from Pro Version). I am using free version Soap UI 2.5.1
    Please let me know if there is an easy way of creating such an HTML along with the SUCCESS & FAILURE messages for each test case. Please provide a code snippet to arrive at SUCCESS or FAILURE using "testRunner.status" or "def results = testRunner.results"
    Please excuse me if I seem ignorant, I am new to Soap UI.