Hi,
due to a mistake in my environment I forgot to
include the JDBC-jar file in my class path.
But all my SQLUnit tests passed!
It seems that SQLUnit.java catches an
SQLUnitException that says
"Cannot build Connection (connection-id=1) because com.mysql.jdbc.Driver not found in specified Context"
which is okay.
It does not add to the result-failureCount, however.
Therefore the 'finally' branch in SQLUnit.processDoc calls reporter.testFileComplete with a success parameter of "true".
Before I look at it further and try to build a
patch, is this the desired behaviour?
I would expect my test to fail if SQLUnit cannot even load a needed class file.
--
Andreas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
SQLUnit considers the connection part almost like setUp() in JUnit, so there is no concept of failure as there is in within a test. So this is not a failure case.
However, not having the driver in the classpath is likely to blow up all subsequent tests with a null pointer exception, so my suggestion for your patch would be to throw an exception and halt immediately, ie dont bother running subsequent tests.
TIA for the patch,
Sujit
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Okay, patch submitted.
I noticed that ConnectionFactory catches the
ClassNotFoundException and throws an
SQLUnitException instead.
All the SQLUnitExceptions I looked at seem
to indicate that the test(s) failed, so I
submitted a very simple patch.
This will blow up if SQLUnitExceptions turn out
to be either 'failure' or 'non-failure'.
Then I will have to look at it more closely.
Hope this works (the patch looks too simple to
be good :-).
Andreas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
due to a mistake in my environment I forgot to
include the JDBC-jar file in my class path.
But all my SQLUnit tests passed!
It seems that SQLUnit.java catches an
SQLUnitException that says
"Cannot build Connection (connection-id=1) because com.mysql.jdbc.Driver not found in specified Context"
which is okay.
It does not add to the result-failureCount, however.
Therefore the 'finally' branch in SQLUnit.processDoc calls reporter.testFileComplete with a success parameter of "true".
Before I look at it further and try to build a
patch, is this the desired behaviour?
I would expect my test to fail if SQLUnit cannot even load a needed class file.
--
Andreas
Hi Andreas,
SQLUnit considers the connection part almost like setUp() in JUnit, so there is no concept of failure as there is in within a test. So this is not a failure case.
However, not having the driver in the classpath is likely to blow up all subsequent tests with a null pointer exception, so my suggestion for your patch would be to throw an exception and halt immediately, ie dont bother running subsequent tests.
TIA for the patch,
Sujit
Okay, patch submitted.
I noticed that ConnectionFactory catches the
ClassNotFoundException and throws an
SQLUnitException instead.
All the SQLUnitExceptions I looked at seem
to indicate that the test(s) failed, so I
submitted a very simple patch.
This will blow up if SQLUnitExceptions turn out
to be either 'failure' or 'non-failure'.
Then I will have to look at it more closely.
Hope this works (the patch looks too simple to
be good :-).
Andreas
Hi Andreas,
I think you may have forgotten to attach the patch file. I've updated the patch.
-sujit