Hi, Bryan Dollery wrote: > Hi, > > Does anyone else write unit-tests? > > I'm trying to unit-test my code, and it's hard. > > In a normal JDBC environment, using JUnit, I'd setup a database in the > setUp() method, and delete the mess I'd made of it in the tearDown() > method. > > With an O/R mapping layer between me and the database I can't just play > with the data - it isn't mine any more. I can't just add or delete a record > from a table because there may be things I don't know about - index tables, > references, whatever - and if there isn't now, there may be in the future. > The point of having an O/R tool is to encapsulate the DB, the downside is > that this makes it difficult to test. >
Did you have a lok at the OJB regression test suite yet? It contains more than 220 junit test cases covering almost any aspect of OJB. Writing those testcases was not hard. IMHO it's even more simple and elegant to use OJB calls to setup and teardown your testdata than to use jdbc calls. In certain situation (e.g. deleting all records from a table) there are also native jdbc calls in our testcode. That's no problem in OJB. cheers, Thomas > So, what does everyone else do for their testing? > > Cheers, > > Bryan > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
