DbUnit.NET Alternatives

后端 未结 3 1905
星月不相逢
星月不相逢 2020-12-24 02:34

Are there other \'.NET (2.0) Unit Testing Framework for Database Access Code\' besides DbUnit.NET?

I\'ve been trying DbUnit.NET and some things are not supported. Al

3条回答
  •  暖寄归人
    2020-12-24 03:27

    I ran into this problem a few years ago. I was annoyed at the state of DBUnit.Net. It was missing features that were important to me. Thanks to IKVM, it's not very difficult to use the normal Java version of DBUnit from dotnet. As a matter of fact, I'm running C# integration tests right now that are using the original DBUnit. Here's how I converted the java version of DBUnit into a .Net assembly:

    • Download IKVM
    • Place the following jars into a common directory: commons-collections-3.2.jar commons-logging-1.1.jar junit-4.1.jar commons-lang-2.2.jar dbunit-2.2.jar sqljdbc.jar

    Now, from the command line with a working directory of the common jar directory:

    ikvmc -target:libary -keyfile:yoursignature.snk -debug -version:2.2.0.0 -out:dbunit.dll *.jar
    

    You can get necessary libraries from the following locations:

    • commons-* Apache Commons
    • dbunit.jar DbUnit homepage
    • sqljdbc.jar MSDN
    • junit.jar Junit homepage

    If you are not using SQL Server as your database, then replace sqljdbc.jar with the appropriate JDBC driver. To use DBUnit directly from your .Net code, include dbunit.dll and the appropriate IKVM assemblies.

    The jar versions I have given here are old. My notes on this subject are almost three years old. Newer versions will probably work, but I have not tried them.

提交回复
热议问题