cancel
Showing results for 
Search instead for 
Did you mean: 

Excel and HTML Report with test summary

Highlighted
Contributor

Excel and HTML Report with test summary

Hello,

 

Is there any way After running Test suite I should Have Excel Report, which will list down Test case , test step and Its results(Pass/Fail) in Excel using SOAP UI PRO.

Also, Can I get count of Test cases executed, Passed, failed.

 

Itied to search on forum but at most of the places they have mentioned about using evenets.

 

I will really appreciate if you can share code for it.

 

2 REPLIES 2
Highlighted
Contributor

Re: Excel and HTML Report with test summary

I was able to create this with below code. Use excel or HTML whatever format you like. 

 

Test Step Results along with Failed Assertion list:

import com.eviware.soapui.model.testsuite.Assertable.AssertionStatus

 

def file1

def tcFailedStep

def failedrequest

def request

def tcCreateApplication

def rawResponse

 

def assList

 

 

 if(new File('C:\\APIFramework\\groovy1.txt').exists())

 {

            log.info("----------------------File Exist----------------------")

            file1 = new File('C:\\APIFramework\\groovy1.txt')

           

 }else

 {

            log.info("File Does Not Exist")

            file1 = new File('C:\\APIFramework\\groovy1.txt')

 }

 

def TestCase = testRunner.getTestCase()

def StepList = TestCase.getTestStepList()

 

StepList.each{

  

    if(it.metaClass.hasProperty(it,'assertionStatus')){

        if(it.assertionStatus == AssertionStatus.FAILED)

        {

            tcFailedStep="${it.name}"

            //file1.append "\n Failed Test Case Name = " + tcFailedStep

          file1.append "\n ${it.name} FAIL"

                        tcCreateApplication = TestCase.testSteps["${it.name}"]

                        //log.info context.testCase.getTestStepByName(“CreateApplication”).getProperty(“Request”).getValue()

                        request = tcCreateApplication.testRequest.response.getRequestContent().toString()

                        rawResponse = new String(testRunner.testCase.testSteps["${it.name}"].testRequest.response.rawResponseData)

 

                       

                        file1.append "Request for Failed Test Step" + request

 

                       

           

            tcCreateApplication.getAssertionList().each{

                        if("$it.status" == "FAILED")

                        {

                                    assList =  assList + "$it.label - $it.status" + ","

                                    }

                        }

                       

                        file1.append "\n" + assList

            file1.append "\n" +rawResponse

                        //log.info (rawResponse)

          

        }else if(it.assertionStatus == AssertionStatus.VALID){

            file1.append "\n ${it.name} PASSED"

        }else if(it.assertionStatus == AssertionStatus.UNKNOWN){

            file1.append "\n ${it.name} Not Executed (Disabled)"

        }

    }

}

 

 

  1. Executing Test Case Based on Flag

def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)

 

//"TestData" is my datasource name

def ds = testRunner.testCase.testSteps["TestData_CreateApplication"]

 

def rr = ds.getPropertyValue('RunRow')

 

log.info(rr)

if ( rr == 'Y' ) {

            testRunner.gotoStepByName("GetCountyDetails_SubjectProperty")

} else {

            testRunner.gotoStepByName("DataSource Loop")

}

 

Highlighted
Community Hero

Re: Excel and HTML Report with test summary

Glad you could get it done.

Here is another thread, see if this is helpful in any way?
https://stackoverflow.com/questions/41700437/creating-a-test-report-from-project-level-tear-down-scr...


Regards,
Rao.
New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Want a fun and easy way to learn ReadyAPI and show off your skills? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Compare an expected JSON value and actual response in Events

Participate!

Fetch value/data from JSON response using Groovy Script

See replies!

Filtering data retrieved from a DataSource

See replies!

Get data from Petstore and add it to Excel sheets

Participate!
Top Kudoed Authors