Search in sources :

Example 51 with Scenario

use of org.drools.workbench.models.testscenarios.shared.Scenario in project drools-wb by kiegroup.

the class ScenarioKSessionSelectorTest method testNoSessionSet.

@Test
public void testNoSessionSet() throws Exception {
    selector.show(path, new Scenario());
    verify(innerSelector).init(path, null);
}
Also used : Scenario(org.drools.workbench.models.testscenarios.shared.Scenario) Test(org.junit.Test)

Example 52 with Scenario

use of org.drools.workbench.models.testscenarios.shared.Scenario in project drools-wb by kiegroup.

the class FixtureLayoutTest method testDeleteExecutionTraceButtonNoExecutionTraceRenderedAlready.

@Test
public void testDeleteExecutionTraceButtonNoExecutionTraceRenderedAlready() throws Exception {
    final Scenario scenario = mock(Scenario.class);
    final ExecutionTrace executionTrace = null;
    final ScenarioParentWidget parentWidgetToRender = mock(ScenarioParentWidget.class);
    testedLayout.addDeleteExecutionTraceButtonIfNotNull(scenario, executionTrace, parentWidgetToRender);
    verify(testedLayout, never()).setWidget(anyInt(), anyInt(), any(DeleteExecutionTraceButton.class));
}
Also used : ExecutionTrace(org.drools.workbench.models.testscenarios.shared.ExecutionTrace) DeleteExecutionTraceButton(org.drools.workbench.screens.testscenario.client.delete.DeleteExecutionTraceButton) Scenario(org.drools.workbench.models.testscenarios.shared.Scenario) Test(org.junit.Test)

Example 53 with Scenario

use of org.drools.workbench.models.testscenarios.shared.Scenario in project drools-wb by kiegroup.

the class SettingsPageTest method testRefresh.

@Test
public void testRefresh() throws Exception {
    final ScenarioParentWidget parentWidget = mock(ScenarioParentWidget.class);
    final Path path = mock(Path.class);
    final Scenario scenario = mock(Scenario.class);
    settingsPage.refresh(parentWidget, path, scenario);
    verify(settingsPageView).refresh(parentWidget, path, scenario);
}
Also used : Path(org.uberfire.backend.vfs.Path) ScenarioParentWidget(org.drools.workbench.screens.testscenario.client.ScenarioParentWidget) Scenario(org.drools.workbench.models.testscenarios.shared.Scenario) Test(org.junit.Test)

Example 54 with Scenario

use of org.drools.workbench.models.testscenarios.shared.Scenario in project drools-wb by kiegroup.

the class ScenarioUtilsTest method testFindExecutionTrace.

@Test
public void testFindExecutionTrace() throws Exception {
    final Scenario scenario = new Scenario();
    final ExecutionTrace executionTrace = new ExecutionTrace();
    scenario.getFixtures().add(executionTrace);
    Assert.assertEquals(executionTrace, ScenarioUtils.findExecutionTrace(scenario));
}
Also used : ExecutionTrace(org.drools.workbench.models.testscenarios.shared.ExecutionTrace) Scenario(org.drools.workbench.models.testscenarios.shared.Scenario) Test(org.junit.Test)

Example 55 with Scenario

use of org.drools.workbench.models.testscenarios.shared.Scenario in project drools-wb by kiegroup.

the class ScenarioTestEditorServiceImplTest method loadScenario.

@Test
public void loadScenario() throws Exception {
    final URL scenarioResource = getClass().getResource("Are they old enough.scenario");
    final Path scenarioPath = PathFactory.newPath(scenarioResource.getFile(), scenarioResource.toURI().toString());
    final Scenario loadedScenario = testEditorService.load(scenarioPath);
    assertNotNull(loadedScenario);
    assertEquals("mortgages.mortgages", loadedScenario.getPackageName());
    assertEquals(5, loadedScenario.getFixtures().size());
    assertTrue(loadedScenario.getFixtures().get(0) instanceof FactData);
    assertTrue(loadedScenario.getFixtures().get(1) instanceof FactData);
    assertTrue(loadedScenario.getFixtures().get(2) instanceof FactData);
    assertTrue(loadedScenario.getFixtures().get(3) instanceof ExecutionTrace);
    assertTrue(loadedScenario.getFixtures().get(4) instanceof VerifyFact);
}
Also used : Path(org.uberfire.backend.vfs.Path) FactData(org.drools.workbench.models.testscenarios.shared.FactData) ExecutionTrace(org.drools.workbench.models.testscenarios.shared.ExecutionTrace) VerifyFact(org.drools.workbench.models.testscenarios.shared.VerifyFact) URL(java.net.URL) Scenario(org.drools.workbench.models.testscenarios.shared.Scenario) Test(org.junit.Test)

Aggregations

Scenario (org.drools.workbench.models.testscenarios.shared.Scenario)59 Test (org.junit.Test)45 FactData (org.drools.workbench.models.testscenarios.shared.FactData)24 ExecutionTrace (org.drools.workbench.models.testscenarios.shared.ExecutionTrace)20 VerifyFact (org.drools.workbench.models.testscenarios.shared.VerifyFact)17 KieSession (org.kie.api.runtime.KieSession)14 Import (org.kie.soup.project.datamodel.imports.Import)14 VerifyField (org.drools.workbench.models.testscenarios.shared.VerifyField)13 FieldData (org.drools.workbench.models.testscenarios.shared.FieldData)12 ArrayList (java.util.ArrayList)11 VerifyRuleFired (org.drools.workbench.models.testscenarios.shared.VerifyRuleFired)9 Expectation (org.drools.workbench.models.testscenarios.shared.Expectation)6 Path (org.uberfire.backend.vfs.Path)6 Field (org.drools.workbench.models.testscenarios.shared.Field)5 HashMap (java.util.HashMap)4 RetractFact (org.drools.workbench.models.testscenarios.shared.RetractFact)4 Failure (org.junit.runner.notification.Failure)4 RunListener (org.junit.runner.notification.RunListener)4 RunNotifier (org.junit.runner.notification.RunNotifier)4 Date (java.util.Date)3