{"id":6906,"date":"2020-09-30T16:03:09","date_gmt":"2020-09-30T16:03:09","guid":{"rendered":"https:\/\/cheesecakelabs.com\/blog\/?p=6906\/"},"modified":"2022-09-21T18:11:13","modified_gmt":"2022-09-21T18:11:13","slug":"behavior-driven-development-tests-pokedex-bdd","status":"publish","type":"post","link":"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/","title":{"rendered":"Behavior-driven Development: how to develop tests for a Pok\u00e9dex using BDD"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">In this tutorial, I am going to show you how to start using BDD and will use a Pok\u00e9mon Pok\u00e9dex search feature as an example.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><a href=\"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-bdd\/\" target=\"_blank\" rel=\"noopener\">BDD means Behavior-driven Development<\/a> and it&#8217;s a refinement of existing <a href=\"https:\/\/cheesecakelabs.com\/blog\/tdd-mobile-dev-matter-timing\/\" target=\"_blank\" rel=\"noopener\">TDD processes<\/a>. <\/span><span style=\"font-weight: 400;\">It considers the feature behavior ahead of the development and the test processes. A system can have many behaviors, which are basically how a feature operates input, process and output.<\/span><\/p>\n<p><!--more--><\/p>\n<p><span style=\"font-weight: 400;\">One of the biggest problems in the software development process is that the different parts are not speaking the same language. Generally the Product Owner describes the feature in one way, the developer develops it in another way and the tester tests it in a brand new way \u2013 and in some cases, documentation and tests are skipped because of a deadline. These are common situations and in the end, the real feature and value are not delivered to the end user.<\/span><\/p>\n<p><img decoding=\"async\" class=\"size-medium aligncenter\" src=\"https:\/\/media.giphy.com\/media\/dJYoOVAWf2QkU\/giphy.gif\" width=\"497\" height=\"276\" \/><\/p>\n<p style=\"text-align: center;\"><span style=\"font-weight: 400;\">(End user not receiving the feature)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">BDD brings a solution so that all parts speak the same language: the features files. To write them we use <\/span><a href=\"https:\/\/cucumber.io\/docs\/gherkin\/\"><span style=\"font-weight: 400;\">Gherkin<\/span><\/a><span style=\"font-weight: 400;\">, a business specification language. These files are responsible for handling the application behaviors. Separate behaviors make it easy to develop and test \u2013 and in the end, an application is composed of many behaviors working together. But the main benefits are collaboration and automation.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">All stakeholders can easily understand the feature file because it is written in natural language and it just needs to follow some rules. Here is an example of a feature file:<\/span><\/p>\n<pre class=\"language-swift\"><code class=\"language-swift\">\nFeature: pok\u00e9dex search\n  As a Pokemon trainer,\n  I want to search for pokemons in my pok\u00e9dex,\n  So I can learn more about them.\n\n  Scenario: Name pok\u00e9dex search\n    Given the pok\u00e9dex page\n    When the user searches for \"Pikachu\"\n    Then the \"Pikachu\" information is shown\n<\/code><\/pre>\n<p>Let&#8217;s take a look at what each keyword means in this:<\/p>\n<p><b>Feature<\/b><span style=\"font-weight: 400;\"> is a high level description of the feature itself. It could have a description and it generally is a user story\u00a0<\/span><\/p>\n<p><b>Scenario<\/b><span style=\"font-weight: 400;\"> is the concrete example of a business rule. It is composed by Given, When and Then and a feature could have many scenarios<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><b>Given<\/b><span style=\"font-weight: 400;\"> is the step used to show the initial state of behavior<\/span><\/p>\n<p><b>When<\/b><span style=\"font-weight: 400;\"> is the step used to describe a behavior action or event<\/span><\/p>\n<p><b>Then<\/b><span style=\"font-weight: 400;\"> is the step used to describe the behavior outcome<\/span><\/p>\n<p><span style=\"font-weight: 400;\">These keywords were not used in the example, but they are also valid Gherkin syntax:<\/span><\/p>\n<p><b>And\/But <\/b><span style=\"font-weight: 400;\">when you have more than one Given, When or Then you could replace it with an <\/span><i><span style=\"font-weight: 400;\">And<\/span><\/i><span style=\"font-weight: 400;\"> or <\/span><i><span style=\"font-weight: 400;\">But.<\/span><\/i><span style=\"font-weight: 400;\"> Something like <\/span><i><span style=\"font-weight: 400;\">Given<\/span><\/i><span style=\"font-weight: 400;\"> a=1 <\/span><i><span style=\"font-weight: 400;\">And<\/span><\/i><span style=\"font-weight: 400;\"> b=2 <\/span><i><span style=\"font-weight: 400;\">When<\/span><\/i><span style=\"font-weight: 400;\"> a + b <\/span><i><span style=\"font-weight: 400;\">Then<\/span><\/i><span style=\"font-weight: 400;\"> the output is 2. Remember to use this carefully<\/span><\/p>\n<p><b>Background <\/b><span style=\"font-weight: 400;\">is the step that we can use to run before a scenario, to avoid repeating it over and over.\u00a0\u00a0\u00a0<\/span><\/p>\n<p><b>Scenario Outline <\/b><span style=\"font-weight: 400;\">is the way you can use variables inside a scenario, so you can parametrize without repeating yourself.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">There are still more Gherkin keywords and you can check them all <a href=\"https:\/\/cucumber.io\/docs\/gherkin\/reference\/\">here<\/a>.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This is the first phase of BDD, we wrote the feature specifications. Now we need to automate it.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><a href=\"https:\/\/cheesecakelabs.com\/blog\/blog\/biggest-benefits-of-python\/\">Python<\/a> has many BDD frameworks, the most famous are <\/span><a href=\"https:\/\/behave.readthedocs.io\/en\/latest\/\"><span style=\"font-weight: 400;\">behave<\/span><\/a><span style=\"font-weight: 400;\">, <\/span><a href=\"https:\/\/pytest-bdd.readthedocs.io\/en\/latest\/\"><span style=\"font-weight: 400;\">pytest-bdd<\/span><\/a><span style=\"font-weight: 400;\">, <\/span><a href=\"https:\/\/lettuce.readthedocs.io\/en\/latest\/\"><span style=\"font-weight: 400;\">lettuce<\/span><\/a><span style=\"font-weight: 400;\"> and <\/span><a href=\"https:\/\/radish.readthedocs.io\/en\/stable\/\"><span style=\"font-weight: 400;\">radish<\/span><\/a><span style=\"font-weight: 400;\">. You can choose any of these to automate your feature files.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In this tutorial we will use pytest-bdd because it brings all the pytest best stuff, like fixture and tags, and we can run unit and functional tests with just one command. If you are familiar with pytest, we highly recommend you to check it out \ud83d\ude42\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Let&#8217;s set up the project! We need to create a test directory with a feature\/ and a setp_definition\/ directores inside it.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">We will need a pokedex.feature file inside the features directory and a __init__.py, conftest.py and test_pokedex_steps.py inside steps_definitions directory. After creating all files you should have this structure:<\/span><\/p>\n<pre class=\"language-swift\"><code class=\"language-swift\">\npokedex-pytest-bdd\n\u2514\u2500\u2500 tests\n    \u251c\u2500\u2500 features\n    \u2502   \u2514\u2500\u2500 pokedex.feature\n    \u2514\u2500\u2500 step_definitions\n        \u251c\u2500\u2500 __init__.py\n        \u251c\u2500\u2500 conftest.py\n        \u2514\u2500\u2500 test_pokedex_steps.py\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">You can use this dir structure in a project or a <a href=\"https:\/\/cheesecakelabs.com\/blog\/blog\/django-framework-app-development\/\">Django<\/a> app context. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">If you want, you can have a bdd dir inside your test dir to make it more decoupled. Our recommendation is to let the feature and step_definition folders in the same depth, to make it easier to find things while debugging.<\/span><\/p>\n<p>Inside the pokedex-pytest-dbb folder, we can create a virtualenv and install pytest and selenium:<\/p>\n<pre class=\"language-swift\"><code class=\"language-swift\">\npython -m venv venv \nsource venv\/bin\/activate\npip install pytest pytest-bdd requests selenium\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">For selenium to work properly, you will need to download and add the geckodriver to your path. You can find it <a href=\"https:\/\/github.com\/mozilla\/geckodriver\/releases\/tag\/v0.26.0\">here<\/a>.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">We&#8217;re going to create our features file and use some Gherkin tags that we have learned \ud83d\ude42\u00a0<\/span><\/p>\n<pre class=\"language-swift\"><code class=\"language-swift\">\nFeature: pok\u00e9dex search\n  As a Pokemon trainer,\n  I want to search for pokemons in my pok\u00e9dex,\n  So I can learn more about them.\n\n  Background:\n    Given the pok\u00e9dex page\n\n  Scenario Outline: Name pok\u00e9dex search\n    When the user searches for \"&lt;text&gt;\"\n    Then the \"&lt;pokemon&gt;\" information is shown\n\n    Examples: Pokemons\n      | text       | pokemon    |\n      | Pikachu    | Pikachu    |\n      | Charmander | Charmander |\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">And now that we have our feature, we can automate it!<\/span><\/p>\n<p><span style=\"font-weight: 400;\">First, create a fixture inside conftest.py. It will be used to handle our selenium webdriver and will be available to all tests. We just need to pass the browser as an argument to the test function \u2013 pytest cool stuff.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">conftest.py<\/span><\/p>\n<pre class=\"language-swift\"><code class=\"language-swift\">\nimport pytest\n\nfrom selenium import webdriver\n\n\n@pytest.fixture\ndef browser():\n    browser = webdriver.Firefox()\n    browser.implicitly_wait(10)\n    yield browser\n    browser.quit()\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">Pytest does not allow us to run the feature file directly. So, in order to be able to find the correct scenario, we need to specify it at the beginning, with the scenarios function.<\/span><\/p>\n<pre class=\"language-swift\"><code class=\"language-swift\">\nscenarios('..\/features\/pokedex.feature')\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">Now we need to create for each Given, When and Then a function that will handle the steps to reproduce it.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In pytest-bdd, we do it by decorating the function with @given(), @when(), @then() and passing the text as an argument.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">We are using selenium to simulate the user interaction with the page and pytest to assert the results. The assert will be always in that function, and the complete file should look like this :<\/span><\/p>\n<p><span style=\"font-weight: 400;\">test_pokedex_steps.py<\/span><\/p>\n<pre class=\"language-swift\"><code class=\"language-swift\">\nfrom pytest_bdd import scenarios, given, when, then\nfrom selenium.webdriver.common.keys import Keys\n\n\nscenarios('..\/features\/pokedex.feature')\n\n\n@given('the pokedex page')\ndef pokedex_page(browser):\n    browser.get('https:\/\/pokedex.org\/')\n\n\n@when('the user searches for \"&lt;text&gt;\"')\ndef search_pokemon_name(browser, text):\n    search_input = browser.find_element_by_id('monsters-search-bar')\n    search_input.send_keys(text, Keys.ENTER)\n\n\n@then('the \"&lt;pokemon&gt;\" informations are shown')\ndef results_have_one(browser, pokemon):\n    results = browser.find_elements_by_id('monsters-list')\n\n    assert len(results) &gt; 0\n    assert pokemon in results[0].text\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">To run it, you need to type &#8220;pytest&#8221; inside your terminal with the virtual environment activated. We are using the -v tag (verbose), so pytest shows us a more descriptive message.<\/span><\/p>\n<pre class=\"language-swift\"><code class=\"language-swift\">\npytest -v\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">And the result should be:<\/span><\/p>\n<pre class=\"language-swift\"><code class=\"language-swift\">\n(venv) \u279c  pokedex-pytest-bdd pytest -v\n================================= test session starts ====================================\nplatform linux -- Python 3.8.2, pytest-5.4.3, py-1.8.1, pluggy-0.13.1 -- \/pokedex-pytest-bdd\/venv\/bin\/python\ncachedir: .pytest_cache\nrootdir: \/pokedex-pytest-bdd\nplugins: bdd-3.4.0\ncollected 2 items                                                                                                                                             \n...\/test_pokedex_steps.py::test_name_pok\u00e9dex_search[Pikachu-Pikachu] PASSED         [ 50%]\n...\/test_pokedex_steps.py::test_name_pok\u00e9dex_search[Charmander-Charmander] PASSED   [100%]\n\n==================================== 2 passed in 26.42s ==================================\n<\/code><\/pre>\n<p>And all passed, we did it!<\/p>\n<p><img decoding=\"async\" class=\"size-medium aligncenter\" src=\"https:\/\/media.giphy.com\/media\/vv8R20yaYZIKk\/giphy.gif\" width=\"500\" height=\"360\" \/><\/p>\n<p><span style=\"font-weight: 400;\">You can pass a @given as a param to @when or @then functions, because it is a fixture. And you can have more than one decorator to a function. This way you can write more descriptive scenarios and reuse the same functions. You just need to decorate the function with all the steps necessary. Something like:<\/span><\/p>\n<pre class=\"language-swift\"><code class=\"language-swift\">\n@when('something')\n@when('something in other words')\ndef function()\n...\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">You can write BDD to unit and API tests, but it\u2019s overengineering it. For these kinds of tests, TDD is better. BDD really shines to end-to-end and UI tests.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The only downside of using pytest-bdd, in my point of view, is that we need to explicitly import all scenarios in the step definition files. It would be great if they were automatically found or if pytest ran the feature files itself, but pytest brings so much to the table that it doesn&#8217;t matter.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">I hope you have enjoyed this tutorial. Feel free to ping me if you have any questions. And if you want to learn more about BDD, here are some interesting links:<\/span><\/p>\n<p><a href=\"https:\/\/selenium-python.readthedocs.io\/\"><span style=\"font-weight: 400;\">https:\/\/selenium-python.readthedocs.io\/<\/span><\/a><\/p>\n<p><a href=\"https:\/\/cucumber.io\/school\/\"><span style=\"font-weight: 400;\">https:\/\/cucumber.io\/school\/<\/span><\/a><\/p>\n<p><a href=\"https:\/\/github.com\/pytest-dev\/pytest-bdd\"><span style=\"font-weight: 400;\">https:\/\/github.com\/pytest-dev\/pytest-bdd<\/span><\/a><\/p>\n<p><a href=\"https:\/\/automationpanda.com\/bdd\/\"><span style=\"font-weight: 400;\">https:\/\/automationpanda.com\/bdd\/<\/span><\/a><\/p>\n<p><a href=\"https:\/\/testautomationu.applitools.com\/behavior-driven-python-with-pytest-bdd\/\"><span style=\"font-weight: 400;\">https:\/\/testautomationu.applitools.com\/behavior-driven-python-with-pytest-bdd\/<\/span><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Happy BDD, bye<\/span><\/p>\n<p><img decoding=\"async\" class=\"size-medium aligncenter\" src=\"https:\/\/media.giphy.com\/media\/10LKovKon8DENq\/giphy.gif\" width=\"500\" height=\"300\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, I am going to show you how to start using BDD and will use a Pok\u00e9mon Pok\u00e9dex search feature as an example. BDD means Behavior-driven Development and it&#8217;s a refinement of existing TDD processes. It considers the feature behavior ahead of the development and the test processes. A system can have many [&hellip;]<\/p>\n","protected":false},"author":65,"featured_media":6908,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[432],"tags":[],"class_list":["post-6906","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-engineering"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Behavior-driven Development: how to develop tests for a Pok\u00e9dex using BDD<\/title>\n<meta name=\"description\" content=\"In this tutorial, I am going to show you how to start using Behavior-driven Development and will use a Pok\u00e9mon Pok\u00e9dex search feature as an example.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Behavior-driven Development: how to develop tests for a Pok\u00e9dex using BDD\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, I am going to show you how to start using Behavior-driven Development and will use a Pok\u00e9mon Pok\u00e9dex search feature as an example.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/\" \/>\n<meta property=\"og:site_name\" content=\"Cheesecake Labs\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cheesecakelabs\" \/>\n<meta property=\"article:published_time\" content=\"2020-09-30T16:03:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-21T18:11:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/s3.amazonaws.com\/ckl-website-static\/wp-content\/uploads\/2020\/09\/banner-para-blog-bdd.png\" \/>\n<meta name=\"author\" content=\"Cheesecake Labs\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@cheesecakelabs\" \/>\n<meta name=\"twitter:site\" content=\"@cheesecakelabs\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/\"},\"author\":{\"name\":\"Matheus Fernandes\"},\"headline\":\"Behavior-driven Development: how to develop tests for a Pok\u00e9dex using BDD\",\"datePublished\":\"2020-09-30T16:03:09+00:00\",\"dateModified\":\"2022-09-21T18:11:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/\"},\"wordCount\":1122,\"image\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2020\/09\/banner-para-blog-bdd.png\",\"articleSection\":[\"Engineering\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/\",\"url\":\"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/\",\"name\":\"Behavior-driven Development: how to develop tests for a Pok\u00e9dex using BDD\",\"isPartOf\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2020\/09\/banner-para-blog-bdd.png\",\"datePublished\":\"2020-09-30T16:03:09+00:00\",\"dateModified\":\"2022-09-21T18:11:13+00:00\",\"author\":{\"@type\":\"person\",\"name\":\"Matheus Fernandes\"},\"description\":\"In this tutorial, I am going to show you how to start using Behavior-driven Development and will use a Pok\u00e9mon Pok\u00e9dex search feature as an example.\",\"breadcrumb\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/#primaryimage\",\"url\":\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2020\/09\/banner-para-blog-bdd.png\",\"contentUrl\":\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2020\/09\/banner-para-blog-bdd.png\",\"width\":2000,\"height\":720,\"caption\":\"purple background with bdd Behavior-driven Development and a pokedex with a python logo inside\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cheesecakelabs.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Behavior-driven Development: how to develop tests for a Pok\u00e9dex using BDD\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/#website\",\"url\":\"https:\/\/cheesecakelabs.com\/blog\/\",\"name\":\"Cheesecake Labs\",\"description\":\"Nearshore outsourcing company for Web and Mobile design and engineering services, and staff augmentation for startups and enterprises..\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cheesecakelabs.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"name\":\"Matheus Fernandes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2017\/06\/matheus-300x300.jpg\",\"contentUrl\":\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2017\/06\/matheus-300x300.jpg\",\"caption\":\"Matheus Fernandes\"},\"description\":\"10 years of experience in Marketing and Sales in the Technology sector. My main purpose is help, support and structure efficient operations and also develop independent and multidisciplinary teams.\",\"url\":\"https:\/\/cheesecakelabs.com\/blog\/autor\/matheusfernandes\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Behavior-driven Development: how to develop tests for a Pok\u00e9dex using BDD","description":"In this tutorial, I am going to show you how to start using Behavior-driven Development and will use a Pok\u00e9mon Pok\u00e9dex search feature as an example.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/","og_locale":"en_US","og_type":"article","og_title":"Behavior-driven Development: how to develop tests for a Pok\u00e9dex using BDD","og_description":"In this tutorial, I am going to show you how to start using Behavior-driven Development and will use a Pok\u00e9mon Pok\u00e9dex search feature as an example.","og_url":"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/","og_site_name":"Cheesecake Labs","article_publisher":"https:\/\/www.facebook.com\/cheesecakelabs","article_published_time":"2020-09-30T16:03:09+00:00","article_modified_time":"2022-09-21T18:11:13+00:00","og_image":[{"url":"https:\/\/s3.amazonaws.com\/ckl-website-static\/wp-content\/uploads\/2020\/09\/banner-para-blog-bdd.png","type":"","width":"","height":""}],"author":"Cheesecake Labs","twitter_card":"summary_large_image","twitter_creator":"@cheesecakelabs","twitter_site":"@cheesecakelabs","twitter_misc":{"Written by":null,"Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/#article","isPartOf":{"@id":"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/"},"author":{"name":"Matheus Fernandes"},"headline":"Behavior-driven Development: how to develop tests for a Pok\u00e9dex using BDD","datePublished":"2020-09-30T16:03:09+00:00","dateModified":"2022-09-21T18:11:13+00:00","mainEntityOfPage":{"@id":"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/"},"wordCount":1122,"image":{"@id":"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/#primaryimage"},"thumbnailUrl":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2020\/09\/banner-para-blog-bdd.png","articleSection":["Engineering"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/","url":"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/","name":"Behavior-driven Development: how to develop tests for a Pok\u00e9dex using BDD","isPartOf":{"@id":"https:\/\/cheesecakelabs.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/#primaryimage"},"image":{"@id":"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/#primaryimage"},"thumbnailUrl":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2020\/09\/banner-para-blog-bdd.png","datePublished":"2020-09-30T16:03:09+00:00","dateModified":"2022-09-21T18:11:13+00:00","author":{"@type":"person","name":"Matheus Fernandes"},"description":"In this tutorial, I am going to show you how to start using Behavior-driven Development and will use a Pok\u00e9mon Pok\u00e9dex search feature as an example.","breadcrumb":{"@id":"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/#primaryimage","url":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2020\/09\/banner-para-blog-bdd.png","contentUrl":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2020\/09\/banner-para-blog-bdd.png","width":2000,"height":720,"caption":"purple background with bdd Behavior-driven Development and a pokedex with a python logo inside"},{"@type":"BreadcrumbList","@id":"https:\/\/cheesecakelabs.com\/blog\/behavior-driven-development-tests-pokedex-bdd\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cheesecakelabs.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Behavior-driven Development: how to develop tests for a Pok\u00e9dex using BDD"}]},{"@type":"WebSite","@id":"https:\/\/cheesecakelabs.com\/blog\/#website","url":"https:\/\/cheesecakelabs.com\/blog\/","name":"Cheesecake Labs","description":"Nearshore outsourcing company for Web and Mobile design and engineering services, and staff augmentation for startups and enterprises..","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cheesecakelabs.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","name":"Matheus Fernandes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cheesecakelabs.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2017\/06\/matheus-300x300.jpg","contentUrl":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2017\/06\/matheus-300x300.jpg","caption":"Matheus Fernandes"},"description":"10 years of experience in Marketing and Sales in the Technology sector. My main purpose is help, support and structure efficient operations and also develop independent and multidisciplinary teams.","url":"https:\/\/cheesecakelabs.com\/blog\/autor\/matheusfernandes\/"}]}},"_links":{"self":[{"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/posts\/6906","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/comments?post=6906"}],"version-history":[{"count":2,"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/posts\/6906\/revisions"}],"predecessor-version":[{"id":10838,"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/posts\/6906\/revisions\/10838"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/media\/6908"}],"wp:attachment":[{"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/media?parent=6906"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/categories?post=6906"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/tags?post=6906"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}