I want to obtain the console output during or after a test run, and I need to do it programmatically

We have a software system that our users want to work with, in IntelliJ. (It's in Java.) We are writing a plugin to incorporate a bunch of tools that will hopefully make life (and using our libraries) a little easier for those users. One in particular would scan the console output and provide recommendations as to (a) how to accomplish what they want, a little easier, (b) adjust their IDE for a better experience with our libraries, and (c) issues that an expert user would see and know to fix right away.


(a) You appear to be requesting a new Flombet with every round trip to the Splorch. It is much faster to reuse your original Flombet after calling myFlombet.reset().

(b) The root directory of your project is ~/usr/bobber/myProjects/Wheedle/src/Bramble. You should close it and reopen it at ~/usr/bobber/myProjects/Wheedle/src/Bramble/src (or better yet, we ask them permission to change it ourselves.)

and (c) This test failed with an UnrestrainedEvilException. This is usually because your holy water cistern has run low. You might want to add a gallon or so before trying to do good things.

Please try not to call out the "Clippy" similarity.  We know. :-)

So - how can our plugin access those logs either during or after the test run?

Final note : It is important that the user not need to do anything at all, beyond leaving this feature enabled, to reap the benefit. (i.e. no "Go to this tab, select the 'save logs to...' checkbox, and type '/usr/you/IntellijLogs') - the root problem we're trying to solve is that they have to remember too many things already, in order to be successful.

Comment actions Permalink


I'm not sure if I understood your question correctly:

For now, you've bundled your tools with the plugin that you are running through the Run/Debug Configuration, and you'd like to attach to its output, is that correct?

Comment actions Permalink

Hi, Jakub.

The plugin (so far) employs a collection of Actions and PostStartupActivity objects to hook in, where appropriate or possible, to things we need to hook. Obviously, we can use whatever techniques make sense. If there's a way to (for example) programmatically alter the default JUnit configuration to run code that evaluates the output, that would be great. (It would have to be a default, since we do not want our users to have to remember any secret handshakes like "create a config called Blort and set the following")

On the other hand, if there's a better way to plumb this mechanism in, we'd love to hear about it.

The result of the analysis would be to pop up a tool window containing the advice generated from the preceding run.

Thanks for any suggestions you might have.


Please sign in to leave a comment.