db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Pendleton <bpendleton.de...@gmail.com>
Subject Re: Spawning a separate JVM inside a JUnit test
Date Sun, 05 Jun 2011 16:33:04 GMT
> I'm currently converting tests/derbynet/DerbyNetAutoStart.java to a JUnit test and this
test does something peculiar. The first
> time around, it runs as part of the harness and that's fine. However, after that run
is done, it spawns another JVM (check
> testExtantNetServer() ) and forces the test to be ran again as part of the new JVM.
>
> My question is: should we maintain this behavior in JUnit? And are there any decorators
that I don't know about to make a test
> run in a separate JVM?
>
> I didn't want to have all that ugly code in a JUnit test where things are more orderly
and controlled, but is there really an
> alternative that I'm missing?

This is an old test, and I agree that it's not very JUnit-like. It's much
more than a simple unit test in my opinion; it would be better termed
a "system" test or an "integration" test, as it operates the complete
client-server system in a multi-process fashion.

That said, it looks to me as though the testing code in testExtantNetServer
runs in the test process, not in the spawned Network Server subprocess, so
I think that testExtantNetServer could "just" be another JUnit test, albeit
one substantially more complicated than the typical test.

I'd say, do the minimum that you can to convert the test from an old-style
harness test to a JUnit test, and that by itself would be a successful
bit of work!

thanks,

bryan


Mime
View raw message