Reputation: 23
I want to use my slim server remotely with fitnesse but it doesn’t work because the fitnesse always want start the slim server locally. The problem: On hostA there is a standalone fitnesse server (started from command prompt with „java -jar fitnesse-standalone.jar -p 8080” command) with a very simple textfixture:
!define TEST_SYSTEM {slim}
!define slim.host {hostB}
!define slim.port {8090}
!define slim.pool.size {2}
!|script|Count|
|count|
|count|
|check|counter|12|
|count|
|count|
|check|counter|4|
|count|
|count|
|check|counter|6|
On hostB I have a slim server which listens on port 8090. If I start the fixture I get the following error message:
„Unable to start test system 'slim': java.io.IOException: Cannot run program ""c:\Program Files (x86)\Java\jre7\bin\java"": CreateProcess error=2, The system cannot find the file specified”
It seems that fitnesse want to start the slim server anyway locally because if I define the test runner:
!define TEST_RUNNER {<path>/to/my/slimserver/mycslim.exe}
!define COMMAND_PATTERN {%m}
It works but this is not the behavior what I need. I thought If I define the slim.host and slim.port fitnesse will connect to the hostB automatically without starting the slim server locally.
It is possible to configure the fitnesse server to connect to a remote slim server without starting it locally? Thanks for help!
Upvotes: 1
Views: 1040
Reputation: 82
I have written a custom TestSystem to achieve this. The key is the client builder.
public class CustomClientBuilder extends SlimClientBuilder {
public CustomClientBuilder(Descriptor descriptor) {
super(descriptor);
}
@Override
public SlimCommandRunningClient build() throws IOException {
Object commandRunner = new MockCommandRunner(this.getExecutionLogListener());
return new SlimCommandRunningClient((CommandRunner)commandRunner, this.determineSlimHost(), this.getSlimPort(),
this.determineTimeout(), this.getSlimVersion(), this.determineSSL(),
this.determineHostSSLParameterClass());
}
}
Use this client builder in your test system factory:
public class CustomTestSystemFactory implements TestSystemFactory {
private final SlimTableFactory slimTableFactory;
private final CustomComparatorRegistry customComparatorRegistry;
public CustomTestSystemFactory(SlimTableFactory slimTableFactory,
CustomComparatorRegistry customComparatorRegistry) {
this.slimTableFactory = slimTableFactory;
this.customComparatorRegistry = customComparatorRegistry;
}
public final TestSystem create(Descriptor descriptor) throws IOException {
SlimClientBuilder clientBuilder = new CustomClientBuilder(descriptor);
SlimCommandRunningClient slimClient = clientBuilder.build();
HtmlSlimTestSystem testSystem = new HtmlSlimTestSystem(clientBuilder.getTestSystemName(),
slimClient, this.slimTableFactory.copy(), this.customComparatorRegistry);
return testSystem;
}
}
Upvotes: 0