Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Has Content Assertion

LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in SOAtest
Has Content Assertion
I have a question on one of the assertor set ups.

I have an operation that uses 20 inputs and I am checking for empty response with a 'has content' assertor. The very purpose of using assertion is to avoid the manual verification of traffic to see if the responses are coming or not, without any errors. The problem that I have here is, if any one input fails, i.e for one input, if I get an empty response, the enitre operation fails, irrespective of other 19 inputs giving a good response. Is there a way to use the assertion tool either alone or in conjunction with a method , so that the operation'll fail only if all the 20 inputs gives an empty response.

~Shyam
Tagged:

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    We have a Method assertion which allows you to script your assertions, this gives you more control on how you want the assertion to work.

    On another note, If your test case should fail IFF all 20 assertions fails, then you should use the compound OR assertion. This will allow the test case to pass as long as one of the assertions, inside the compound OR assertion, passes. But if all fail, then the test case will fail as a whole.

    I have a question on one of the assertor set ups.

    I have an operation that uses 20 inputs and I am checking for empty response with a 'has content' assertor. The very purpose of using assertion is to avoid the manual verification of traffic to see if the responses are coming or not, without any errors. The problem that I have here is, if any one input fails, i.e for one input, if I get an empty response, the enitre operation fails, irrespective of other 19 inputs giving a good response. Is there a way to use the assertion tool either alone or in conjunction with a method , so that the operation'll fail only if all the 20 inputs gives an empty response.

    ~Shyam

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Create an occurrence assertion with expected value >= 1 that uses an XPath that returns the list of nodes that contain content.

    CODE
    <root>
      <a>sj</a>
      <a/>
    </root>

    Use this XPath:

    /root/a[. != '']

    This returns any "a" element that contains some string content, so as long as this XPath returns at least one element, the occurrence assertion will succeed. That is, the assertion will succeed for the XML above.

    The assertion will fail only when the XPath returns zero elements, which would happen only if there does not exist a single "a" element that has string content. The assertion will fail for this XML:

    CODE<root>
      <a/>
      <a/>
    </root>

    The assertion will fail for this XML:

    CODE<root>
      <a/>
    </root>

    The assertion will fail for this XML:

    CODE<root/>

Tagged