I have a set of JUnit test files and also a test suite (Suite class) file which holds the reference to all individual Junit test files.
All are database oriented. The database used is Mysql and I am using Eclipse IDE to run the tests.
When running each file individually I get the correct value and the assertion is correct but when running from the test suite it shows a different value.
I have made each JUnit test file to access the database independently with a different database name (even though the table structure is same)
Whether we need to prevent the JUnit test cases from running parallel / the database related statements need to be verified ?
I would suggest you look into :
There are 2 reasons that this may happen.
One is that you have not constructed the suite properly and some tests share resources with others.
And the other is that when you finish a test, you don't rollback the database and so the next test finds database in an erroneous state.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.