Search in sources :

Example 1 with Failure

use of org.guvnor.common.services.shared.test.Failure in project drools-wb by kiegroup.

the class JunitRunnerHelperTest method runWithJunitTest.

@Test
public void runWithJunitTest() {
    List<Failure> failures = new ArrayList<>();
    List<Failure> failureDetails = new ArrayList<>();
    Path path = mock(Path.class);
    Result result = runWithJunit(path, fakeRunner, failures, failureDetails);
    assertFalse(result.wasSuccessful());
    assertEquals(1, failures.size());
    assertEquals(2, failureDetails.size());
    assertEquals("Test", failures.get(0).getMessage());
    assertEquals(path, failures.get(0).getPath());
}
Also used : Path(org.uberfire.backend.vfs.Path) ArrayList(java.util.ArrayList) Failure(org.guvnor.common.services.shared.test.Failure) Result(org.junit.runner.Result) Test(org.junit.Test)

Example 2 with Failure

use of org.guvnor.common.services.shared.test.Failure in project drools-wb by kiegroup.

the class ScenarioRunnerServiceImpl method runTest.

@Override
public SimulationRunResult runTest(final String identifier, final Path path, final ScesimModelDescriptor simulationDescriptor, final List<ScenarioWithIndex> scenarios, final Settings settings, final Background background) {
    final KieContainer kieContainer = getKieContainer(path);
    final ScenarioRunnerDTO scenarioRunnerDTO = new ScenarioRunnerDTO(simulationDescriptor, scenarios, null, settings, background);
    final AbstractScenarioRunner scenarioRunner = getOrCreateRunnerSupplier(settings.getType()).create(kieContainer, scenarioRunnerDTO);
    final List<Failure> failures = new ArrayList<>();
    final List<Failure> failureDetails = new ArrayList<>();
    final Result result = runWithJunit(path, scenarioRunner, failures, failureDetails);
    return new SimulationRunResult(scenarios, background.getBackgroundDataWithIndex(), scenarioRunner.getLastRunResultMetadata().orElseThrow(() -> new IllegalStateException("SimulationRunMetadata should be available after a run")), new TestResultMessage(identifier, result.getRunCount(), result.getRunTime(), failures));
}
Also used : ScenarioRunnerDTO(org.drools.scenariosimulation.backend.runner.model.ScenarioRunnerDTO) SimulationRunResult(org.drools.workbench.screens.scenariosimulation.model.SimulationRunResult) TestResultMessage(org.guvnor.common.services.shared.test.TestResultMessage) ArrayList(java.util.ArrayList) AbstractScenarioRunner(org.drools.scenariosimulation.backend.runner.AbstractScenarioRunner) Failure(org.guvnor.common.services.shared.test.Failure) KieContainer(org.kie.api.runtime.KieContainer) Result(org.junit.runner.Result) SimulationRunResult(org.drools.workbench.screens.scenariosimulation.model.SimulationRunResult)

Aggregations

ArrayList (java.util.ArrayList)2 Failure (org.guvnor.common.services.shared.test.Failure)2 Result (org.junit.runner.Result)2 AbstractScenarioRunner (org.drools.scenariosimulation.backend.runner.AbstractScenarioRunner)1 ScenarioRunnerDTO (org.drools.scenariosimulation.backend.runner.model.ScenarioRunnerDTO)1 SimulationRunResult (org.drools.workbench.screens.scenariosimulation.model.SimulationRunResult)1 TestResultMessage (org.guvnor.common.services.shared.test.TestResultMessage)1 Test (org.junit.Test)1 KieContainer (org.kie.api.runtime.KieContainer)1 Path (org.uberfire.backend.vfs.Path)1