Skip to main content

Enhance Robot Framework with functional-style keyword chaining. Streamline test cases by piping output of one keyword as input to another, simplifying data flow and readability.

Project description

robotframework-pipe

Version License

Introduction

Pipe is a Robot Framework Library that brings the pipe operator known from functional programming languages into Robot Framework. PipeLibrary is designed to enhance keyword chaining capabilities, it simplifies the process of passing the output of one keyword as an input to another, enabling more readable and maintainable test cases.

Installation

To install PipeLibrary, run the following command:

pip install robotframework-pipe

Usage

Here's a basic example to demonstrate the usage of the PipeLibrary:

*** Settings ***
Library    PipeLibrary

*** Test Cases ***
Complex Operation With Pipe
    Pipe    Get User Id    username
    ...    >>    Fetch User Details
    ...    >>    Process Data
    ...    >>    Validate User
    ...    >>    Log

Without Pipe, the same example would require intermediate variables:

Complex Operation Without Pipe
    ${user_id} =    Get User Id    username
    ${user_details} =    Fetch User Details    ${user_id}
    ${processed_data} =    Process Data    ${user_details}
    ${status} =    Validate User    ${processed_data}
    Log    ${status}

The PipeLibrary simplifies the process by removing the need for intermediate variables and making the flow of data between keywords more intuitive and cleaner.

Syntax Explanation

  • Pipe: The main keyword of the PipeLibrary.
  • >>: The pipe operator, used to chain keywords.
  • Placeholder: A symbol (default $) used to denote where the output of the previous keyword should be placed in the next keyword's argument list. This is optional.

By default, the result of the keyword is used as the first argument of the next keyword. You can use the Placeholder to explicitly set the argument or import the PipeLibrary with the argument pipe_strategy=append to use the result as the last argument by default.

Examples

You can find more examples in the /tests directory.

Using Placeholder

My Test Case
    Pipe    Sum    1    2
    ...    >>    Subtract    4    $
    ...    >>    Should be Equal As Integers    1

In this example, $ is replaced with the result of Sum, so Subtract is called as Subtract 4 3.

Configuration

You can initialize the library with custom settings:

*** Settings ***
Library    PipeLibrary    pipe_strategy=append    placeholder=$    pipe_operator=>>

Note

Currently, PipeLibrary does not support keyword syntax highlighting and autocompletion in the Robot Framework environment. This is due to the dynamic nature of the pipe operator and the way arguments are passed between keywords.

Contributions

Contributions to PipeLibrary are welcome! If you have suggestions for improvements or have identified a bug, please feel free to open an issue or submit a pull request on our GitHub repository.

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_pipe-0.1.2.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

robotframework_pipe-0.1.2-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file robotframework_pipe-0.1.2.tar.gz.

File metadata

  • Download URL: robotframework_pipe-0.1.2.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.6 Darwin/23.2.0

File hashes

Hashes for robotframework_pipe-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e049d59c237de9765a8967592eccf7e5e6d0901245c011a5c6973e00a1ab0692
MD5 7fd1a8a66842747102c4697115710d48
BLAKE2b-256 269e37c39b9d35d3fe59fccf9d94ae19a52d360a883cbb6e788825a97ad0c3ff

See more details on using hashes here.

File details

Details for the file robotframework_pipe-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for robotframework_pipe-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 87397cd8cd9fea2e6f9117a974846da888a0f7de57f96c1928ba76d22606149f
MD5 d834c44d9dc02daedc6542b08d15f7fd
BLAKE2b-256 2eb2c3d843b7d019fe2107cb7b7ddb4542a681e1bb16581af4911af7efe3d8e9

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