diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_test_runner_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_test_runner_service.py index 9c6e5da6..7d142e6b 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_test_runner_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_test_runner_service.py @@ -110,7 +110,11 @@ class ProcessModelTestRunnerMostlyPureSpiffDelegate(ProcessModelTestRunnerDelega f"Executable process cannot be found in {bpmn_file}. Test cannot run." ) 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 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}'" ) 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) error_message = None diff --git a/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-fail/failing_script_task/process_model.json b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-fail/failing_script_task/process_model.json index 23cc190b..527fd516 100644 --- a/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-fail/failing_script_task/process_model.json +++ b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-fail/failing_script_task/process_model.json @@ -6,6 +6,6 @@ "fault_or_suspend_on_exception": "fault", "files": [], "metadata_extraction_paths": null, - "primary_file_name": "failing_task.bpmn", + "primary_file_name": "failing_script_task.bpmn", "primary_process_id": "Process_FailingProcess" } diff --git a/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-fail/failing_script_task/test_failing_script_task.json b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-fail/failing_script_task/test_failing_script_task.json index 0c81e072..76c46108 100644 --- a/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-fail/failing_script_task/test_failing_script_task.json +++ b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-fail/failing_script_task/test_failing_script_task.json @@ -1,3 +1,5 @@ { - "test_case_2": {} + "test_case_2": {}, + "test_case_3": {}, + "test_case_4": {} } diff --git a/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-fail/process_group.json b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-fail/process_group.json new file mode 100644 index 00000000..a3a3aabb --- /dev/null +++ b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-fail/process_group.json @@ -0,0 +1,9 @@ +{ + "admin": false, + "description": "", + "display_name": "Expected To Fail", + "display_order": 0, + "parent_groups": null, + "process_groups": [], + "process_models": [] +} diff --git a/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/script-task/process_model.json b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/script-task/process_model.json index 03d72515..0b972734 100644 --- a/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/script-task/process_model.json +++ b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/script-task/process_model.json @@ -1,11 +1,9 @@ { "description": "", "display_name": "Script Task", - "display_order": 0, "exception_notification_addresses": [], "fault_or_suspend_on_exception": "fault", - "files": [], "metadata_extraction_paths": null, - "primary_file_name": "Script.bpmn", + "primary_file_name": "script_task.bpmn", "primary_process_id": "Process_Script_Task" } diff --git a/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/service-task/process_model.json b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/service-task/process_model.json index b5e63674..4ee529b7 100644 --- a/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/service-task/process_model.json +++ b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/service-task/process_model.json @@ -1,10 +1,9 @@ { - "description": "A.1.0.2", - "display_name": "A.1.0.2 - Service Task", - "display_order": 13, + "description": "Service Task", + "display_name": "Service Task", "exception_notification_addresses": [], "fault_or_suspend_on_exception": "fault", "files": [], - "primary_file_name": "A.1.0.2.bpmn", - "primary_process_id": "Process_test_a102_A_1_0_2_bd2e724" + "primary_file_name": "service_task.bpmn", + "primary_process_id": "ServiceTaskProcess" } diff --git a/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-script-task/process_model.json b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-script-task/process_model.json new file mode 100644 index 00000000..b8654583 --- /dev/null +++ b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-script-task/process_model.json @@ -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" +} diff --git a/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-script-task/sub_process_with_script_task.bpmn b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-script-task/sub_process_with_script_task.bpmn new file mode 100644 index 00000000..2f78c63d --- /dev/null +++ b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-script-task/sub_process_with_script_task.bpmn @@ -0,0 +1,76 @@ + + + + + Flow_0rk8y7w + + + + + End Sub Process with Script Task Unit Test. Variable value: {{x}} + + Flow_0jg5fdg + + + + Flow_0rk8y7w + Flow_0jg5fdg + + Flow_1rxgng2 + + + + Flow_0v4kerg + + + + Flow_1rxgng2 + Flow_0v4kerg + x = 5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-script-task/test_sub_process_with_script_task.json b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-script-task/test_sub_process_with_script_task.json new file mode 100644 index 00000000..9dd62e26 --- /dev/null +++ b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-script-task/test_sub_process_with_script_task.json @@ -0,0 +1,10 @@ +{ + "test_case_1": { + "tasks": { + "Sub_Process_with_Script_Task:Sub_Process_Script_Task": { + "data": [{}] + } + }, + "expected_output_json": { "x": 5 } + } +} diff --git a/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-user-task/get-name-schema.json b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-user-task/get-name-schema.json new file mode 100644 index 00000000..8ba3941e --- /dev/null +++ b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-user-task/get-name-schema.json @@ -0,0 +1,11 @@ +{ + "title": "Get Name", + "description": "Please enter user name.", + "properties": { + "name": { + "type": "string", + "title": "Name" + } + }, + "required": [] +} diff --git a/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-user-task/get-name-uischema.json b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-user-task/get-name-uischema.json new file mode 100644 index 00000000..15237721 --- /dev/null +++ b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-user-task/get-name-uischema.json @@ -0,0 +1,5 @@ +{ + "ui:order": [ + "name" + ] +} diff --git a/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-user-task/process_model.json b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-user-task/process_model.json new file mode 100644 index 00000000..48b1cf87 --- /dev/null +++ b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-user-task/process_model.json @@ -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" +} diff --git a/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-user-task/sub_process_with_user_task.bpmn b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-user-task/sub_process_with_user_task.bpmn new file mode 100644 index 00000000..c8a1ca61 --- /dev/null +++ b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-user-task/sub_process_with_user_task.bpmn @@ -0,0 +1,84 @@ + + + + + Flow_0qgepuv + + + + Flow_0qgepuv + Flow_1457pk3 + + Flow_0vinu5f + + + + Flow_02kn6kb + + + + + + + + + Sub Process User Task. + + Flow_0vinu5f + Flow_02kn6kb + + + + + End Sub Process User Task Unit Test. +Your name is {{name}} + + Flow_1457pk3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-user-task/test_sub_process_with_user_task.json b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-user-task/test_sub_process_with_user_task.json new file mode 100644 index 00000000..a1ff059b --- /dev/null +++ b/spiffworkflow-backend/tests/data/bpmn_unit_test_process_models/expected-to-pass/single-activity-tests/sub-process-with-user-task/test_sub_process_with_user_task.json @@ -0,0 +1,10 @@ +{ + "test_case_1": { + "tasks": { + "Sub_Process:Sub_Process_User_Task": { + "data": [{"name" : "User Task"}] + } + }, + "expected_output_json": {"name" : "User Task"} + } +} diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_test_runner.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_test_runner.py index 068a772a..3c11bf06 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_test_runner.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_test_runner.py @@ -53,7 +53,7 @@ class TestProcessModelTestRunner(BaseTest): with_db_and_bpmn_file_cleanup: None, ) -> None: 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( self,