Robot Framework Keywords for processcube workflow engine.
Project description
Verwendung des Robot Framework mit der 5Minds-Engine
- Voraussetzung
- Verwendung
Voraussetzung
Um Tests auf Basis der Robot Framework für die BPMN-basierte-Workflowengine 5Minds-Engine zu erstellen, sind folgende Voraussetzung erforderlich:
- 5Minds-Studio in der stabilen Version ist installiert
- 5Minds-Studio ist gestartet
- 5Minds-Engine ist durch das Studio auf dem Port
56000
gestartet
Alternative kann Docker für die 5Minds-Engine verwendet werden, dann sind folgende Vorausetzungen notwendig:
- Docker-Desktop ist installiert und gestartet
- Zugang zum Internet für den Download des Image 5minds/atlas_engine_fullstack_server
Für die Ausführung von Tests ist dann noch folgende Voraussetzung notwendig:
- Python in der Version
>=3.7.x
ist installiert und im Pfad konfiguriert - Robot-Framework für die 5Minds-Engine ist installiert
pip install robotframework-processcube
Für die Bearbeitung ist VS Code und der Robot Framework Language Server hilfreich.
Verwendung
Um die Keywords für die Interaktion mit der 5Minds-Engine verwenden zu können, ist die
Library ProcessCubeLibrary einzubinden.
Für die Verwendung mit dem 5Minds-Studio (ohne Docker) ist die URL für die Engine mit
dem Paramter engine_url
zu konfiguieren, dies ist für die stabile Version der
Studio-Engine http://localhost:56000
.
Mit dem 5Minds-Studio ist folgende Verwendung zu verwenden.
*** Settings ***
Library ProcessCubeLibrary engine_url=http://localhost:56000
Für die weiteren Beispiele wird Docker verwendet und dann ist folgende Einstellung zu ändern:
*** Variables ***
&{DOCKER_OPTIONS} auto_remove=False
*** Settings ***
Library ProcessCubeLibrary self_hosted_engine=docker docker_options=${DOCKER_OPTIONS}
Die Engine im Docker-Container wird standardmäßig mit dem Port 55000
gestartet. Die URL zum
Einbinden ins Studio ist also http://localhost:55000
.
BPMN-Datei in 5Minds-Engine laden
Zuerst ist ein BPMN-Diagram (z.B. processes/hello_minimal.bpmn
zu erstellen.
Mit dem Keyword Deploy Processmodel
und der Angabe des Dateipfades wird das BPMN-Diagram in die 5Minds-Engine geladen.
*** Variables ***
&{DOCKER_OPTIONS} auto_remove=False
*** Settings ***
Library ProcessCubeLibrary self_hosted_engine=docker docker_options=${DOCKER_OPTIONS}
*** Tasks ***
Successfully deploy
Deploy Processmodel processes/hello_minimal.bpmn
Prozessmodell starten
Wie unter BPMN-Datei in 5Minds-Engine laden beschrieben, muss die BPMN-Datei vorhanden sein.
Mit dem Keyword Start Processmodel
und der Angabe der Process ID hello_minimal
wird eine Prozessinstanz gestartet.
*** Variables ***
&{DOCKER_OPTIONS} auto_remove=False
*** Settings ***
Library ProcessCubeLibrary self_hosted_engine=docker docker_options=${DOCKER_OPTIONS}
Library Process
*** Tasks ***
Successfully deploy
Deploy Processmodel processes/hello_minimal.bpmn
Start process model
Start Processmodel hello_minimal
Ergebnisse von beendeten Prozessen abfragen
Nachdem der Prozess gestartet wurde, kann mit dem Keyword Get Processinstance Result
das Ergebnis
der Prozessinstanz abgefragt werden.
*** Variables ***
&{DOCKER_OPTIONS} auto_remove=False
${CORRELATION} -1
*** Settings ***
Library ProcessCubeLibrary self_hosted_engine=docker docker_options=${DOCKER_OPTIONS}
Library Collections
*** Tasks ***
Successfully deploy
Deploy Processmodel processes/hello_minimal.bpmn
Start process model
&{PAYLOAD}= Create Dictionary foo=bar hello=world
${PROCESS_INSTANCE}= Start Processmodel hello_minimal ${PAYLOAD}
Set Suite Variable ${CORRELATION} ${PROCESS_INSTANCE.correlation_id}
Log ${CORRELATION}
Get the process instance
${RESULT} Get Processinstance Result correlation_id=${CORRELATION}
Log ${RESULT}
Verarbeiten von Aktivitäten
Umgang mit untypisierten Tasks (Empty-Tasks)
Um bei der Entwicklung von Aktivitäten mit noch untypisierten Tasks
zu beginnen, stehen die Keywords Get Empty Task By
fürs Laden und
Finish Empty Task
zum Abschließen zur Verfügung.
Für diesen Test wird eine andere BPMN-Datei verwendet hello_empty_task.bpmn
.
*** Variables ***
&{DOCKER_OPTIONS} auto_remove=False
${CORRELATION} -1
*** Settings ***
Library ProcessCubeLibrary self_hosted_engine=docker docker_options=${DOCKER_OPTIONS}
Library Collections
*** Tasks ***
Successfully deploy
Deploy Processmodel processes/hello_empty_task.bpmn
Start process model
&{PAYLOAD}= Create Dictionary foo=bar hello=world
${PROCESS_INSTANCE}= Start Processmodel hello_empty_task ${PAYLOAD}
Set Suite Variable ${CORRELATION} ${PROCESS_INSTANCE.correlation_id}
Log ${CORRELATION}
Handle empty task by correlation_id
Log ${CORRELATION}
${EMPTY_TASK} Get Empty Task By correlation_id=${CORRELATION}
Log ${EMPTY_TASK.empty_task_instance_id}
Finish Empty Task ${EMPTY_TASK.empty_task_instance_id}
Get the process instance
${RESULT} Get Processinstance Result correlation_id=${CORRELATION}
Log ${RESULT}
Umgang mit manuellen Tasks (Manual-Tasks)
Als Basis für den Umgang mit manuellen Task wird die BPMN-Datei
hello_manual_task.bpmn
benötigt.
Für das Laden vom manuellen Taak dient das Keyword Get Manual Task By
und
für das Beenden Finish Manual Task
.
*** Variables ***
&{DOCKER_OPTIONS} auto_remove=False
${CORRELATION} -1
*** Settings ***
Library ProcessCubeLibrary self_hosted_engine=docker docker_options=${DOCKER_OPTIONS}
Library Collections
*** Tasks ***
Successfully deploy
Deploy Processmodel processes/hello_manual_task.bpmn
Start process model
&{PAYLOAD}= Create Dictionary foo=bar hello=world
${PROCESS_INSTANCE}= Start Processmodel hello_manual_task ${PAYLOAD}
Set Suite Variable ${CORRELATION} ${PROCESS_INSTANCE.correlation_id}
Log ${CORRELATION}
Handle manual task by correlation_id
Log ${CORRELATION}
${MANUAL_TASK} Get Manual Task By correlation_id=${CORRELATION}
Log ${MANUAL_TASK.manual_task_instance_id}
Finish Manual Task ${MANUAL_TASK.manual_task_instance_id}
Get the process instance
${RESULT} Get Processinstance Result correlation_id=${CORRELATION}
Log ${RESULT}
Umgang mit Benutzer-Tasks (User-Tasks)
Um den Umgang mit Benutzer-Task zu testen ist die BPMN-Datei hello_user_task.bpmn
notwendig.
Mit dem Keyword Get User Task By
können User-Tasks geladen und
mit dem Keyword Finish User Task
beendet werden.
*** Variables ***
&{DOCKER_OPTIONS} auto_remove=False
${CORRELATION} -1
*** Settings ***
Library ProcessCubeLibrary self_hosted_engine=docker docker_options=${DOCKER_OPTIONS}
Library Collections
*** Tasks ***
Successfully deploy
Deploy Processmodel processes/hello_user_task.bpmn
Start process model
&{PAYLOAD}= Create Dictionary foo=bar hello=world
${PROCESS_INSTANCE}= Start Processmodel hello_user_task ${PAYLOAD}
Set Suite Variable ${CORRELATION} ${PROCESS_INSTANCE.correlation_id}
Log ${CORRELATION}
Handle User Task by correlation_id
Log ${CORRELATION}
${USER_TASK} Get User Task By correlation_id=${CORRELATION}
Log ${USER_TASK}
Should Not Be Empty ${USER_TASK.user_task_instance_id}
Should Be Equal ${USER_TASK.process_model_id} hello_user_task
&{ANSWER}= Create Dictionary field_01=from user task
Finish User Task ${USER_TASK.user_task_instance_id} ${ANSWER}
Get the process instance
${RESULT} Get Processinstance Result correlation_id=${CORRELATION}
Log ${RESULT}
Umgang mit External-Tasks
Um den Umgang mit External-Task zu testen ist die BPMN-Datei hello_external_task.bpmn
notwendig.
Mit dem Keyword Get External Task
können User-Tasks geladen und
mit dem Keyword Finish External Task
beendet werden.
*** Variables ***
&{DOCKER_OPTIONS} auto_remove=False
${CORRELATION} -1
*** Settings ***
Library ProcessCubeLibrary self_hosted_engine=docker docker_options=${DOCKER_OPTIONS}
Library Collections
*** Tasks ***
Successfully deploy
Deploy Processmodel processes/hello_external_task.bpmn
Start process model
&{PAYLOAD}= Create Dictionary foo=bar hello=world
${PROCESS_INSTANCE}= Start Processmodel hello_external_task ${PAYLOAD}
Set Suite Variable ${CORRELATION} ${PROCESS_INSTANCE.correlation_id}
Log ${CORRELATION}
Handle External Task
${TASK} Get External Task topic=doExternal
&{ANSWER}= Create Dictionary external_field_01=The Value of field 1
Log ${TASK.id}
Finish External Task ${TASK.id} ${ANSWER}
Get the process instance
${RESULT} Get Processinstance Result correlation_id=${CORRELATION}
Log ${RESULT}
Umgang mit Ereignissen (Events)
Beim Umgang mit Ereignissen, muss zwischen Signalen und Nachrichten unterschieden werden.
Signale
Um mit Ereignissen der BPMN-Module zu interagieren, muss die BPMN-Datei
hello_signal.bpmn
verwendet werden.
Das Keyword für das Auslösen von Signale ist Send Signal
.
*** Variables ***
&{DOCKER_OPTIONS} auto_remove=False
${CORRELATION} -1
*** Settings ***
Library ProcessCubeLibrary self_hosted_engine=docker docker_options=${DOCKER_OPTIONS}
Library Collections
*** Tasks ***
Successfully deploy
Deploy Processmodel processes/hello_signal.bpmn
Start process model
&{PAYLOAD}= Create Dictionary foo=bar hello=world
${PROCESS_INSTANCE}= Start Processmodel hello_signal ${PAYLOAD}
Set Suite Variable ${CORRELATION} ${PROCESS_INSTANCE.correlation_id}
Log ${CORRELATION}
Send Signal
Send Signal catch_signal delay=0.2
Get the process instance
${RESULT} Get Processinstance Result correlation_id=${CORRELATION}
Log ${RESULT}
Nachrichten (Messages)
Um mit Ereignissen der BPMN-Module zu interagieren, muss die BPMN-Datei
hello_message.bpmn
verwendet werden.
Das Keyword für das Auslösen von Signale ist Send Message
.
*** Variables ***
&{DOCKER_OPTIONS} auto_remove=False
${CORRELATION} -1
*** Settings ***
Library ProcessCubeLibrary self_hosted_engine=docker docker_options=${DOCKER_OPTIONS}
Library Collections
*** Tasks ***
Successfully deploy
Deploy Processmodel processes/hello_message.bpmn
Start process model
&{PAYLOAD}= Create Dictionary foo=bar hello=world
${PROCESS_INSTANCE}= Start Processmodel hello_message ${PAYLOAD}
Set Suite Variable ${CORRELATION} ${PROCESS_INSTANCE.correlation_id}
Log ${CORRELATION}
Send Message
&{PAYLOAD}= Create Dictionary message_field1=Value field 1 message_field2=Value field 2
Send Message catch_message ${PAYLOAD} delay=0.5
Get the process instance
${RESULT} Get Processinstance Result correlation_id=${CORRELATION}
Log ${RESULT}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for robotframework-processcube-1.3.1a2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e336e55ed2fa6c48445df78c83b7e1bc18b4994a96ef677fb8748ca72f09acc |
|
MD5 | 1c42419df510455732d432e45efe1d4b |
|
BLAKE2b-256 | 914ed38c895a4fbdd89c3e086912fc528001ef12823ea391a076bd87ea9a6487 |
Hashes for robotframework_processcube-1.3.1a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ce4e106400cd7abb49fcb53d7b6d1cb0ba0b98012140aa3c8d85e90fa58dcde |
|
MD5 | 2523253494e0225e265a75c277644900 |
|
BLAKE2b-256 | f6ae5e0f8ec92b09c7f94327ecaf1f882d327dd3e02b8a2172a927865b65b819 |