Aug 12th, 2009, 12:36 PM
Integration Testing errors on lookup tables
I am new to this so I might be way off base but I would like to know.
I have an application that I am building with 17 tables, 3 of which are code tables.
I am building a script to create the application.
In the script I have the code/lookup tables defined and then have a few tables that have references to the tables. For example a person must be associated with a supported locale so the Person class has a reference to a SupportedLocale table in a field called "locale". No surprises so far.
The script compiles in about 77 seconds which is pretty nice and has no errors which is even nicer.
When I run mvn test, the tests fail and the log says that it is getting security constraint violations when it tries to delete entries from the code tables. The constraints are coming from the other classes/tables rather from the one under test.
I fixed it by setting notNull to false for any reference to the code tables but that is not really what I would like to do.
Have I done something wrong and made a mistake on the diagnosis or is there a way to tell the tests that unless you cleanup the database between each test and remove things in the right order, the tests will not work even if the application is correct?
Aug 15th, 2009, 01:03 PM
This is a issue with Roo´s test generation, if you look at the generated test code, you will see that Roo generates some data for testing purposes, when there´re composition into the model usually triying to delete a entity throws a IntegrityConstraintViolation, but thre´s nothing wrong with the application but with the test.
There´s a Jira Issue open, check this thread for more information:
Tags for this Thread