views:

104

answers:

1

Hi,

I'm currently implementing a .NET wrapper for a Java library by using JNI to start the JavaVM and interacting with Java classes. To be on the save side, I'd like to have unit tests for my code.

The Problem I'm facing now is, you only can start the Java VM once per process. There is no possibility to unload the JVM.

This makes it rather difficult to write unit tests that are actually clean.

Some specs: .NET/Java interface: done in C++/cli Unit testing lib: NUnit Unit testing code: C#

Any tips?

Regards, Dominik

+1  A: 

You could create an ad-hoc .Net test application, that would run on its own process.

Your NUnit tests would thus launch this process (even in command line), let it actually run the tests, and the return the value as std output. IOW, keep it simple and launch many processes.

Assaf Lavie