synced unit tests with sample and added support for subprocesses for bpmn unit tests w/ burnettk
This commit is contained in:
parent
6eb0ab0286
commit
2f4e824863
|
@ -110,7 +110,11 @@ class ProcessModelTestRunnerMostlyPureSpiffDelegate(ProcessModelTestRunnerDelega
|
||||||
f"Executable process cannot be found in {bpmn_file}. Test cannot run."
|
f"Executable process cannot be found in {bpmn_file}. Test cannot run."
|
||||||
)
|
)
|
||||||
bpmn_process_spec = parser.get_spec(executable_process)
|
bpmn_process_spec = parser.get_spec(executable_process)
|
||||||
bpmn_process_instance = BpmnWorkflow(bpmn_process_spec)
|
subprocesses = parser.get_subprocess_specs(bpmn_process_spec.name)
|
||||||
|
bpmn_process_instance = BpmnWorkflow(
|
||||||
|
bpmn_process_spec,
|
||||||
|
subprocess_specs=subprocesses,
|
||||||
|
)
|
||||||
return bpmn_process_instance
|
return bpmn_process_instance
|
||||||
|
|
||||||
def execute_task(self, spiff_task: SpiffTask, task_data_for_submit: dict | None = None) -> None:
|
def execute_task(self, spiff_task: SpiffTask, task_data_for_submit: dict | None = None) -> None:
|
||||||
|
@ -309,6 +313,7 @@ class ProcessModelTestRunner:
|
||||||
f" {next_task.task_spec.bpmn_id} because it is of type '{task_type}'"
|
f" {next_task.task_spec.bpmn_id} because it is of type '{task_type}'"
|
||||||
)
|
)
|
||||||
self._execute_task(next_task, test_case_task_key, test_case_task_properties)
|
self._execute_task(next_task, test_case_task_key, test_case_task_properties)
|
||||||
|
bpmn_process_instance.refresh_waiting_tasks()
|
||||||
next_task = self._get_next_task(bpmn_process_instance)
|
next_task = self._get_next_task(bpmn_process_instance)
|
||||||
|
|
||||||
error_message = None
|
error_message = None
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
"fault_or_suspend_on_exception": "fault",
|
"fault_or_suspend_on_exception": "fault",
|
||||||
"files": [],
|
"files": [],
|
||||||
"metadata_extraction_paths": null,
|
"metadata_extraction_paths": null,
|
||||||
"primary_file_name": "failing_task.bpmn",
|
"primary_file_name": "failing_script_task.bpmn",
|
||||||
"primary_process_id": "Process_FailingProcess"
|
"primary_process_id": "Process_FailingProcess"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
{
|
{
|
||||||
"test_case_2": {}
|
"test_case_2": {},
|
||||||
|
"test_case_3": {},
|
||||||
|
"test_case_4": {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"admin": false,
|
||||||
|
"description": "",
|
||||||
|
"display_name": "Expected To Fail",
|
||||||
|
"display_order": 0,
|
||||||
|
"parent_groups": null,
|
||||||
|
"process_groups": [],
|
||||||
|
"process_models": []
|
||||||
|
}
|
|
@ -1,11 +1,9 @@
|
||||||
{
|
{
|
||||||
"description": "",
|
"description": "",
|
||||||
"display_name": "Script Task",
|
"display_name": "Script Task",
|
||||||
"display_order": 0,
|
|
||||||
"exception_notification_addresses": [],
|
"exception_notification_addresses": [],
|
||||||
"fault_or_suspend_on_exception": "fault",
|
"fault_or_suspend_on_exception": "fault",
|
||||||
"files": [],
|
|
||||||
"metadata_extraction_paths": null,
|
"metadata_extraction_paths": null,
|
||||||
"primary_file_name": "Script.bpmn",
|
"primary_file_name": "script_task.bpmn",
|
||||||
"primary_process_id": "Process_Script_Task"
|
"primary_process_id": "Process_Script_Task"
|
||||||
}
|
}
|
|
@ -1,10 +1,9 @@
|
||||||
{
|
{
|
||||||
"description": "A.1.0.2",
|
"description": "Service Task",
|
||||||
"display_name": "A.1.0.2 - Service Task",
|
"display_name": "Service Task",
|
||||||
"display_order": 13,
|
|
||||||
"exception_notification_addresses": [],
|
"exception_notification_addresses": [],
|
||||||
"fault_or_suspend_on_exception": "fault",
|
"fault_or_suspend_on_exception": "fault",
|
||||||
"files": [],
|
"files": [],
|
||||||
"primary_file_name": "A.1.0.2.bpmn",
|
"primary_file_name": "service_task.bpmn",
|
||||||
"primary_process_id": "Process_test_a102_A_1_0_2_bd2e724"
|
"primary_process_id": "ServiceTaskProcess"
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"description": "Sub Process with Script Task Unit Test",
|
||||||
|
"display_name": "Sub Process with Script Task",
|
||||||
|
"display_order": 0,
|
||||||
|
"exception_notification_addresses": [],
|
||||||
|
"fault_or_suspend_on_exception": "fault",
|
||||||
|
"files": [],
|
||||||
|
"metadata_extraction_paths": null,
|
||||||
|
"primary_file_name": "sub_process_with_script_task.bpmn",
|
||||||
|
"primary_process_id": "Sub_Process_with_Script_Task"
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
<?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:spiffworkflow="http://spiffworkflow.org/bpmn/schema/1.0/core" 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="Sub_Process_with_Script_Task" name="Sub Process with Script Task" isExecutable="true">
|
||||||
|
<bpmn:startEvent id="StartEvent_1">
|
||||||
|
<bpmn:outgoing>Flow_0rk8y7w</bpmn:outgoing>
|
||||||
|
</bpmn:startEvent>
|
||||||
|
<bpmn:sequenceFlow id="Flow_0rk8y7w" sourceRef="StartEvent_1" targetRef="Process_tal328k" />
|
||||||
|
<bpmn:endEvent id="Event_0itg22d">
|
||||||
|
<bpmn:extensionElements>
|
||||||
|
<spiffworkflow:instructionsForEndUser>End Sub Process with Script Task Unit Test. Variable value: {{x}}</spiffworkflow:instructionsForEndUser>
|
||||||
|
</bpmn:extensionElements>
|
||||||
|
<bpmn:incoming>Flow_0jg5fdg</bpmn:incoming>
|
||||||
|
</bpmn:endEvent>
|
||||||
|
<bpmn:sequenceFlow id="Flow_0jg5fdg" sourceRef="Process_tal328k" targetRef="Event_0itg22d" />
|
||||||
|
<bpmn:subProcess id="Process_tal328k" name="Sub Process with Script Task">
|
||||||
|
<bpmn:incoming>Flow_0rk8y7w</bpmn:incoming>
|
||||||
|
<bpmn:outgoing>Flow_0jg5fdg</bpmn:outgoing>
|
||||||
|
<bpmn:startEvent id="Event_1wwprqs">
|
||||||
|
<bpmn:outgoing>Flow_1rxgng2</bpmn:outgoing>
|
||||||
|
</bpmn:startEvent>
|
||||||
|
<bpmn:sequenceFlow id="Flow_1rxgng2" sourceRef="Event_1wwprqs" targetRef="Sub_Process_Script_Task" />
|
||||||
|
<bpmn:endEvent id="Event_0j2iktq">
|
||||||
|
<bpmn:incoming>Flow_0v4kerg</bpmn:incoming>
|
||||||
|
</bpmn:endEvent>
|
||||||
|
<bpmn:sequenceFlow id="Flow_0v4kerg" sourceRef="Sub_Process_Script_Task" targetRef="Event_0j2iktq" />
|
||||||
|
<bpmn:scriptTask id="Sub_Process_Script_Task" name="Sub Process Script Task">
|
||||||
|
<bpmn:incoming>Flow_1rxgng2</bpmn:incoming>
|
||||||
|
<bpmn:outgoing>Flow_0v4kerg</bpmn:outgoing>
|
||||||
|
<bpmn:script>x = 5</bpmn:script>
|
||||||
|
</bpmn:scriptTask>
|
||||||
|
</bpmn:subProcess>
|
||||||
|
</bpmn:process>
|
||||||
|
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||||
|
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Sub_Process_with_Script_Task">
|
||||||
|
<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_0itg22d_di" bpmnElement="Event_0itg22d">
|
||||||
|
<dc:Bounds x="432" y="159" width="36" height="36" />
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="Activity_0kf2c3u_di" bpmnElement="Process_tal328k">
|
||||||
|
<dc:Bounds x="270" y="137" width="100" height="80" />
|
||||||
|
<bpmndi:BPMNLabel />
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNEdge id="Flow_0rk8y7w_di" bpmnElement="Flow_0rk8y7w">
|
||||||
|
<di:waypoint x="215" y="177" />
|
||||||
|
<di:waypoint x="270" y="177" />
|
||||||
|
</bpmndi:BPMNEdge>
|
||||||
|
<bpmndi:BPMNEdge id="Flow_0jg5fdg_di" bpmnElement="Flow_0jg5fdg">
|
||||||
|
<di:waypoint x="370" y="177" />
|
||||||
|
<di:waypoint x="432" y="177" />
|
||||||
|
</bpmndi:BPMNEdge>
|
||||||
|
</bpmndi:BPMNPlane>
|
||||||
|
</bpmndi:BPMNDiagram>
|
||||||
|
<bpmndi:BPMNDiagram id="BPMNDiagram_08kzntr">
|
||||||
|
<bpmndi:BPMNPlane id="BPMNPlane_1gwzqkg" bpmnElement="Process_tal328k" label="[object Object]">
|
||||||
|
<bpmndi:BPMNShape id="Event_1wwprqs_di" bpmnElement="Event_1wwprqs">
|
||||||
|
<dc:Bounds x="212" y="202" width="36" height="36" />
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="Event_0j2iktq_di" bpmnElement="Event_0j2iktq">
|
||||||
|
<dc:Bounds x="452" y="202" width="36" height="36" />
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="Activity_0ftpnv5_di" bpmnElement="Sub_Process_Script_Task">
|
||||||
|
<dc:Bounds x="300" y="180" width="100" height="80" />
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNEdge id="Flow_1rxgng2_di" bpmnElement="Flow_1rxgng2">
|
||||||
|
<di:waypoint x="248" y="220" />
|
||||||
|
<di:waypoint x="300" y="220" />
|
||||||
|
</bpmndi:BPMNEdge>
|
||||||
|
<bpmndi:BPMNEdge id="Flow_0v4kerg_di" bpmnElement="Flow_0v4kerg">
|
||||||
|
<di:waypoint x="400" y="220" />
|
||||||
|
<di:waypoint x="452" y="220" />
|
||||||
|
</bpmndi:BPMNEdge>
|
||||||
|
</bpmndi:BPMNPlane>
|
||||||
|
</bpmndi:BPMNDiagram>
|
||||||
|
</bpmn:definitions>
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"test_case_1": {
|
||||||
|
"tasks": {
|
||||||
|
"Sub_Process_with_Script_Task:Sub_Process_Script_Task": {
|
||||||
|
"data": [{}]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expected_output_json": { "x": 5 }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"title": "Get Name",
|
||||||
|
"description": "Please enter user name.",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Name"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": []
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"ui:order": [
|
||||||
|
"name"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"description": "Sub Process with User Task Unit Test",
|
||||||
|
"display_name": "Sub Process with User Task",
|
||||||
|
"display_order": 0,
|
||||||
|
"exception_notification_addresses": [],
|
||||||
|
"fault_or_suspend_on_exception": "fault",
|
||||||
|
"files": [],
|
||||||
|
"metadata_extraction_paths": null,
|
||||||
|
"primary_file_name": "sub_process_with_user_task.bpmn",
|
||||||
|
"primary_process_id": "Sub_Process_with_User_Task"
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
<?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" xmlns:spiffworkflow="http://spiffworkflow.org/bpmn/schema/1.0/core" id="Definitions_96f6665" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.0.0-dev">
|
||||||
|
<bpmn:process id="Sub_Process_with_User_Task" name="Sub Process with User Task" isExecutable="true">
|
||||||
|
<bpmn:startEvent id="StartEvent_1">
|
||||||
|
<bpmn:outgoing>Flow_0qgepuv</bpmn:outgoing>
|
||||||
|
</bpmn:startEvent>
|
||||||
|
<bpmn:sequenceFlow id="Flow_0qgepuv" sourceRef="StartEvent_1" targetRef="Sub_Process" />
|
||||||
|
<bpmn:subProcess id="Sub_Process" name="Sub Process with User Task">
|
||||||
|
<bpmn:incoming>Flow_0qgepuv</bpmn:incoming>
|
||||||
|
<bpmn:outgoing>Flow_1457pk3</bpmn:outgoing>
|
||||||
|
<bpmn:startEvent id="Event_15wzu5f">
|
||||||
|
<bpmn:outgoing>Flow_0vinu5f</bpmn:outgoing>
|
||||||
|
</bpmn:startEvent>
|
||||||
|
<bpmn:sequenceFlow id="Flow_0vinu5f" sourceRef="Event_15wzu5f" targetRef="Sub_Process_User_Task" />
|
||||||
|
<bpmn:endEvent id="Event_1uqtzo4">
|
||||||
|
<bpmn:incoming>Flow_02kn6kb</bpmn:incoming>
|
||||||
|
</bpmn:endEvent>
|
||||||
|
<bpmn:sequenceFlow id="Flow_02kn6kb" sourceRef="Sub_Process_User_Task" targetRef="Event_1uqtzo4" />
|
||||||
|
<bpmn:userTask id="Sub_Process_User_Task" name="Sub Process User Task">
|
||||||
|
<bpmn:extensionElements>
|
||||||
|
<spiffworkflow:properties>
|
||||||
|
<spiffworkflow:property name="formJsonSchemaFilename" value="get-name-schema.json" />
|
||||||
|
<spiffworkflow:property name="formUiSchemaFilename" value="get-name-uischema.json" />
|
||||||
|
</spiffworkflow:properties>
|
||||||
|
<spiffworkflow:instructionsForEndUser>Sub Process User Task.</spiffworkflow:instructionsForEndUser>
|
||||||
|
</bpmn:extensionElements>
|
||||||
|
<bpmn:incoming>Flow_0vinu5f</bpmn:incoming>
|
||||||
|
<bpmn:outgoing>Flow_02kn6kb</bpmn:outgoing>
|
||||||
|
</bpmn:userTask>
|
||||||
|
</bpmn:subProcess>
|
||||||
|
<bpmn:endEvent id="Event_0b21n8e">
|
||||||
|
<bpmn:extensionElements>
|
||||||
|
<spiffworkflow:instructionsForEndUser>End Sub Process User Task Unit Test.
|
||||||
|
Your name is {{name}}</spiffworkflow:instructionsForEndUser>
|
||||||
|
</bpmn:extensionElements>
|
||||||
|
<bpmn:incoming>Flow_1457pk3</bpmn:incoming>
|
||||||
|
</bpmn:endEvent>
|
||||||
|
<bpmn:sequenceFlow id="Flow_1457pk3" sourceRef="Sub_Process" targetRef="Event_0b21n8e" />
|
||||||
|
</bpmn:process>
|
||||||
|
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||||
|
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Sub_Process_with_User_Task">
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
|
||||||
|
<dc:Bounds x="179" y="159" width="36" height="36" />
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="Activity_0r9deqm_di" bpmnElement="Sub_Process">
|
||||||
|
<dc:Bounds x="270" y="137" width="100" height="80" />
|
||||||
|
<bpmndi:BPMNLabel />
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="Event_0b21n8e_di" bpmnElement="Event_0b21n8e">
|
||||||
|
<dc:Bounds x="432" y="159" width="36" height="36" />
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNEdge id="Flow_0qgepuv_di" bpmnElement="Flow_0qgepuv">
|
||||||
|
<di:waypoint x="215" y="177" />
|
||||||
|
<di:waypoint x="270" y="177" />
|
||||||
|
</bpmndi:BPMNEdge>
|
||||||
|
<bpmndi:BPMNEdge id="Flow_1457pk3_di" bpmnElement="Flow_1457pk3">
|
||||||
|
<di:waypoint x="370" y="177" />
|
||||||
|
<di:waypoint x="432" y="177" />
|
||||||
|
</bpmndi:BPMNEdge>
|
||||||
|
</bpmndi:BPMNPlane>
|
||||||
|
</bpmndi:BPMNDiagram>
|
||||||
|
<bpmndi:BPMNDiagram id="BPMNDiagram_0tuhqkd">
|
||||||
|
<bpmndi:BPMNPlane id="BPMNPlane_1pxrt0n" bpmnElement="Sub_Process">
|
||||||
|
<bpmndi:BPMNShape id="Event_15wzu5f_di" bpmnElement="Event_15wzu5f">
|
||||||
|
<dc:Bounds x="252" y="182" width="36" height="36" />
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="Event_1uqtzo4_di" bpmnElement="Event_1uqtzo4">
|
||||||
|
<dc:Bounds x="492" y="182" width="36" height="36" />
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="Activity_098mv12_di" bpmnElement="Sub_Process_User_Task">
|
||||||
|
<dc:Bounds x="340" y="160" width="100" height="80" />
|
||||||
|
<bpmndi:BPMNLabel />
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNEdge id="Flow_0vinu5f_di" bpmnElement="Flow_0vinu5f">
|
||||||
|
<di:waypoint x="288" y="200" />
|
||||||
|
<di:waypoint x="340" y="200" />
|
||||||
|
</bpmndi:BPMNEdge>
|
||||||
|
<bpmndi:BPMNEdge id="Flow_02kn6kb_di" bpmnElement="Flow_02kn6kb">
|
||||||
|
<di:waypoint x="440" y="200" />
|
||||||
|
<di:waypoint x="492" y="200" />
|
||||||
|
</bpmndi:BPMNEdge>
|
||||||
|
</bpmndi:BPMNPlane>
|
||||||
|
</bpmndi:BPMNDiagram>
|
||||||
|
</bpmn:definitions>
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"test_case_1": {
|
||||||
|
"tasks": {
|
||||||
|
"Sub_Process:Sub_Process_User_Task": {
|
||||||
|
"data": [{"name" : "User Task"}]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expected_output_json": {"name" : "User Task"}
|
||||||
|
}
|
||||||
|
}
|
|
@ -53,7 +53,7 @@ class TestProcessModelTestRunner(BaseTest):
|
||||||
with_db_and_bpmn_file_cleanup: None,
|
with_db_and_bpmn_file_cleanup: None,
|
||||||
) -> None:
|
) -> None:
|
||||||
process_model_test_runner = self._run_model_tests(parent_directory="expected-to-fail")
|
process_model_test_runner = self._run_model_tests(parent_directory="expected-to-fail")
|
||||||
assert len(process_model_test_runner.test_case_results) == 1
|
assert len(process_model_test_runner.test_case_results) == 3
|
||||||
|
|
||||||
def test_can_test_process_model_with_multiple_files(
|
def test_can_test_process_model_with_multiple_files(
|
||||||
self,
|
self,
|
||||||
|
|
Loading…
Reference in New Issue