Run unit tests on a non-compiling build

This is just a general question I'd like to throw out there to see what the opinion of the IDEA community is at large.

Eclipse has a nice feature where it allows a user to run unit tests even when there are compile errors in the codebase. As long as the execution of the test doesn't hit those areas where there is a compile error, the test can run fine. I suppose it uses the existing bytecode for the affected classes, and only recompiles the test.

This seems to me like a really useful feature that potentially revolutionises the way one writes unit tests: it enables the programmer to properly do 'test-first' development where he can write the new feature, test it, and only then incrementally fix the knock-on effects in other parts of the code. Eclipse maintains a list of 'problems' that is updated as the background compilation fails-- but this doesn't stop the test running.

As far as I can tell, IDEA cannot do this, and it would be hard without background compilation. I would like to get the community's opinion... Is it acceptable (or even a feature) that we require the whole codebase to compile before running a test? Or should JetBrains consider adding this sort of thing?

1 comment
Comment actions Permalink

Hello Ben,

We do not think that this way of working is particularly revolutionary, but
you can actually do this in IDEA right now. Just enable using the Eclipse
compiler in the settings and add the command line option (you can look it
up in the Eclipse reference) allowing it to stub out methods with compile
errors.

This is just a general question I'd like to throw out there to see
what the opinion of the IDEA community is at large.

Eclipse has a nice feature where it allows a user to run unit tests
even when there are compile errors in the codebase. As long as the
execution of the test doesn't hit those areas where there is a compile
error, the test can run fine. I suppose it uses the existing bytecode
for the affected classes, and only recompiles the test.

This seems to me like a really useful feature that potentially
revolutionises the way one writes unit tests: it enables the
programmer to properly do 'test-first' development where he can write
the new feature, test it, and only then incrementally fix the knock-on
effects in other parts of the code. Eclipse maintains a list of
'problems' that is updated as the background compilation fails-- but
this doesn't stop the test running.

As far as I can tell, IDEA cannot do this, and it would be hard
without background compilation. I would like to get the community's
opinion... Is it acceptable (or even a feature) that we require the
whole codebase to compile before running a test? Or should JetBrains
consider adding this sort of thing?

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please sign in to leave a comment.