Skip to main content

BDD-style Rest API testing tool

Project description

BDD-style Rest API testing tool

It uses python’s requests for performing HTTP requests, nose for most assertions, trafaret for json validation and behave for BDD style of tests.


Clone project


pip install -r requirements.txt # install required dependencies



pip install behave_rest


# to execute all feature files (all tests)

# to execture specific feature
behave features/twitter.feature

# to see printed output add --no-capture
behave --no-capture

# run features with specific tags
behave --tags=without_login --tags=slow

More about behave tool you can read here

Test example

Feature: Twitter search

  Background: Setup environment
    Given I set base URL to ""
    And I set "Authorization" header to "context.twitter_auth"

  Scenario: Search for tweets
    When I make a GET request to "tweets.json" with parameters
    Then the response status code should equal 200
    And the response structure should equal "twitterSearchData"
    And the response header "status" should equal "200 OK"

You can get test feature files from the project repo

CI reports

Behave support JUnit reports, that are easily parsed by CI tools

To enable JUnit reports, create behave.ini file:


Reports are generated into /reports folder

Another useful options to add into behave.ini are:

stdout_capture=False to add printed output into reports

show_timings=no to hide timing of each step

Project Structure

Feature files are intended to locate in /features folder

Corresponding steps are located in /features/steps

Overall project structure is as follows:

+-- features/

    +-- conf.yaml // store project config (urls, global variables, etc.)

    +-- // context setup steps (e.g. load from config)

    +-- *.feature // feature files

    +-- steps/

        +-- // used to import predefined steps

        +-- // response structures described in Trafaret format

        +-- *.py // steps related to corresponding feature (e.g. "" contains steps that are related to "login.feature")

Project details

Download files

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

Files for behave-rest, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size behave-rest-0.1.3.tar.gz (5.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page