Run Configuration 'Run' tab and 'Console layout'
I'm writing a custom Run Configuration (ApplicationConfiguration alike).
Everything goes well so far and I am now stuck at execution process layout.
Problem: When I run my code it executes as expected, however in 'Run' tab structure view is unavailable due to 'Test framework quit unexpectedly':
Note that my plugin is not registered as a test framework, however it is a test execution by its purpose.
I want my execution structure to look like this:
MyModule (as a root)
---- SimpleScenario (class that represents single scenario)
---- ---- line 1 (line that represents single SOUT call of a scenario)
---- ---- line 2 (line that represents single SOUT call of a scenario)
---- ---- line 3 (line that represents single SOUT call of a scenario)
So steps should be every SOUT line of execution inside SimpleScenario class:
public class SimpleScenario implements Scenario {
@Override
public void steps() {
System.out.println("line 1");
System.out.println("line 2");
System.out.println("line 3");
}
}
Here is MyConfiguration class implementation:
public final class MyConfiguration extends ApplicationConfiguration {
public MyConfiguration(Project project, ConfigurationFactory factory) {
super(factory.getType().getDisplayName(), project, factory);
}
@NotNull
@Override
public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
SettingsEditorGroup<MyConfiguration> group = new SettingsEditorGroup<>();
group.addEditor("Configuration", new MyConfigurable(getProject()));
JavaRunConfigurationExtensionManager.getInstance().appendEditors(this, group);
group.addEditor("Logs", new LogConfigurationPanel<>());
return group;
}
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) {
return new JavaApplicationCommandLineState<>(this, env) {
@NotNull
@Override
public ExecutionResult execute(@NotNull Executor executor, @NotNull ProgramRunner<?> runner) throws ExecutionException {
ProcessHandler processHandler = startProcess();
SMTRunnerConsoleProperties consoleProperties = new SMTRunnerConsoleProperties(
MyConfiguration.this,
"My Project",
executor);
BaseTestsOutputConsoleView console = UIUtil.invokeAndWaitIfNeeded(
() -> SMTestRunnerConnectionUtil.createConsole("My Project", consoleProperties)
);
console.attachToProcess(processHandler);
return new DefaultExecutionResult(console, processHandler, createActions(console, processHandler, executor));
}
};
}
}
Thank you in advance!
Please sign in to leave a comment.