Forum Discussion

autoscout24's avatar
autoscout24
Contributor
15 years ago

SoapUI - Integrate Build Process

Hi Guys,
We are using more SOAP UI test and very well integrated with our test management tool. When a test fails I have tear down method for each and every test case which collects all the information of the test like, which test step is failed and What is the request and response during failure etc. and all stored to variable and reported to the test management tool.

There comes a new requirement in our company that we need to discard our test management tool and we have to integrate all soapUI tests to build process (Team city) and this build can only understand the junit report developed by test run.

Following clarification is need
1. is there a possibility to include all the information of the failed test (which is already stored in the variable in the tear down method) to the junit report.
2. The junit stores the report of the Test suite in the name like 'TEST.<test Suite name>' - is there a possibility to change this name.

Note:-
Where are running test using command line parameter (testRunner).

Regards
Vijay

6 Replies

  • Hi Vijay!

    You could create TestRunListener events from the Events tab in the Project window. Those could be used to collect whichever execution information you need and then create the JUnit report file manually in the ProjectRunListener.afterRun.

    Would this solve the problem?

    /Henrik
    eviware.com
  • Hi Henrik,
    Seems like a good solution. But i have problems in implementing it.

    1. What do you mean by creating the Junit report manually ?. Once it is integrated with Build process, I cannot do any manual work.
    So far when my test fails, The build has information like below under staketrace
    "<h3><b>GetMakeModelTree Failed</b></h3><pre>[SOAP Response] error: The document is not a Envelope@http://schemas.xmlsoap.org/soap/envelope/: document element mismatch got h1
    [SOAP Response] The document is not a Envelope@http://schemas.xmlsoap.org/soap/envelope/: document element mismatch got h1
    [ResponseStatus] XPathContains assertion failed for path [declare namespace web ="http://www.test.com/webapi/data/";
    //web:status] : Exception:Missing content for xpath [declare namespace web ="http://www.test.com/webapi/data/";
    //web:status] in Response
    </pre><hr/>"

    This above content is nothing but from the Junit report under the failure tag.

    Which we feel the message is not sufficient, we need more content, like wht is the endpoint and wht is the request and response etc.


    do you have any suggestion on this ?

    Regards
    Vijay
  • Hi Vijay,

    what we mean is you would need to manually collect data required for the reports.xml file (that Hudson uses to generate the HTML report) and then also generate that file to be exactly like you want it to be. This essentially means replacing the whole report-generation classes in soapUI and creating your own, please have a look at the JUnitReport and JUnitReportCollector classes in the soapUI javadoc which you could use for this..

    Good Luck!

    regards,

    /Ole
    eviware.com
  • Hi Ole,
    Thanks for the reply. I tried the JunitReport class. Trying to implement the following code in all the test case teardown method, but it displays error message

    import com.eviware.soapui.report.JUnitReport;
    def TescaseName = testRunner.testCase.name;
    double time = testRunner.getTimeTaken();
    JUnitReport.addTestCase(TescaseName, time);


    Error displayed:-

    Thu Apr 07 10:29:23 CEST 2011:ERROR:An error occured [No signature of method: static com.eviware.soapui.report.JUnitReport.addTestCase() is applicable for argument types: (java.lang.String, java.lang.Double) values: [Germany-Sampletest, 803.0]
    Possible solutions: addTestCase(java.lang.String, double)], see error log for details


    Detail Error message:-
    Thu Apr 07 10:29:23 CEST 2011:ERROR:groovy.lang.MissingMethodException: No signature of method: static com.eviware.soapui.report.JUnitReport.addTestCase() is applicable for argument types: (java.lang.String, java.lang.Double) values: [Germany-TopCars-NoProfileID, 0.0]
    Possible solutions: addTestCase(java.lang.String, double)
    groovy.lang.MissingMethodException: No signature of method: static com.eviware.soapui.report.JUnitReport.addTestCase() is applicable for argument types: (java.lang.String, java.lang.Double) values: [Germany-TopCars-NoProfileID, 0.0]
    Possible solutions: addTestCase(java.lang.String, double)
    at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1357)
    at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1343)
    at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.call(StaticMetaClassSite.java:50)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
    at Script8.run(Script8.groovy:10)
    at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:96)
    at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:88)
    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.runTearDownScript(WsdlTestCase.java:882)
    at com.eviware.soapui.impl.wsdl.panels.testcase.WsdlTestCaseDesktopPanel$TearDownScriptGroovyEditorModel$1.actionPerformed(WsdlTestCaseDesktopPanel.java:640)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
  • Hi Vijay!

    JUnitReport.addTestCase(...) is not a static method, but you try to access it in a static fashion. You need to instantiate JUnitReport first, like this:
    import com.eviware.soapui.report.JUnitReport
    def testCaseName = testRunner.testCase.name
    double time = testRunner.timeTaken
    new JUnitReport()
    JUnitReport.addTestCase(testCaseName, time)


    Regards

    /Henrik