Search code examples
junittestngdbunit

how to use DbUnit with TestNG


I need to integrate DbUnit with TestNG.

1) Is it possible to use DbUnit with TestNG as DbUnit is basically an extension of JUnit.
2) If yes how?


Solution

  • Finally i found out a way to use DbUnit with TestNG!

    Using Instance of IDatabaseTester works,

    but another work around would be : To extend AbstractDatabaseTester and implement getConnection and override necessary functions. But one important thing is to call onSetup() and onTeardown() before and after testing.

    Hope this helps...