Hi Guys,
I am unit testing some class with TestNG framework, we are using Hibernate as our base APIs with an abstraction built on top of it. I came across an issue, that I'd like to know answers to.
I have a test class which has test cases numbered from 1 to 3 ( assume ).
typically, i do :
@BeforeClass deleteAllDataInDataBase( )
// run test cases
@AfterClass deleteAllDataInDataBase( )
Test cases work fine and everything is good and dandy. Yesterday i was trying to simulate a failure in multi threading environment ( i was skeptical of a block of code that was written in one of the Base classes ). And basically i created something like
run( ){
TestNG testNG = new TestNG( );
testNG.run( );
}
now i create an Executors.newFixedThreadPool( 10 );
and then do an execute twice or thrice on the above run( ) method in a typical runnable in a typical failure type while(true) loop.
In doing so, Hibernate gives me a unique violation exception ( as i would expect ).
So from above scenario, my question is, if i am running my test suite on DB. and if someone else is running the same test suite on his machine, then it should be giving the unique exception as expected.
Is there a work around / am i missing something ?
Regards
Vyas, Anirudh
_________________ Regards,
Vyas, Anirudh
|