Menu

UpdateCount matching in exception

Sujit Pal
2004-05-08
2004-05-11
  • Sujit Pal

    Sujit Pal - 2004-05-08

    ---- posted by Kevin Bowen via private email ----
    Sujit,

    I've been evaluating SQLUnit for use in automating all of our Sybase SP testing at America Online and have been very impressed so far.   But I've run across a small problem.   I'm hoping it's user error <g>.

    Test cases expecting exceptions to be thrown are working fine in most cases.  The problem I have seems to only occur on sybase tables using identity fields.   I set up the result tag the same as for any other table, but what I get back at runtime is the following:

       [sqlunit] Running test[1]: Null value: ztel_acct_id (287ms)
       [sqlunit] No match on updatecount
       [sqlunit] *** expected:
       [sqlunit] <result>
       [sqlunit]    <exception>
       [sqlunit]      <code>515</code>
       [sqlunit]      <message>Attempt to insert NULL value into column
    'ztel_acct_id', table 'z_tel_qe.dbo.ztel_exception'; column does not allow nulls.
    Update fails.</message>
       [sqlunit]    </exception>
       [sqlunit] </result>
       [sqlunit] *** but got:
       [sqlunit] <result>
       [sqlunit]    <exception>
       [sqlunit]      <code>515</code>
       [sqlunit]      <message>Attempt to insert NULL value into column
    'ztel_acct_id', table 'z_tel_qe.dbo.ztel_exception'; column does not allow nulls.
    Update fails.</message>
       [sqlunit]    </exception>
       [sqlunit] </result>

    I've tried adding outparam and updatecount tags but it (rightfully) doesn't like them used with exception tags.

    I'm not positive it's the identity field, but that's the only real difference between these two tables and the others that work properly.   Any ideas?

    Ken Bowen

     
    • Sujit Pal

      Sujit Pal - 2004-05-08

      Hi Kevin,

      I think this is a sqlunit bug (kind of :-)). What is probably happening with identity cols involved is that even though the stored procedure fails, it returns a value of 0 in the update count, which sqlunit tries to match with the default value (if updatecount is not specified of -1).

      I have put in a check to not compare the updatecounts if the expected result does not specify it. This kind of checks are already in place for rowcount, so I guess I must have missed it. Sorry about that. Its in cvs now, if you can download it and give it a whirl and let me know if it worked for you, I would really appreciate it.

      Thank you for catching the bug, and I hope you find sqlunit a good tool to help set up a regression testing system at AOL.

      -sujit

       
    • Sujit Pal

      Sujit Pal - 2004-05-11

      Hi Ken,

      Release 3.5 has been released and contains the fixes to the bug you pointed out. Let me know if this works for you.

      Thanks
      Sujit

       

Log in to post a comment.