Run configuration without executable


I need to execute a custom run configuration which will trigger a remote service to actually test the code and report the test results. I already have implemented a ConfigurationFactory, a RunConfigurationBase and a ConfigurationType. In my CommandLineState I attach an SMTestRunnerConsoleView to the current process in order to reuse the existing GUI and be able to pass test results to this console view.

Now to my actual question: How can I execute a run configuration without actually executing code locally, but just calling a remote service? As of now, using the RunConfigurationBase without any modification I always get an exception stating "Executable is not specified" when trying to run my config. I already read through this post: This helped a lot, but I am just missing how to actually run an "empty" config.


1 comment
Comment actions Permalink

Ok, I got it working. To anyone interested:

Use a NopProcessHandler in your startProcess() method in your CommandLineState. Ths will pretty much give you an "empty" process handler in the sense of that it will not try to execute any executable. STDOUT will still be routed to a default console view appearing at the bottom of the IDE in a tool window (which is nice).

As for reporting the tests themselves:

Use SMTestRunnerConnectionUtil.createAndAttachConsole after creating your handler in order to receive messages sent by calling handler.notifyTextAvailable(...) in the default test console view (Do NOT call createConsole as this will not properly add a ProcessListener to the ProcessHandler, so you won't receive any sent test lifecycle messages in the console itself!). Additionally, in order to display said view instead of the default console, overwrite createConsole(...) in your CommandLineState and just return the earlier created BasTestOutputConsoleView created by the SMTestRunnerConnectionUtil. You can then call the in my original question linked posts methods in order to send TeamCity formatted messages to the test view output.



Please sign in to leave a comment.