Menu

Ignoring tags

2004-06-15
2004-06-16
  • David Fishburn

    David Fishburn - 2004-06-15

    In the past some of my tests were failing since the output was not *exactly* what was expected.

    For example:

    Got this ...
    <result>
      <resultset id="1">
        <row id="1">
          <col id="1" name="adddept" type="INTEGER">${deptId_HR}</col>
        </row>
      </resultset>
    </result>
    When I was expecting this
    <result>
      <updatecount>0</updatecount>
      <resultset id="1">
        <row id="1">
          <col id="1" name="adddept" type="INTEGER">${deptId_HR}</col>
        </row>
      </resultset>
    </result>

    The messages were from memory, not exact cutting and pasting.

    But the point is, I dont care about some of the tags I get in the result, is there a way to tell sqlunit validate the result has *at least* this in it.

    This might make generating more test cases easier.  And as you add more data, you will not have to update and change the tests as much.

    Thanks,
    Dave

     
    • Sujit Pal

      Sujit Pal - 2004-06-16

      Hi Dave,

      It actually works the other way. Had you just specified the updatecount in the result, then it would have checked only for the updatecount. Had you just specified the resultset, it would have checked only for the resultset. Since you specified both, it tries to match both and fails.

      The reason is that SQLUnit treats the specified result as the correct one, and uses that as the basis for matching with what it gets by running the procedure.

      The behavior you are asking for would necessiate inverting the basis to be the generated result and should be configurable so existing tests depending on the current behavior do not break. Let me know if the existing behavior with the partial specification would meet your needs or if you really want the basis to be inverted. If the latter, I can implement it.

      -sujit

       

Log in to post a comment.