Menu

How to handle empty resultset?

Sujit Pal
2003-10-07
2003-10-07
  • Sujit Pal

    Sujit Pal - 2003-10-07

    ---- Sent via email by Wadhwa, Sahib S ---
    Hi Sujit,
    I was exploring your SQLUnit.I was wondering if you could tell me how i can test
    an empty result set.I am thinking it to be like

    <!-- no rows selected -->
    <result>
    <resultset id="1">
    </resultset>
    </result>

    Secondly is do we have to execute the SQL query in oracle(for example) and cut n
    paste the results in the xml manually all the time? Is there a short cut to this
    approach?
    Your response would be appreciated.
    Thanks.
    Sahib Singh 

     
    • Sujit Pal

      Sujit Pal - 2003-10-07

      Have you tried setting this like this?
      <result>
        <resultset id="1" />
      .... more resultsets
      </result>
      I think it should work.

      At the moment there is no short cut to the approach of cutting and pasting the result. What I used to do was specify an obviously wrong result such as: <result /> and cut and paste the "that" part of the error message where it says: expected (this) got (that).

      Once the SQLUnit GUI tool is done (and this is turning into the most spectacular peice of vaporware I have written, but I am almost there, trust me :-)), it should be possible to run a test against the configured database and dump the test element into the underlying xml file.

      -sujit

       

Log in to post a comment.