When using the MicrosoftSqlDatabaseOperationLookup to perform tests using MS SQL Server, the transaction is commited and leave the database with durty data. I had to overwrite the class to fix this problem. The problem occurs at line 231, in method execute, just removing the instruction below the problem is solved
jdbcConnection.commit();
Thank you for the report.
Since you have a test that shows this problem, can you make a test for dbUnit that exhibits the problem? Then I can commit it with the change, providing some confidence and regression.
I'll do this and print the dirty data on database and the test results, is it fine?
Great, thank you!
The test can log anything you want to show us data, however tests must have asserts that fail based on conditions that show what the problem is. Otherwise, the test does not become a regression test for future changes. If the test can log the actual data, then it can compare it to the expected data.
I have uploaded the screenshots in a .zip file on my google drive's account, the link is:
https://drive.google.com/open?id=0BzUbi3tiuhCdWC1SVVA3UjRaZGM
I think it's fine.
Thanks. You are using "Spring DbUnit" classes and annotations in your work, and those are not part of this product (it uses dbUnit).
Is the issue with a class in dbUnit or the other product?
If the issue is in dbUnit, to fix it, please narrow the work to only classes from this project.
The issue is with InsertIdentityOperation and it's located on org.dbunit.ext.mssql
As I've said, when I use the class from Spring DbUnit that uses this InsertIdentityOperation, from dbUnit, that class performs an commit on currently transaction so Spring is not able to rollback the commited transaction, I've done a test overwritting the class InsertIdentityOperation removing the line wich commits transaction and that problem does not occours anymore.
This is the first you mentioned Spring DbUnit.
Closing this, feel free to reopen if you find an issue with dbUnit itself. And transaction rollback in tests is not a good idea.
Why isn't it a good idea to rollback transactions in tests? I'm doing unit tests. What do you recommend to these cases?
Duplicate of #309, just committed.