Forum Discussion

klauern's avatar
klauern
Contributor
12 years ago

More documentation for writing custom Factory Extensions

I've been looking at how I can add more functionality to SoapUI to simplify some complicated testing that our team does for most projects. I've looked at both http://www.soapui.org/Developers-Corner/custom-factories.html and http://www.soapui.org/Developers-Corner/extending-soapui.html. I've been able to do some demo things with creating custom Actions, which the tutorial was pretty good for, but as soon as I wanted to see how to create a custom Assertion, I ended up with more questions about how the interfaces and more complicated things inside the TestAssertionFactory.

Are there some tutorials available for writing any of these Factories? It seems that there's probably a lot of context to understand how to write a custom Assertion, for example. Just taking a custom Assertion, I have these questions, and I can only imagine how many more I will have when I get deeper into just that one Factory:

  • What is an Assertable?

  • What's a TestAssertionConfig? What's useful to know about how it works?

  • In getAssertionClassType(), I have to either create a WsdlMessageAssertion or find a pre-existing one. In this class, there's three methods I need to overload, and absolutely no documentation (not even javadoc) explaining what these methods do:
            @Override
    protected String internalAssertResponse(MessageExchange messageExchange, SubmitContext submitContext) throws AssertionException {
    return null;
    }

    @Override
    protected String internalAssertRequest(MessageExchange messageExchange, SubmitContext submitContext) throws AssertionException {
    return null;
    }

    @Override
    protected String internalAssertProperty(TestPropertyHolder testPropertyHolder, String s, MessageExchange messageExchange, SubmitContext submitContext) throws AssertionException {
    return null;
    }

  • What kind of Category should I return for public String getCategory()?


Etc., etc. There's just so little documentation (actually as far as I can tell, none) I am going to end up guessing until I either miraculously find something that works, or give up in frustration.

Am I missing some tome of knowledge out there that explains all of this, or even the major parts that might make this a bit easier to understand?

4 Replies

  • I think the first link might be closer to what I'm looking for. The second one seems more related to the Actions that they have a decent tutorial for (although the blog post is a bit more information). Thanks for the links, I'll check them out.
  • Hello Ole,

    I think it would have helped a bit earlier, but I'm a bit further along, using your blog post to base it on. Thank you for the link, though, as I will probably use it for future projects.

    One thing that is giving me a bit of a hangup is the amount of building required to set up your UI for an Assertion or Test Step. I haven't written any Swing code since my college days, and the mixture of Swing and the SoapUI extensions to it is a bit overwhelming. To me, this is just a weird part of SoapUI that I didn't think would require hand-writing the Swing DesktopPanel for every Assertion. So much of SoapUI looks like it was laid out automatically by reflection, so knowing that I have to write UI is daunting to me, at least.

    So, with that, I have a couple questions:
    • Do I use the same ModelItemDesktopPanel<MyCustomAssertion> when writing my own UI for an Assertion as I would for a Test Step?
      public class MyCustomAssertionDesktopPanel extends ModelItemDesktopPanel<MyCustomAssertion> { ... }

    • Where can I read more about what the base class ModelItemDesktopPanel provides? What other kinds of UI components are useful to use, similar to the PropertyExpansionContainer?

    • You mention in the blog post that you could also use JavaFX. Since I feel I'm starting with no knowledge of either Swing or JavaFX, I considered it, but don't know or have any examples to look at in SoapUI that utilize JavaFX. Are tehre examples in SoapUI that use JavaFX panels to try to borrow inspriation from? Where can I start?

    • With a TestAssertion, what things can you implement besides a ResponseAssertion? What would the example in your project do without that interface implemented?


    I don't expect answers to all of these, but seeing these in blog posts, or other documents, would be pretty helpful overall. I'm no Swing developer, and my JavaFX skills are nil, so at this point, I'm struggling with parts of SoapUI I have never had to work with in order to extend WSDL/JSON/REST/XML assertions, etc. It would be nice if there were some really basic UI builders, such as things like being able to just define a class and annotate it with a field, a la JAXB, for instance:

    public class MyCustomAssertion extends WsdlMessageAssertion implements PropertyExpansionContainer {

    @SoapUITextField(name= "Subject")
    public final String subjectLine;

    @SoapUITextArea(name= "Email Message")
    public final String emailMessage;
    ....
    etc., etc.
    }


    But short of that, at least knowing more about the SoapUI Swing layer, or maybe just the JavaFX layer, would help a lot.