{"id":13772238,"url":"https://github.com/behave-restful/behave-restful","last_synced_at":"2025-05-11T04:31:17.278Z","repository":{"id":27234591,"uuid":"112867405","full_name":"behave-restful/behave-restful","owner":"behave-restful","description":"BDD Framework to Test REST Services and APIs","archived":false,"fork":false,"pushed_at":"2023-01-13T18:31:21.000Z","size":154,"stargazers_count":64,"open_issues_count":4,"forks_count":23,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T05:03:22.904Z","etag":null,"topics":["bdd","behavior","gherkin","language","rest","rest-api","restful-api","restful-webservices","testing","testing-tools"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/behave-restful.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-02T18:43:11.000Z","updated_at":"2024-12-05T02:07:25.000Z","dependencies_parsed_at":"2023-01-14T06:16:28.974Z","dependency_job_id":null,"html_url":"https://github.com/behave-restful/behave-restful","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/behave-restful%2Fbehave-restful","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/behave-restful%2Fbehave-restful/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/behave-restful%2Fbehave-restful/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/behave-restful%2Fbehave-restful/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/behave-restful","download_url":"https://codeload.github.com/behave-restful/behave-restful/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253518941,"owners_count":21921074,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bdd","behavior","gherkin","language","rest","rest-api","restful-api","restful-webservices","testing","testing-tools"],"created_at":"2024-08-03T17:01:01.682Z","updated_at":"2025-05-11T04:31:14.555Z","avatar_url":"https://github.com/behave-restful.png","language":"Python","funding_links":[],"categories":["Rest API Testing"],"sub_categories":[],"readme":"# Behave Restful\n\n[![Build Status](https://travis-ci.org/behave-restful/behave-restful.svg?branch=master)](https://travis-ci.org/behave-restful/behave-restful)\n\nBehave Restful is a Behavior Driven Development (BDD) framework based on \n[behave](https://pythonhosted.org/behave/), that implements a language suitable \nto test and validate REST APIs and Services. It leverages the power of the \n[gherkin](https://github.com/cucumber/cucumber/wiki/Gherkin) language to write \nbusiness readable tests that validate the behavior of REST APIs.\n\nAlthough, Behave Restful is implemented in [python](http://www.python.org) and \nuses [behave](https://pythonhosted.org/behave/) as underlying framework, it can \ntest services implemented in any language as easy as:\n\n```gherkin\n\nFeature: API to add a new book to our collection\n    As a user, I want to add a new book to my \"to-read\" collection.\n\n    Scenario: Add a new book to collection.\n        Given a request url http://my.reads/api/books\n            And a request json payload\n                \"\"\"\n                {\n                    \"category\": \"reference\",\n                    \"author\": \"Nigel Rees\",\n                    \"title\": \"Sayings of the Century\",\n                    \"price\": 8.95,\n                    \"status\": \"to-read\"\n                }\n                \"\"\"\n        When the request sends POST\n        Then the response status is CREATED\n            And the response json matches\n                \"\"\"\n                {\n                    \"title\": \"BookObject\",\n                    \"type\": \"object\"\n                    \"properties\": {\n                        \"id\": {\"type\": \"number\"},\n                        \"category\": {\"type\": \"string\"},\n                        \"author\": {\"type\": \"string\"},\n                        \"title\": {\"type\": \"string\"},\n                        \"price\": {\"type\": \"number\"},\n                        \"status\": {\"type\": \"string\", \"enum\": [\"to-read\", \"reading\", \"read\"]}\n                    },\n                    \"required\": [\"id\", \"category\", \"title\"]\n                }\n                \"\"\"\n            And the response json at $.id is equal to 100\n            And the response json at $.category is equal to \"reference\"\n            And the response json at $.title is equal to \"Sayings of the Century\"\n```\n\n\nAs you can see in the example, we send a POST request to the specified url with\na JSON payload, and we can validate the result very easy. First, we verify that\nthe status of the response is CREATED (it succeeds). Then we validate the\nresponse JSON body using the expected [JSON Schema](http://json-schema.org/). \nFinally, we validate specific values in the response using \n[JSONPath](http://goessner.net/articles/JsonPath/)\n\n## Installation\n\nUse pip to install behave-restful in your project\n\n```\npip install behave-restful\n```\n\n## Setup\n\nTo add support for `behave-restful` steps in your `.feature` files, you need to include behave-restful's environment and step definitions.\n\nYou can do this simply by adding two boilerplate files to your project:\n\nIn the root of your `features` directory, add this `environment.py` file:\n\n```python\n# {your_project}/features/en/__init__.py\n\nimport os\n\nimport behave_restful.app as br_app\n\n\ndef before_all(context):\n    this_directory = os.path.abspath(os.path.dirname(__file__))\n    br_app.BehaveRestfulApp().initialize_context(context, this_directory)\n    context.hooks.invoke(br_app.BEFORE_ALL, context)\n\n\ndef after_all(context):\n    context.hooks.invoke(br_app.AFTER_ALL, context)\n\n\ndef before_feature(context, feature):\n    context.hooks.invoke(br_app.BEFORE_FEATURE, context, feature)\n\n\ndef after_feature(context, feature):\n    context.hooks.invoke(br_app.AFTER_FEATURE, context, feature)\n\n\ndef before_scenario(context, scenario):\n    context.hooks.invoke(br_app.BEFORE_SCENARIO, context, scenario)\n\n\ndef after_scenario(context, scenario):\n    context.hooks.invoke(br_app.AFTER_SCENARIO, context, scenario)\n\n\ndef before_step(context, step):\n    context.hooks.invoke(br_app.BEFORE_STEP, context, step)\n\n\ndef after_step(context, step):\n    context.hooks.invoke(br_app.AFTER_STEP, context, step)\n\n\ndef before_tag(context, tag):\n    context.hooks.invoke(br_app.BEFORE_TAG, context, tag)\n\n\ndef after_tag(context, tag):\n    context.hooks.invoke(br_app.AFTER_TAG, context, tag)\n```\n\nAnd under `features/steps` add this `__init__.py` file:\n\n```python\n# {your_project}/features/steps/__init__.py\nfrom behave_restful.lang import *\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbehave-restful%2Fbehave-restful","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbehave-restful%2Fbehave-restful","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbehave-restful%2Fbehave-restful/lists"}