Skip to main content

Keywords for camunda rest api, leading open source workflow engine.

Project description

PyPI status pipeline status PyPi license PyPi version PyPI pyversions PyPI download month

Robot Framework Camunda

This library provides keywords for accessing camunda workflow engine. Complete REST API reference of camunda can be found here.

Please review issue board for known issues or report one yourself. You are invited to contribute pull requests.

Documentation

Keyword documentation is provided here

Installation

The library is published on pypi.org and can be installed with pip:

pip install robotframework-camunda

Running robotframework-camunda

The tests folder has example robot tests for keywords already implemented. Those tests assume you already have an instance of camunda running.

Easiest way of running camunda is to launch with with docker:

docker run -d --name camunda -p 8080:8080 camunda/camunda-bpm-platform:run-latest

Deploy process definition

*** Settings ***
Library    CamundaLibrary    ${CAMUNDA_HOST}

*** Variables ***
${CAMUNDA_HOST}    http://localhost:8080
${MODEL_FOLDER}    ${CURDIR}/../models

*** Test Cases ***
Test deployment of a single model in 1 deployment
    ${response}    deploy    ${MODEL_FOLDER}/demo_for_robot.bpmn

Test deployment of several models in 1 deployment
    ${response}    deploy    ${MODEL_FOLDER}/demo_for_robot.bpmn    ${MODEL_FOLDER}/demo_embedded_form.html

Starting a process instance

*** Settings ***
Library    CamundaLibrary    ${CAMUNDA_HOST}

*** Variables ***
${CAMUNDA_HOST}    http://localhost:8080

*** Test Cases ***
Test starting process
    #GIVEN
    ${process_definition_key}    Set Variable    demo_for_robot

    # WHEN
    ${process_instance}    start process    ${process_definition_key}

Execute Task

"Executing task" bascialy means, you execute a robot task that fetches a workload from camunda, processes it and returns its workload back to camunda during completion. Main keywords involved are:

  1. CamundaLibrary.Fetch workload
  2. CamundaLibrary.Complete Task
*** Settings ***
Library    CamundaLibrary    ${CAMUNDA_HOST}
Library    Collections

*** Variables ***
${CAMUNDA_HOST}    http://localhost:8000
${existing_topic}    process_demo_element

*** Test Cases ***
Process workload
    ${variables}    fetch workload   topic=${existing_topic}
    ${recent_task}    Get fetch response
    log    Recent task:\t${recent_task}

    Pass Execution If    not ${recent_task}    No workload fetched from Camunda
 
    # do some processing
    
    # create result and return workload to Camunda
    ${my_result}    Create Dictionary    lastname=Stahl
    complete task   ${my_result}

Authentication

Prerequisite: CamundaLibrary >= 2.0

If your Camunda Platform REST API requires authentication (it should at least in production!) then you do not need to pass the host url to CamundaLibrary during intialization. You require the Set Camunda Configuration keyword. The keyword expects a dictionary with host url and (optional) either username with password or api key with optional api key prefix. See the following example.

*** Settings ***
Library    CamundaLibrary


*** Test Cases ***
Demonstrate basic auth
    ${camunda_config}    Create Dictionary    host=http://localhost:8080    username=markus    password=%{ENV_PASSWORD}
    Set Camunda Configuration    ${camunda_config}
    ${deployments}    Get deployments    #uses basic auth now implictly

Demonstrate Api Key
    ${camunda_config}    Create Dictionary    host=http://localhost:8080    api_key=%{ENV_API_KEY}   api_key_prefix=Bearer
    Set Camunda Configuration    ${camunda_config}
    ${deployments}    Get deployments    #uses api key implicitly

If you would pass in username+password and and API key, the API key will always be chosen over the username+password. So better leave it out for not confusing everybody.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotframework-camunda-2.0.1.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

robotframework_camunda-2.0.1-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file robotframework-camunda-2.0.1.tar.gz.

File metadata

  • Download URL: robotframework-camunda-2.0.1.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for robotframework-camunda-2.0.1.tar.gz
Algorithm Hash digest
SHA256 6b7c4ce010ae1902a1bd555be6f0f82b3f5e7d1ce5830c86808d9a5b0816b2e8
MD5 821c5fd54f380473e169c18c69226311
BLAKE2b-256 891878795a5f4d16da01acfeea8ed2264d5c6dd95bb52d670aca50f124e0f734

See more details on using hashes here.

Provenance

File details

Details for the file robotframework_camunda-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: robotframework_camunda-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 19.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for robotframework_camunda-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7523e7566fa975ed0d8712825302a6879ec04a80e99aa896cf668904767ca72e
MD5 baa7dacdef56400d39093401dc1e5458
BLAKE2b-256 19485560373d2a087aba3025d31e9fb4a0603997a2a0e51c96b584b9730f5b04

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page