Skip to main content

Webservice for running Robot Framework tasks

Project description

PyPi license PyPI pyversions PyPI download month

Robot Task Webservice

A web service managing Robot Framework tasks.

Goal

This web service shall start Robot Framework tasks and return and cache the according reports.

Installation and Execution

Default docker image does not support variable files, yet

Docker

docker pull ghcr.io/marketsquare/robotframework-webservice:master

After that you can run the image and map your test cases in to the webservice with a volumen:

docker run -v <host directory of test cases>:/robot/tests --env SUITE_FOLDER=tests rf-webservice:latest

Podman

Almost as Docker, but you might need to attach the webservice to the host network:

podman run --network host -v ./tasks:/robot/tasks --env SUITE_FOLDER=tasks rf-webservice:latest

Local

pip install robotframework-webservice

and execute from command line:

python -m RobotFrameworkService.main -p 5003 -t path_to_my_taskfolder

Usage

There are 2 types of endpoints:

  1. Execution
  2. Reporting

Execution

Endpoints that trigger execution of a robot task, for instance:

Call robot task:

http://localhost:5003/robotframework/run/mytask

Call robot task with variables:

http://localhost:5003/robotframework/run/mytask?myVariable1=42&anotherVariable=Mustermann

Response contains a header field x-request-id that can be used to retrieve logs and reports of this execution asynchronously (see reporting endpoints)

There are endpoints for synchronous and asynchronous request:

# connection remains open for duration of my task
http://localhost:5003/robotframework/run/mytask

# connection closes immediately - result must be requested with the x-request-id
http://localhost:5003/robotframework/run/mytask/async

There is no limitation on executed Robot processes! It is easy to push the webservice in DOS with too many requests at once

Reporting

Endpoints that provide log.html and report.html for a specific task execution. You require the x-request-id from a previous response that triggered the execution.

Start web service

The web service starts automatically with uvicorn inside. Simply call:

python -m RobotFrameworkService.main

You can check available options with

python -m RobotFrameworkService.main --help

Example:

python -m RobotFrameworkService.main -p 5003 -t path_to_my_taskfolder

Example - Variablefiles:

You can provide variable files that are passed to all robot suites on execution:

python -m RobotFrameworkService.main -p 5003 -t path_to_my_taskfolder --variablefiles config/env/test.py

Custom WSGI server

You can start RobotFrameworkService with bare WSGI servers:

uvicorn RobotFrameworkService.main:app --port 5003

Or start web service with other WSGI server, i.e waitress:

waitress-serve --port 5003 RotbotFrameworkService.main:app

SwaggerUi

Swagger-UI is available under http://localhost:5003/docs

Demo-Tasks

This project contains some tasks for demonstration. They are located in tasks folder. You may add your own task suites in that directory, if you like.

Task name with spaces in URL

Tasks may contain spaces, URL must not. Luckily, Robot Framework supports CamelCase as well as snake_case syntax. Meaning: "Another Task" can be trigger in url with parameter AnotherTask or another_task

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-webservice-0.10.0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file robotframework-webservice-0.10.0.tar.gz.

File metadata

File hashes

Hashes for robotframework-webservice-0.10.0.tar.gz
Algorithm Hash digest
SHA256 e7c553e2b720440c85cb315a3a85d37697a659c55b5596de971668cc4131e390
MD5 c1e153efbdf182b6bb855b75ae23644b
BLAKE2b-256 d4482d42244038b9d1a47ce3df0b1104c8102fc76907997324595db4b3ed8cb4

See more details on using hashes here.

File details

Details for the file robotframework_webservice-0.10.0-py3-none-any.whl.

File metadata

File hashes

Hashes for robotframework_webservice-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9229631dbabf5e343b728ff0583a9e810c3a9dc0ce857907a8980c90de12e20f
MD5 677ad9ce40c9d41960adf5853b0323c5
BLAKE2b-256 b3e8b652b49dbb30c9a9c685ddc42346bd399a87b457a2c2200740f02cf108d1

See more details on using hashes here.

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