I have created a project that has several ManyToMany relationships and the Unit tests are failing when running them all at once. If I run the tests individually most of them succeed. But when I run all of them together, they get a bunch of errors where test data is unable to be deleted because it is in use by a different test case. Do I need to manually code the Integration Tests and DataOnDemand modules, to handle this relationship? Everything else works, the site works, and the selenium:selenese succeeds. The only thing failing is the roo perform tests.
Attached is my roo script and one of the test results files, I am using MySql and I have already made sure the tables are being created in InnoDB.
If I do need to manually create the tests for these relationships, is there a good site to check out for this. I haven't been able to find much on the errors, except that having the notNull in there causes it, but I need the notNull, and I need the tests to succeed.
I haven't done any modifications to the Roo generated code, just ran the roo script, and then did a perform tests.
Any help would be much appreciated.
Here are a couple of the errors.
testRemove(com.iaim.trainingguide.domain.ConcernTy peIntegrationTest) Time elapsed: 0.062 sec <<< ERROR!
org.springframework.orm.jpa.JpaSystemException: org.hibernate.exception.ConstraintViolationExcepti on: could not delete: [com.iaim.trainingguide.domain.ConcernType#87]; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationExcepti on: could not delete: [com.iaim.trainingguide.domain.ConcernType#87]
testRemove(com.iaim.trainingguide.domain.AudienceI ntegrationTest) Time elapsed: 0.078 sec <<< ERROR!
org.springframework.orm.jpa.JpaSystemException: org.hibernate.exception.ConstraintViolationExcepti on: could not delete: [com.iaim.trainingguide.domain.Audience#10]; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationExcepti on: could not delete: [com.iaim.trainingguide.domain.Audience#10]
Ok I think I found 2 issues.
1. --sizeMax 3 or --sizeMax 4 -- it looks like a string defined with a small amount of characters causes a ConstraintViolationException while running the tests.
2. --notNull on referenced/set fields -- it looks like --notNull causes the could not delete error, looks like having --notNull allows the tests to try and remove test data that is still being used by other test cases. i.e. it tries to delete a record that violates a foreign key constraint.
I uploaded test-works.zip that has the roo script, with all --sizeMax 3 or 4 removed or set to 255, and all --notNull removed.


Reply With Quote
