added test for failing test and multiple at once w/ burnettk

This commit is contained in:
jasquat 2023-05-16 17:32:53 -04:00
parent c2083103e4
commit 2f98891489
5 changed files with 71 additions and 0 deletions

View File

@ -30,6 +30,10 @@ class UnrunnableTestCaseError(Exception):
pass
class MissingBpmnFileForTestCaseError(Exception):
pass
@dataclass
class TestCaseResult:
passed: bool
@ -122,6 +126,8 @@ class ProcessModelTestRunner:
bpmn_file_path = os.path.join(file_dir, bpmn_file_name)
if os.path.isfile(bpmn_file_path):
test_mappings[file] = bpmn_file_path
else:
raise MissingBpmnFileForTestCaseError(f"Cannot find a matching bpmn file for test case json file: '{file}'")
return test_mappings

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_96f6665" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.0.0-dev">
<bpmn:process id="Process_FailingProcess" name="Failing Process" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_1xkc1ru</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_1xkc1ru" sourceRef="StartEvent_1" targetRef="Activity_FailingTask" />
<bpmn:endEvent id="Event_00iauxo">
<bpmn:incoming>Flow_0tkkq9s</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_0tkkq9s" sourceRef="Activity_FailingTask" targetRef="Event_00iauxo" />
<bpmn:scriptTask id="Activity_FailingTask" name="Failing Task">
<bpmn:incoming>Flow_1xkc1ru</bpmn:incoming>
<bpmn:outgoing>Flow_0tkkq9s</bpmn:outgoing>
<bpmn:script>a = 1
b = a + 'two'</bpmn:script>
</bpmn:scriptTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_FailingProcess">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="179" y="159" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_00iauxo_di" bpmnElement="Event_00iauxo">
<dc:Bounds x="432" y="159" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0ecfxz2_di" bpmnElement="Activity_FailingTask">
<dc:Bounds x="270" y="137" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_1xkc1ru_di" bpmnElement="Flow_1xkc1ru">
<di:waypoint x="215" y="177" />
<di:waypoint x="270" y="177" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0tkkq9s_di" bpmnElement="Flow_0tkkq9s">
<di:waypoint x="370" y="177" />
<di:waypoint x="432" y="177" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

View File

@ -0,0 +1,11 @@
{
"description": "Process that raises an exception",
"display_name": "Failing Process",
"display_order": 0,
"exception_notification_addresses": [],
"fault_or_suspend_on_exception": "fault",
"files": [],
"metadata_extraction_paths": null,
"primary_file_name": "failing_task.bpmn",
"primary_process_id": "Process_FailingProcess"
}

View File

@ -29,6 +29,16 @@ class TestProcessModelTestRunnerService(BaseTest):
test_runner_service.run()
assert test_runner_service.process_model_test_runner.all_test_cases_passed()
def test_can_test_multiple_process_models(
self,
app: Flask,
with_db_and_bpmn_file_cleanup: None,
with_mocked_root_path: any,
) -> None:
test_runner_service = ProcessModelTestRunnerService(FileSystemService.root_path())
test_runner_service.run()
assert test_runner_service.process_model_test_runner.all_test_cases_passed() is False
@pytest.fixture()
def with_mocked_root_path(self, mocker: MockerFixture) -> None:
path = os.path.join(