Menu

Feature request - failure message tag

Sujit Pal
2003-09-20
2003-09-25
  • Sujit Pal

    Sujit Pal - 2003-09-20

    === James CE Johnson made the following feature request ==
    Hi Sujit,

    That's working great!

    May I request yet another feature?

    It would be nice to have a 'failure message' tag in the 'test' tag so that
    a plain-english description of the failure could be displayed. For
    instance:

      <!-- find pa_customer_info where peer_oid points to a -->
      <!-- missing pa_customer_info record -->
      <test name="customer_info test two">
        <sql>
          <stmt>
            select oid, customer_name
            from pa_customer_info
            where peer_oid not in (select distinct oid from pa_customer_info)
          </stmt>
        </sql>
        <result>
          <resultset id="1">
          </resultset>
        </result>
        <failureMessage>There are customer records pointing to peers which
    don't exist.</failureMessage>
      </test>

    The output might look something like this:

      [sqlunit] Running test[2]: customer_info test two (314ms)
      [sqlunit] No match on #-variables,
      [sqlunit] *** expected:
      [sqlunit] <result>
      [sqlunit]   <resultset id="1" />
      [sqlunit] </result>
      [sqlunit] *** but got:
      [sqlunit] There are customer records pointing to peers which don't exist.
      [sqlunit] <result>
      [sqlunit]   <resultset id="1">
      [sqlunit]     <row id="1">
      [sqlunit]       <col id="1" type="VARCHAR">foo</col>

    No big thing if its a pain to do. Just a thought.

    Thanks again,
    James

     
    • Sujit Pal

      Sujit Pal - 2003-09-25

      --- posting my reply to this one---
      Hi James,

      SQLUnit just released version 1.9, with the failure-message tag you requested. Its an attribute and (unfortunately) prints at the end of the expected/got with a prefix Message: (a little different from what you requested). That was mainly because I did not read your specs well enough, sorry about that. I can change the ordering in a future release if that will work for you.

      Oh, also I have been moving stuff over to the discussion forum so these things become more visible. So I am going to cut and paste this reply to the forum as well. Please reply there.

      Thanks
      Sujit

       
    • James CE Johnson

      Thanks Sujit!

      The order isn't really critical. I'm most interested in having that extra failure message available.

       

Log in to post a comment.