{"id":17736349,"url":"https://github.com/pgmccann/nbbdd","last_synced_at":"2025-03-14T14:30:49.803Z","repository":{"id":148209184,"uuid":"252390502","full_name":"pgmccann/nbbdd","owner":"pgmccann","description":"BDD for Jupyter Notebooks. Hackday project at SSI Collaborations Workshop 2020. #CollabW2020","archived":false,"fork":false,"pushed_at":"2020-04-02T15:02:13.000Z","size":38,"stargazers_count":2,"open_issues_count":4,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-10-19T18:17:07.932Z","etag":null,"topics":["bdd","behavior-driven-development","collabw20","gherkin","jupyter","jupyter-notebook","jupyter-notebooks","python"],"latest_commit_sha":null,"homepage":"","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/pgmccann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-04-02T07:53:21.000Z","updated_at":"2023-10-20T22:19:55.316Z","dependencies_parsed_at":null,"dependency_job_id":"f610e252-5be0-46c7-ac0e-5f49293fce77","html_url":"https://github.com/pgmccann/nbbdd","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgmccann%2Fnbbdd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgmccann%2Fnbbdd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgmccann%2Fnbbdd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgmccann%2Fnbbdd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pgmccann","download_url":"https://codeload.github.com/pgmccann/nbbdd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243593247,"owners_count":20316154,"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-driven-development","collabw20","gherkin","jupyter","jupyter-notebook","jupyter-notebooks","python"],"created_at":"2024-10-26T00:22:34.088Z","updated_at":"2025-03-14T14:30:49.461Z","avatar_url":"https://github.com/pgmccann.png","language":"Python","readme":"[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n# BDD for Jupyter Notebooks\n\nThis is a Hackday project at the [SSI Collaborations Workshop\n2020](https://www.software.ac.uk/cw20).\n\nThis is a Python-based command-line tool for parsing\n[Gherkin code](https://cucumber.io/docs/gherkin/reference/) in Markdown cells\nin a [Jupyter](https://jupyter.org/) Notebook and generating skeleton unit\ntests which are then inserted into the Notebook at the appropriate points.\n\nThe idea of this project is improve the Jupyter notebooks by adding validations but all\nthis is not something new, there is already something available as a plug in for Jupyter called [nbval](https://github.com/computationalmodelling/nbval)\nwhich work nice if you want to use the TDD approach which sometime can be a little bit painful when you are in an \nearly stage prototyping you research. Since TDD (Test Driven Development) can be a little be to much from the beginning we found that it may be helpful\nto start with a BDD (Behavior-driven development) approach by writing test cases in a natural language that \nnon-programmers can read and also serve as a documentation more or less.\n\n# The basic workflow will be:\n1. Create initial notebook\n2. Start writing test cases using natural language combined with Gherkin behaviour markup\n3. [nbbdd](https://github.com/pgmccann/nbbdd) generates feature and skeleton step files, inserts step code, returns failing test results\n4. Populate skeleton tests with real test code\n5. Start write software while keeping in mind running also the tests until all pass\n\nSome simple example for step 2 using [behave ](http://behave.github.io/behave.example/tutorials/tutorial02.html)\n    \n    Feature: Fight or Flight (Natural Language, tutorial02)\n    \n        In order to increase the ninja survival rate,\n        As a ninja commander\n        I want my ninjas to decide whether to take on an opponent\n        based on their skill levels.\n\n        Scenario: Weaker opponent\n            Given the ninja has a third level black-belt\n            When attacked by a samurai\n            Then the ninja should engage the opponent\n    \n        Scenario: Stronger opponent\n            Given the ninja has a third level black-belt\n            When attacked by Chuck Norris\n            Then the ninja should run for his life\n\n\nSteps 4 and 5 can be identified as the TDD part which already requires some coding skills. \n\n# Acknowledgements\n\nThis [paper](https://www.researchgate.net/publication/338594130_Testing_with_Jupyter_notebooks_NoteBook_VALidation_nbval_plug-in_for_pytest) helped a lot to understand what should be achieved during the hackday:\n\nFangohr, H. \u0026 Fauske, Vidar \u0026 Kluyver, Thomas \u0026 Albert, Maximilian \u0026 Laslett, Oliver \u0026 Cortés-Ortuño, David \u0026 Beg, Marijan \u0026 Ragan-Kelly, Min. (2020). Testing with Jupyter notebooks: NoteBook VALidation (nbval) plug-in for pytest. \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgmccann%2Fnbbdd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpgmccann%2Fnbbdd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgmccann%2Fnbbdd/lists"}