{ "info": { "author": "Windel Bouwman", "author_email": "UNKNOWN", "bugtrack_url": null, "classifiers": [], "description": "\nIntroduction\n============\n\nLibrary to convert BDD_ features into Python unittest.TestCase classes. Run the\ntests with your favorite test runner, like pytest, unittest or nose.\nSee the demo folder for an example.\n\nExample\n=======\n\nLet's take a calculator as an example.\nCreate a plain text file called calculator.feature containing the BDD_-style\nfeature description:\n\n.. code::\n\n Feature: Basic math operations\n Test addition\n\n Scenario: add\n Given the value 10\n When adding 7\n Then the result is 17\n\n Scenario: add a negative value\n Given the value 19\n When adding -11\n Then the result is 8\n\nThis is the text you can discuss with the customer and agree on.\nNext write a backing file called test_calculator.py containing the code to\nrun this feature:\n\n.. code::\n\n import os\n from bdd import Environment\n from calculator import Calculator\n\n env = Environment()\n env.context.calculator = Calculator()\n\n @env.given('the value {:d}')\n def step(context, value):\n context.calculator.value = value\n\n @env.when('adding {:d}')\n def step(context, value):\n context.calculator.add(value)\n\n @env.then('the result is {:d}')\n def step(context, value):\n assert context.calculator.value == value\n\n def rel(p):\n this_dir = os.path.dirname(os.path.abspath(__file__))\n return os.path.join(this_dir, p)\n\n CalculatorTestCase = env.load_feature_as_testcase('calculator.feature')\n\nFinally, write the actual production code to implement the calculator, in\na file called calculator.py:\n\n.. code::\n\n class Calculator:\n def __init__(self):\n self.value = 0\n\n def add(self, value):\n self.value += value\n\nNow run the tests with, for example, pytest:\n\n.. code::\n\n $ python -m pytest test_calculator.py -v\n =========== test session starts ===========================\n platform linux -- Python 3.5.1, pytest-2.9.1\n collected 2 items \n\n test_calculator.py::CalculatorTestCase::test_scenario_0 <- bdd.py PASSED\n test_calculator.py::CalculatorTestCase::test_scenario_1 <- bdd.py PASSED\n\n\n\n.. _BDD: https://en.wikipedia.org/wiki/Behavior-driven_development\n\n\n\nReferences\n==========\n\nA really good python bdd library is behave_.\n\n.. _behave: http://pythonhosted.org/behave/\n\n\nChangelog\n=========\n\n**0.2**\n\n- Add tag support\n\n**0.1 (Jun 2, 2016)**\n\n- Initial release\n\n.. image:: https://travis-ci.org/windelbouwman/bdd.svg?branch=master\n :target: https://travis-ci.org/windelbouwman/bdd\n\n.. image:: https://codecov.io/gh/windelbouwman/bdd/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/windelbouwman/bdd\n\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/windelbouwman/bdd", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "bdd", "package_url": "https://pypi.org/project/bdd/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/bdd/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/windelbouwman/bdd" }, "release_url": "https://pypi.org/project/bdd/0.2/", "requires_dist": null, "requires_python": null, "summary": "UNKNOWN", "version": "0.2" }, "last_serial": 2150394, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "fcc5327df81b7f06d9abbcbcba0cefaf", "sha256": "4ec48b3374b47bb432d812453943447f1962c37e649e3e6fe179278530a1e1a8" }, "downloads": -1, "filename": "bdd-0.1.zip", "has_sig": false, "md5_digest": "fcc5327df81b7f06d9abbcbcba0cefaf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2249, "upload_time": "2016-06-02T20:45:56", "url": "https://files.pythonhosted.org/packages/8e/d7/5cb66e4a3a4202bf55a953bfc2d109cd5a037e68724a61b8bbea1bc782e1/bdd-0.1.zip" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "35d531ceb883765ee15da4d020f6698e", "sha256": "f4ddac067e4632ce9e95b53ea7cfcff627194b536c61e91b1b5c9c7e0e81e3a0" }, "downloads": -1, "filename": "bdd-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "35d531ceb883765ee15da4d020f6698e", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 3480, "upload_time": "2016-06-04T07:50:41", "url": "https://files.pythonhosted.org/packages/bf/3b/9093b494c9d4a11d8b57a569be35b604a4b987b029708ca6a0f40e7f818d/bdd-0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b6d7a4dac7f15b1bfa047d1d562a0f99", "sha256": "3e038357e9046a67b65fc47bf9b94ca02f57a74e2d03429d31da0c77495b4a66" }, "downloads": -1, "filename": "bdd-0.2.zip", "has_sig": false, "md5_digest": "b6d7a4dac7f15b1bfa047d1d562a0f99", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4601, "upload_time": "2016-06-04T07:50:36", "url": "https://files.pythonhosted.org/packages/d6/61/deb6a361d811da8b6d9d9005123fc2cf859909a01603f573e0bc357d4a5e/bdd-0.2.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "35d531ceb883765ee15da4d020f6698e", "sha256": "f4ddac067e4632ce9e95b53ea7cfcff627194b536c61e91b1b5c9c7e0e81e3a0" }, "downloads": -1, "filename": "bdd-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "35d531ceb883765ee15da4d020f6698e", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 3480, "upload_time": "2016-06-04T07:50:41", "url": "https://files.pythonhosted.org/packages/bf/3b/9093b494c9d4a11d8b57a569be35b604a4b987b029708ca6a0f40e7f818d/bdd-0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b6d7a4dac7f15b1bfa047d1d562a0f99", "sha256": "3e038357e9046a67b65fc47bf9b94ca02f57a74e2d03429d31da0c77495b4a66" }, "downloads": -1, "filename": "bdd-0.2.zip", "has_sig": false, "md5_digest": "b6d7a4dac7f15b1bfa047d1d562a0f99", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4601, "upload_time": "2016-06-04T07:50:36", "url": "https://files.pythonhosted.org/packages/d6/61/deb6a361d811da8b6d9d9005123fc2cf859909a01603f573e0bc357d4a5e/bdd-0.2.zip" } ] }