{"id":25776559,"url":"https://github.com/TNG/JGiven","last_synced_at":"2025-02-27T06:06:41.859Z","repository":{"id":15922455,"uuid":"18664242","full_name":"TNG/JGiven","owner":"TNG","description":"Behavior-Driven Development in plain Java","archived":false,"fork":false,"pushed_at":"2024-05-22T18:44:52.000Z","size":38819,"stargazers_count":431,"open_issues_count":60,"forks_count":100,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-05-23T01:39:29.647Z","etag":null,"topics":["bdd","behavior-driven-development","java","jgiven","tdd","test-automation","test-driven-development"],"latest_commit_sha":null,"homepage":"http://jgiven.org","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TNG.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-04-11T06:10:24.000Z","updated_at":"2024-05-30T09:38:35.625Z","dependencies_parsed_at":"2024-02-01T16:17:11.649Z","dependency_job_id":"f5d8a09d-a6e3-4993-8027-09c4e15d009d","html_url":"https://github.com/TNG/JGiven","commit_stats":null,"previous_names":[],"tags_count":78,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TNG%2FJGiven","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TNG%2FJGiven/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TNG%2FJGiven/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TNG%2FJGiven/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TNG","download_url":"https://codeload.github.com/TNG/JGiven/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240304653,"owners_count":19780312,"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","java","jgiven","tdd","test-automation","test-driven-development"],"created_at":"2025-02-27T06:01:26.697Z","updated_at":"2025-02-27T06:06:41.852Z","avatar_url":"https://github.com/TNG.png","language":"Java","readme":"[![Build Status](https://img.shields.io/github/actions/workflow/status/tng/jgiven/jgiven_branch_and_pr_build.yml?branch=master)](https://github.com/TNG/JGiven/actions/workflows/jgiven_branch_and_pr_build.yml)\n[![Coverage Status](https://img.shields.io/coveralls/TNG/JGiven.svg?style=flat-square)](https://coveralls.io/r/TNG/JGiven?branch=master)\n[![Apache License 2.0](https://img.shields.io/badge/license-apache2-red.svg?style=flat-square)](http://opensource.org/licenses/Apache-2.0)\n[![Maven Central](https://img.shields.io/maven-central/v/com.tngtech.jgiven/jgiven-junit.svg?style=flat-square)](https://maven-badges.herokuapp.com/maven-central/com.tngtech.jgiven/jgiven-junit)\n[![Join the chat at https://gitter.im/TNG/JGiven](https://img.shields.io/gitter/room/nwjs/nw.js.svg?style=flat-square)](https://gitter.im/TNG/JGiven?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n[![Javadocs](https://javadoc.io/badge/com.tngtech.jgiven/jgiven-core.svg?color=brightgreen)](https://javadoc.io/doc/com.tngtech.jgiven/jgiven-core)\n[![Open Source Helpers](https://www.codetriage.com/tng/jgiven/badges/users.svg)](https://www.codetriage.com/tng/jgiven)\n\n\u003cimg src=\"https://jgiven.org/img/logo.png\" height=\"80\" alt=\"JGiven\"\u003e\n\nJGiven is a *developer-friendly* and *pragmatic* BDD tool for Java. Developers write scenarios in plain Java using a fluent, domain-specific API, JGiven generates reports that are readable by domain experts.\n\n## Why another BDD tool?\n\nBehavior-Driven Development (BDD) is a development method where business analysts, developers, and testers describe the behavior of a software product in a common language and notation. Behavior is typically described in terms of scenarios, which are written in the Given-When-Then notation. The common language and notation is one cornerstone of BDD. The other cornerstone is that the defined scenarios are executable, form a comprehensive test suite, and a living documentation for the software product.\n\nIn classical BDD tools for Java like [JBehave](https://jbehave.org) or [Cucumber](https://cukes.info) scenarios are written in plain text files. This allows non-developers to write scenarios, because no programming knowledge is required. To make scenarios executable, developers write so-called step-implementations. To bind plain text to step implementations regular expressions are used. For developers maintaining these executable scenarios has a high overhead that is not required if tests would be directly written in a programming language.\n\nBeside the classical BDD tools there are a number of tools for Java to write BDD tests in a programming language like Groovy ([easyb](http://easyb.org)) or Scala ([ScalaTest](http://www.scalatest.org)). To our knowledge, however, there is no BDD tool where scenarios can be written in plain Java.\n\nFinally, there are specification testing frameworks like [Spock](https://spock.org) (Groovy) or [LambdaBehave](https://richardwarburton.github.io/lambda-behave/) which are very developer-centric and good for unit-testing, but the generated reports are not in Given-When-Then form and are not easily readable by non-developers.\n\n## BDD with JGiven\n\n* Scenarios are written in standard Java code using a fluent, domain-specific API (no extra language like Scala or Groovy needed, no IDE plugin needed)\n* Java method names and parameters are parsed during test execution (no extra annotations needed)\n* Scenarios are executed by either JUnit or TestNG (no extra test runner needed)\n* Scenarios consist of so-called stages, which share state by injection, providing a modular way of writing Scenarios.\n* JGiven generates scenario reports for business owners and domain experts\n\n## Example\n\n```Java\n\n@Test\npublic void a_pancake_can_be_fried_out_of_an_egg_milk_and_flour() {\n    given().an_egg().\n        and().some_milk().\n        and().the_ingredient( \"flour\" );\n\n    when().the_cook_mangles_everything_to_a_dough().\n        and().the_cook_fries_the_dough_in_a_pan();\n\n    then().the_resulting_meal_is_a_pancake();\n}\n```\n\nThe above test can be executed like any JUnit test.\nDuring the execution, JSON files are generated that can then be used afterwards to generate test reports.\nBy default, a plain text report is shown in the console, which would look as follows:\n\n```\nScenario: a pancake can be fried out of an egg milk and flour\n\n  Given an egg\n    And some milk\n    And the ingredient flour\n   When the cook mangles everything to a dough\n    And the cook fries the dough in a pan\n   Then the resulting meal is a pancake\n```\nIn addition, you can generate an [HTML Report](https://jgiven.org/jgiven-report/html5/).\n\n## Getting Started\n\n1. Start by reading the [documentation](https://jgiven.org/docs/) section on JGiven's website.\n2. See the [talk](https://www.youtube.com/watch?v=gh_yjb3x8Yc) on JGiven held on the TNG Big Techday 8\n\n## License\n\nJGiven is published under the Apache License 2.0, see\nhttps://www.apache.org/licenses/LICENSE-2.0 for details.\n\n## Contributing\n\nSee [CONTRIBUTING](CONTRIBUTING.md)\n\n","funding_links":[],"categories":["Popular Frameworks","测试"],"sub_categories":["Behavior Driven Development (BDD)"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTNG%2FJGiven","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTNG%2FJGiven","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTNG%2FJGiven/lists"}