Giter Club home page Giter Club logo

robotframework-gherkin-parser's Introduction

Robot Framework Gherkin Parser: Quick Overview

The Robot Framework Gherkin Parser enables seamless integration of Gherkin feature files with the Robot Framework, facilitating behavior-driven development (BDD) with ease. This integration not only allows for the flexible execution of Gherkin feature files alongside Robot Framework test files but also highlights the complementary strengths of both approaches. Gherkin feature files, with their less technical and more scenario-focused syntax, emphasize the behavioral aspects of what is being tested, rather than the how. In contrast, Robot Framework test files tend to be more technical, focusing on the step-by-step implementation of test scenarios through keyword sequences.

Utilizing a slightly modified version of the official Cucumber Gherkin Parser, this custom parser implementation ensures the direct execution of Gherkin scenarios within the Robot Framework environment. This supports efficient transitions to and from BDD practices, catering to both technical and non-technical stakeholders by bridging the gap between business requirements and technical implementation.

The Robot Framework Gherkin Parser simplifies test step implementation, allowing technical testers to implement test steps in the Robot Framework's keyword-driven language. This is particularly beneficial when compared to the traditional BDD approach, which might require complex programming skills for step definitions in languages such as Java or C#. The parser thereby reduces the barrier to BDD test creation and maintenance, making it more accessible.

Core Features

  • Focus on Behavioral Testing: Gherkin feature files allow for specifying test scenarios in a less technical, more narrative form, focusing on what needs to be tested rather than how it is to be tested. This complements the more technically oriented Robot Framework test files, providing a balanced approach to defining and executing tests.
  • User-Friendly Test Implementation: Technical testers can easily implement test steps in the Robot Framework's intuitive language, avoiding the complexity of traditional programming languages for BDD step definitions.
  • Efficient Execution and Porting: Enables direct execution and easy porting of Gherkin feature files, bridging the gap between Gherkin's scenario-focused syntax and the Robot Framework's technical implementation.
  • Seamless Development Environment: The inclusion of a plugin/extension for RobotCode enhances the development and testing process within Visual Studio Code, offering integrated tools tailored for both BDD and automated testing.

Designed for teams leveraging the Robot Framework and looking to integrate or enhance their BDD methodology, the Robot Framework Gherkin Parser facilitates a comprehensive testing strategy. It encourages a collaborative testing environment by simplifying the creation of BDD tests and improving testing efficiency and flexibility.

Explore the subsequent sections for details on integrating this parser into your testing strategy, optimizing its usage, and contributing to its development.

Requirements

Only the Parser

  • Python 3.8 or above
  • Robotframework 7.0 and above

For Support in VSCode

  • VSCode version 1.82 and above

Installation

The Robot Framework Gherkin Parser can be installed using the following methods:

  • Pip: The parser can be installed using pip, the Python package manager. Run the following command to install the parser:

    pip install robotframework-gherkin-parser

If you are using the RobotCode extension for VSCode as your IDE, you can install the RobotCode GherkinParser Support extension from the VSCode Marketplace.

Usage

On command line

To execute .feature files using the Robot Framework Gherkin Parser on command line, you need to use the robot command line option --parser to specify the parser to be used. The following command demonstrates how to execute a .feature file using the Robot Framework Gherkin Parser:

robot --parser GherkinParser path/to/your/feature/file.feature

IDE

Visual Studio Code with RobotCode extension

If the plugin-extension for RobotCode GherkinParser Support extension is installed in VSCode

By creating a robot.toml file in your project root and adding the following configuration:

[parsers]
GherkinParser=[]

NOT IMPLEMENTED YET: You can enable the GherkinParser by the VSCode Setting: robotcode.robot.parsers

Examples

The following example demonstrates a simple Gherkin feature file that can be executed using the Robot Framework Gherkin Parser:

Create a folder named features in your project root. Create a file named calculator.feature in the folder features with the following content:

Feature: Calculator
  As a user
  I want to use a calculator
  So that I can perform basic arithmetic operations

  Scenario: Add two numbers
    Given I have entered 50 into the calculator
    And I have entered 70 into the calculator
    When I press add
    Then the result should be 120 on the screen

To execute the calculator.feature file using the Robot Framework Gherkin Parser on command line, run the following command:

robot --parser GherkinParser features/calculator.feature

If your are using VSCode + RobotCode + RobotCode GherkinParser Support, you can run the test by clicking on the play buttons in the feature file.

Contributing

TODO

robotframework-gherkin-parser's People

Contributors

d-biehl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

maheenkannooz

robotframework-gherkin-parser's Issues

[BUG] Documentation of Scenario is not visible in Robot Framework logs

Describe the bug
The documentation of the scenario is not inside the log file of Robot Framework

To Reproduce
Steps to reproduce the behavior:

  1. Execute the example code
  2. Check report.html and log.html
  3. The text "Dokumentation zum Szenario" is not available

If possible add some example source code like:


  Feature Description

  @regression
  Scenario: Usual Login
    Dokumentation zum Szenario
    Given Application Is Started
    Then Default User Is Logged In

Expected behavior
The documentation of scenario should be displayed in log files of Robot Framework.

Screenshots/ Videos
image
image

Desktop (please complete the following information):

  • VS Code Version 1.86.1
  • RobotCode Version 0.73.3
  • RobotCode GherkinParser Support v0.3.2 (pre-release)
  • OS: Windows
  • Python Version 3.11.1
  • RobotFramework Version 7.0.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.