You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Mike Matrigali <mi...@sbcglobal.net> on 2007/05/24 01:48:54 UTC

junit test debugging - any helper routine to just dump out the full contents of a result set?

Is there any debug helper routines already written to dump
the contents of a result set to standard out?

/mikem


Re: doubt on JUnit.!!

Posted by Kristian Waagan <Kr...@Sun.COM>.
Ravinder Reddy wrote:
> 
> 
>     hello all,
>         I have read somewhere that , in junit testing the focus is on 
> testing the behavior of Object rather than each individual method.
>     what if that a behavior test of an Object , which operates on two 
> methods,passes even though the two methods contain defects(they may 
> cancel out one another).???
>     how we found the defects of these methods..!!

Hello Ravinder,

Without any more details about the issues you mention, I think it is 
pretty much up to the test writer how well the object in question is 
tested. If you test several methods in the same test, it is a general 
advice to make sure results from intermediate steps are correct - 
typically by using asserts.

There is nothing in JUnit that stops you from testing only a single 
method, in fact I believe that is what many of our tests do. That said, 
since we are at a high level (JDBC), the single method call will depend 
on lots of other code which we probably don't test directly.


We have also had a few discussions on being able to test package private 
classes, which are typically at a lower level then the public APIs for 
the database. I think we agreed on a plan, but so far no tests have been 
contributed and the required bits and pieces to compile and and run them 
are not in place.


If you are still worried that the testing is too restrictive or poor, 
please let us know so we can discuss the matters and improve the testing 
of Derby.



regards,
-- 
Kristian

> 
>                 Thank You..!!
> 
> 


doubt on JUnit.!!

Posted by Ravinder Reddy <pa...@students.iiit.ac.in>.

 	hello all,
 		I have read somewhere that , in junit testing the focus is 
on testing the behavior of Object rather than each individual method.
 	what if that a behavior test of an Object , which operates on two 
methods,passes even though the two methods contain defects(they may cancel out 
one another).???
 	how we found the defects of these methods..!!

 				Thank You..!!


-- 
******************************************************************************

    Every problem that has been solved can be solved again in a better way

                                                   - Ravinder Reddy

*******************************************************************************


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


Re: junit test debugging - any helper routine to just dump out the full contents of a result set?

Posted by Kathey Marsden <km...@sbcglobal.net>.
Mike Matrigali wrote:
> Is there any debug helper routines already written to dump
> the contents of a result set to standard out?
>
To print out the resultSet in two dimensional array used by 
JDBC.assertFullResultSet(rs,expectedRows) there is this  showResultSet 
utility. You can call this to print out the ResultSet and then cut and 
paste into your test code.

http://db.apache.org/derby/javadoc/testing/org/apache/derbyTesting/junit/Utilities.html#showResultSet(java.sql.ResultSet)


For human readable ResultSet display there is JDBCDisplayUtil
http://db.apache.org/derby/javadoc/engine/org/apache/derby/tools/JDBCDisplayUtil.html#DisplayResults(java.io.PrintStream,%20java.sql.Statement,%20java.sql.Connection)

> /mikem
>
>
>