Skip to main content

Overhave - web-framework for BDD

Project description

Overhave framework

Web-framework for BDD: scalable, configurable, easy to use, based on Flask Admin and Pydantic.

Features

  • Ready web-interface for easy BDD features management with Ace editor

  • Traditional Gherkin format for scenarios provided by pytest-bdd

  • Execution and reporting of BDD features based on PyTest and Allure

  • Auto-collection of pytest-bdd steps and display on the web-interface

  • Simple business-alike scenarios structure, easy horizontal scaling

  • Ability to create and use several BDD keywords dictionary with different languages

  • Versioning and deployment of scenario drafts to Bitbucket

  • Built-in configurable management of users and groups permissions

  • Configurable strategy for user authorization, LDAP also provided

  • Database schema based on SQLAlchemy models and works with PostgreSQL

  • Still configurable as Flask Admin, supports plug-ins and extensions

  • Distributed producer-consumer architecture based on Redis streams through Walrus (partially integrated)

  • Web-browser emulation ability with custom toolkit (GoTTY, for example)

  • Simple command-line interface, provided with Click

Installation

You can install Overhave via pip from PyPI:

pip install overhave

Overview

Web-interface

The web-interface is a basic tool for BDD features management. It consists of:

  • Info - index page with optional information about your tool or project;

  • Scenarios - section for features management, contains subsections

    Features, Test runs and Versions:

    • Features

      gives an interface for features records management and provides info about id, name author, time, editor and publishing status; it is possible to search, edit or delete items through interface;

    • Test runs

      gives an interface for test runs management and provides info about

      Script panel
    • Versions

      contains feature versions for corresponding to test runs.

  • Access - section for access management, contains Users and

    Groups subsections;

  • Emulation - experimental section for alternative tools implementation

    (in developing).

Overhave features could be created and/or edited through special script panel in feature edit mode. Feature should have type registered by the application, unique name, specified tasks list with the traditional format `PRJ-NUMBER` and scenario text.

Script panel has pytest-bdd steps table on the right side of interface. These steps should be defined in appropriate fixture modules and registered at the application on start-up to be displayed.

Script panel

Example of Overhave script panel in feature edit mode

Command-line interface

Overhave has a CLI that provides a simple way to start service web-interface, run consumer and execute basic database operations. Examples are below:

overhave db create-all
overhave admin --port 8080
overhave consumer -s EMULATION

Note: service start-up takes a set of settings, so you can set them through virtual environment with prefix `OVERHAVE_`, for example `OVERHAVE_DB_URL`. If you want to configure settings in more explicit way through context injection, please see next part of docs.

Context injection

Context setting

Service could be configured via application context injection with prepared instance of OverhaveContext object. This context should be set using `overhave_core.set_context` function.

For example, `my_custom_context` prepared. So, application start-up could be realised with follow code:

from overhave import overhave_app, overhave_core

overhave_core.set_context(my_custom_context)
overhave_app().run(host='localhost', port=8080, debug=True)

Note:

  • `overhave_app` is the prepared Flask application with already enabled

    Flask Admin and Login Manager plug-ins;

  • `overhave_core` is a cached instance of the Overhave factory, has an

    access to application components, directly used in `overhave_app`.

  • `my_custom_context` is an example of context configuration, see an

    example code in context_example.rst.

Import context in PyTest

Overhave has it’s own built-in PyTest plugin, which is used to enable and configure injection of prepared context into application core `overhave_core`. The plugin provides two options:

  • –enable-injection - flag to enable context injection;

  • –ctx-module - option specifying path to Python module with context injection.

The module with context injection should contain `overhave_core.set_context` function, but this module should be unique and created only for PyTest usage instead of web-interface start-up.

For example, `module_with_injection.py` module contains:

from overhave import overhave_core

overhave_core.set_context(my_custom_context)

And PyTest usage should be similar to:

pytest --enable-injection --ctx-module=module_with_injection

Specified module will be imported before tests start-up (with `pytest_configure` PyTest hook).

Features structure

Overhave supports it’s own special structure of features storage:

Features structure example

Base features directory could contain different feature types as separate directories, each of them corresponds to predefined pytest-bdd set of steps. It is possible to create your own horizontal structure of different product directions with unique steps and PyTest fixtures.

Note: this structure is used in Overhave application. The formed data gives a possibility to specify registered feature type in the web-interface script panel. Also, this structure defines which steps will be displayed in the rigth side of script panel.

Feature format

