Forum Discussion

Holly_Greger's avatar
Holly_Greger
Contributor
14 years ago

Access response Outline component from groovy

Hello,

Am putting together a groovy script, more like a full blown class, that will draw on a JFrame the response of a test step. Looking at the different views of a response in SoapUI, the outline view seems to be just what am looking for since its an editable XML tree. How could i have access to this component using the API, and is the API documentation for this component public?

Thanks,

Enzo
  • Hi Enzo,

    the class for this is called XmlObjectTree, but it isn't publically documented as for now. You should still be able to use it, use the default constructor and then the setXml( ... ) method to set it up, and add it to your JPanel (its a JComponent)

    Hope this helps,

    regards,

    /Ole
    eviware.com
  • Hi Ole,

    That info is really helpful. Now, couldn't i just get a hold of this XmlObjectTree already instantiated relative to a particular testStep? something like testRunner.testCase.getTestStepByName(testStepName).?? What would be the API navigation to this component?
  • Hi Holly,

    no, the existing instance isn't available via any public API, you will just have to create a new one.

    regards!

    /Ole
    eviware.com
  • Hi Ole,

    You said i should be able to use this class but from what context? Instantiating it in a groovy script gives me "Unable to resolve class error". What do i need to import in order to use it?

    Enzo
  • Hi Enzo,

    I tried just now to enter the following code into a Groovy TestStep (in a functional TestCase):
    import com.eviware.soapui.support.editor.views.xml.outline.support.XmlObjectTree
    myXMLObjectTree = new XmlObjectTree()

    It seem to work fine.

    /Henrik
    eviware.com
  • Hi Henrik,

    I was able to instantiate the tree with no problem then setXml(string xml) and then added it to a JPanel and it displayed nicely. Now, trying to update this xml tree after it has been displayed by using setXml(string xml) is not working. I've tried invoking validate(), among other things, on the panel holding the tree and it doesn't work. How could i update this xml tree dynamically and have my UI reflect it?