Hello!
I have modelled my System Under Test (SUT) into a multi-model GraphWalker .json file. I have managed to successfully execute test runs on the whole SUT.
Now I'd like to create tests which run on specified narrower parts of the whole SUT. This would allow me to create several test methods in JUnit, each of which would test some certain portion of the SUT. This in turn improves the testing result output (each test will have pass/fail outcome once completed). Also, this splitting helps avoid interruption of the whole testing process if some specific part of the SUT has an error.
What I have come up with is an idea that each of the test methods would start with the same TestExecutor initialized with all the model implementation classes. Each test method would then apply specific generators and stop conditions to these models to ensure that the correct part of the SUT model is entered (e.g. with "a_star(reached_vertex(v_NextViewStartVertex))"), that the execution stays within intended bounds and ends according to the appropriate condition. I could create custom generators and stop conditions where necessary.
The problem I have with implementing the previous approach is that I haven't been able to programmatically set the generator and stop condition for the models in a TestExecutor instance. Here's some (hackish) code to illustrate what I have tried:
TestExecutor executor = new TestExecutor(
FirstViewTest.class,
SecondViewTest.class,
ThirdViewTest.class
);
MachineConfiguration machineConfiguration = executor.getMachineConfiguration();
for (ContextConfiguration conf : machineConfiguration.getContextConfigurations()) {
if (conf.getTestClassName().equals("FirstViewTest")) {
conf.setPathGeneratorName("AStarPath");
conf.setStopConditionName("ReachedVertex");
conf.setStopConditionValue("v_EnterSecondView");
} else if (conf.getTestClassName().equals("SecondViewTest")) {
conf.setPathGeneratorName("AStarPath");
conf.setStopConditionName("ReachedVertex");
conf.setStopConditionValue("v_EnterThirdView");
}
}
The goal of this code would be ensuring that ThirdView is entered as directly as possible. The problem is that this code doesn't work, as the generator and stop condition have no apparent effect. I would also prefer if I could pass the generator (together with a stop condition) as an object.
Could this kind of splitting be somehow achieved? Or should I use some other approach? I'm open to suggestions.
Thanks in advance,
Magnus.