Overhave has it’s own special feature’s text format, which inherits Gherkin from pytest-bdd with small updates:

  • required tag that is related to existing feature type directory, where

    current feature is located;

  • info about feature - who is creator, last editor and publisher;

  • task tracker’s tickets with traditional format `PRJ-NUMBER`.

An example of filled feature content is located in feature_example.rst.

Language

The web-interface language is ENG by default and could not be switched (if it’s necessary - please, create a `feature request` or contribute yourself).

The feature text as well as pytest-bdd BDD keywords are configurable with Overhave extra models, for example RUS keywords are already defined in framework and available for usage:

from overhave.extra import RUSSIAN_PREFIXES, RUSSIAN_TRANSLIT_PACK

language_settings = OverhaveLanguageSettings(
    step_prefixes=RUSSIAN_PREFIXES,
    translit_pack=RUSSIAN_TRANSLIT_PACK
)

Note: you could create your own prefix-value mapping for your language:

from overhave import StepPrefixesModel

GERMAN_PREFIXES = StepPrefixesModel(
    FEATURE="Merkmal:",
    SCENARIO_OUTLINE="Szenarioübersicht:",
    SCENARIO="Szenario:",
    BACKGROUND="Hintergrund:",
    EXAMPLES="Beispiele:",
    EXAMPLES_VERTICAL="Beispiele: Vertikal",
    GIVEN="Gegeben ",
    WHEN="Wann ",
    THEN="Dann ",
    AND="Und ",
    BUT="Aber ",
)

Custom index

Overhave gives an ability to set custom index.html file for rendering. Path to file could be set through environment as well as set with context:

admin_settings = OverhaveAdminSettings(
    index_template_path="/path/to/index.html"
)

Authorization strategy

Overhave provides several authorization strategies, declared by `AuthorizationStrategy` enum:

  • Simple - strategy without real authorization.

    Every user could use preferred name. This name will be used for user authority. Every user is unique. Password not required.

  • Default - strategy with real authorization.

    Every user could use only registered credentials.

  • LDAP - strategy with authorization using remote LDAP server.

    Every user should use his LDAP credentials. LDAP server returns user groups. If user in default ‘admin’ group or his groups list contains admin group - user will be authorized. If user already placed in database - user will be authorized too. No one password stores.

Appropriate strategy and additional data should be placed into `OverhaveAuthorizationSettings`, for example LDAP strategy could be configured like this:

auth_settings=OverhaveAuthorizationSettings(
    auth_strategy=AuthorizationStrategy.LDAP, admin_group="admin"
)

Contributing

Contributions are very welcome.

Preparation

Project installation is very easy and takes just few prepared commands (make pre-init works only for Ubuntu; so you can install same packages for your OS manually):

make pre-init
make init

Packages management is provided by Poetry.

Check

Tests can be run with Tox. Docker-compose is used for other services preparation and serving, such as database. Simple tests and linters execution:

docker-compose up -d db
make test
make lint

Please, see make file and discover useful shortcuts. You could run tests in docker container also:

make test-docker

Documentation build

Project documentation could be built via Sphinx and simple make command:

make build-docs

By default, the documentation will be built using html builder into _build directory.

License

Distributed under the terms of the GNU GPLv2 license.

Issues

If you encounter any problems, please report them here in section Issues with a detailed description.

Project details


Release history Release notifications | RSS feed

This version

1.2.0

Download files

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

Source Distribution

overhave-1.2.0.tar.gz (203.6 kB view details)

Uploaded Source

Built Distribution

overhave-1.2.0-py3-none-any.whl (238.1 kB view details)

Uploaded Python 3

File details

Details for the file overhave-1.2.0.tar.gz.

File metadata

  • Download URL: overhave-1.2.0.tar.gz
  • Upload date:
  • Size: 203.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.7 Linux/5.4.0-1039-azure

File hashes

Hashes for overhave-1.2.0.tar.gz
Algorithm Hash digest
SHA256 7513ccea9625a744965da782d8925eb7b704ff1f8f4cbadac876389b06c4b87f
MD5 aa7870deae05922c6039ed3c60657e24
BLAKE2b-256 c99780482900038ecf19e378461870c1837e24e669b62f212c110569959be5d5

See more details on using hashes here.

File details

Details for the file overhave-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: overhave-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 238.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.7 Linux/5.4.0-1039-azure

File hashes

Hashes for overhave-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a3abe56a7fd3b1245d427eb47001551c648d957a04b690d86df0d6b8b6a4110
MD5 0f48620bc868de8c4c2b62da3bcc03c9
BLAKE2b-256 dc07b00ed679164ef06b9c31d72ed42bea3bddef8d61addaba1e8687d0447233

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