Forum Discussion

omerabr's avatar
omerabr
Occasional Contributor
14 years ago

Generate JUnit report after project run

Hi All,

I am trying to generate a single-page JUnit style project report (same option as exist in GUI) using Groovy . I should generate the report after the project finished..(i will use the AfterRun event).

Can someone please assist with a code snippet for that? it should be a single HTML (JUnit-style). no further customization is needed, the default template is fine.

Thanks a lot!

13 Replies

  • Hi,

    thanks - can you show the complete output of the testrunner? If this is a bug we might be able to fix it in a nightly build...

    Regarding your question; no, the testrunner can not be invoked just to generate the reports (since it needs to run the tests to have something to report on)

    regards,

    /Ole
    SmartBear Software
  • omerabr's avatar
    omerabr
    Occasional Contributor
    see below it starts directly with the TestRuListener.afterstep event:


    Running soapUI TestRunner for [Uniform13_Rest_Tests]
    directory: C:\Program Files\SmartBear\soapUI-Pro-4.5.1\bin\.
    command: cmd.exe /C testrunner.bat -EDefault "C:\Documents and Settings\omera\Desktop\GroovyProj\23-07\Uniform13_Rest_Tests_groovy.xml"
    soapUI Pro 4.5.1 TestCase Runner
    Configuring log4j from [C:\Program Files\SmartBear\soapUI-Pro-4.5.1\bin\soapui-log4j.xml]
    14:27:56,128 INFO [SoapUI] Adding [C:\Program Files\SmartBear\soapUI-Pro-4.5.1\bin\ext\ant.jar] to extensions classpath
    14:27:56,144 INFO [SoapUI] Adding [C:\Program Files\SmartBear\soapUI-Pro-4.5.1\bin\ext\fbapi4j-0.5.jar] to extensions classpath
    14:27:56,144 INFO [SoapUI] Adding [C:\Program Files\SmartBear\soapUI-Pro-4.5.1\bin\ext\jna.jar] to extensions classpath
    14:27:56,144 INFO [SoapUI] Adding [C:\Program Files\SmartBear\soapUI-Pro-4.5.1\bin\ext\postgresql-8.3-604.jdbc3.jar] to extensions classpath
    14:27:56,144 INFO [SoapUI] Adding [C:\Program Files\SmartBear\soapUI-Pro-4.5.1\bin\ext\postgresql-8.3-604.jdbc4.jar] to extensions classpath
    14:27:56,144 INFO [SoapUI] Adding [C:\Program Files\SmartBear\soapUI-Pro-4.5.1\bin\ext\sqljdbc4.jar] to extensions classpath
    14:27:57,268 INFO [DefaultSoapUICore] initialized soapui-settings from [C:\Documents and Settings\omera\soapui-settings.xml]
    14:27:59,737 WARN [SoapUIProGroovyScriptEngineFactory] Missing scripts folder [C:\Program Files\SmartBear\soapUI-Pro-4.0.1\bin\scripts]
    14:27:59,737 INFO [DefaultSoapUICore] Adding listeners from [C:\Program Files\SmartBear\soapUI-Pro-4.5.1\bin\listeners\demo-listeners.xml]
    14:28:03,955 INFO [WsdlProject] Loaded project from [file:/C:/Documents%20and%20Settings/omera/Desktop/GroovyProj/23-07/Uniform13_Rest_Tests_groovy.xml]
    14:28:05,689 WARN [SoapUIProGroovyScriptEngineFactory] Missing scripts folder [C:\Program Files\SmartBear\soapUI-Pro-4.0.1\bin\scripts]
    14:28:07,501 INFO [SoapUIProTestCaseRunner] Running soapUI tests in project [Uniform13_Rest_Tests]
    14:28:07,501 INFO [SoapUIProTestCaseRunner] Running Project [Uniform13_Rest_Tests], runType = SEQUENTIAL
    14:28:07,579 INFO [SoapUIProTestCaseRunner] Running soapUI testcase [01.StartRODByAgent]
    14:28:07,579 INFO [SoapUIProTestCaseRunner] running step [Login]
    14:28:09,016 DEBUG [HttpClientSupport$SoapUIHttpClient] Attempt 1 to execute request
    14:28:09,016 DEBUG [SoapUIMultiThreadedHttpConnectionManager$SoapUIDefaultClientConnection] Sending request: GET /REST/CallManager/Login HTTP/1.1
    14:28:09,016 DEBUG [SoapUIMultiThreadedHttpConnectionManager$SoapUIDefaultClientConnection] Receiving response: HTTP/1.1 200 OK
    14:28:09,032 DEBUG [HttpClientSupport$SoapUIHttpClient] Connection can be kept alive indefinitely
    14:28:12,062 INFO [log] [AfterTestStep Event]-Test Case Name: 01.StartRODByAgent
    14:28:12,062 INFO [log] [AfterTestStep Event] - folder set to: c:/soap/2012-07-23-Rest_CLSAPI Service/01.StartRODByAgent/
    14:28:12,062 INFO [log] [AfterTestStep Event]-Creating new folder: c:/soap/2012-07-23-Rest_CLSAPI Service/01.StartRODByAgent/
    14:28:12,094 INFO [log] [AfterTestStep Event]-Folder created succesfully
    14:28:12,125 INFO [log] [AfterTestStep Event]-Checking if file already exist...
  • Hi,

    I've created a simple project that does a System.out.println in both these handlers - it works fine:

    Running soapUI TestRunner for [project-event-test]
    directory: C:\Program Files (x86)\SmartBear\soapUI-Pro-4.5.1\bin
    command: cmd.exe /C testrunner.bat -EDefault C:\Users\OLE\Documents\project-event-test-soapui-project.xml
    soapUI Pro 4.5.1 TestCase Runner
    Configuring log4j from [C:\Program Files (x86)\SmartBear\soapUI-Pro-4.5.1\bin\soapui-log4j.xml]
    11:01:42,844 INFO [DefaultSoapUICore] initialized soapui-settings from [C:\Users\OLE\soapui-settings.xml]
    11:01:43,061 INFO [SoapUIProGroovyScriptEngineFactory] Setting Script Library to [C:\workspace\soapui-pro-4.0.2-maintenance\scripts]
    11:01:43,062 INFO [DefaultSoapUICore] Adding listeners from [C:\Program Files (x86)\SmartBear\soapUI-Pro-4.5.1\bin\listeners\demo-listeners.xml]
    11:01:43,976 INFO [WsdlProject] Loaded project from [file:/C:/Users/OLE/Documents/project-event-test-soapui-project.xml]
    11:01:44,088 INFO [SoapUIProGroovyScriptEngineFactory] Setting Script Library to [C:\workspace\soapui-pro-4.0.2-maintenance\scripts]
    load script
    11:01:44,742 INFO [SoapUIProTestCaseRunner] Running soapUI tests in project [project-event-test]
    11:01:44,744 INFO [SoapUIProTestCaseRunner] Running Project [project-event-test], runType = SEQUENTIAL
    ProjectRunListener.beforeRun
    ProjectRunListener.afterRun
    11:01:44,777 INFO [SoapUIProTestCaseRunner] Project [project-event-test] finished with status [FINISHED] in 15ms

    Can you perhaps attach your project so we can try to figure out why it isn't working in yours?

    regards,

    /Ole
    SmartBear Software