All Projects → udaychandra → bdd

udaychandra / bdd

Licence: Apache-2.0 license
JUnit 5 based BDD library to create and run stories and behaviors a.k.a BDD specification tests

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to bdd

Expekt
BDD assertion library for Kotlin
Stars: ✭ 163 (+552%)
Mutual labels:  bdd, junit
justtestlah
Dynamic test framework for web and mobile applications
Stars: ✭ 43 (+72%)
Mutual labels:  bdd, junit
Pester
Pester is the ubiquitous test and mock framework for PowerShell.
Stars: ✭ 2,620 (+10380%)
Mutual labels:  bdd, bdd-framework
Ginkgo
BDD Testing Framework for Go
Stars: ✭ 5,346 (+21284%)
Mutual labels:  bdd, bdd-framework
testing-spring-boot-applications-masterclass
🍃 Everything You Need to Know About Testing Spring Boot Applications
Stars: ✭ 185 (+640%)
Mutual labels:  junit, junit5
Catch Exception
Stars: ✭ 137 (+448%)
Mutual labels:  bdd, junit
jpa-unit
JUnit extension to test javax.persistence entities
Stars: ✭ 28 (+12%)
Mutual labels:  junit, junit5
spring-boot-microservice-best-practices
Best practices and integrations available for Spring Boot based Microservice in a single repository.
Stars: ✭ 139 (+456%)
Mutual labels:  bdd, junit5
Awesome-Cucumber
A collection of awesome Cucumber and Gherkin-related resources
Stars: ✭ 33 (+32%)
Mutual labels:  bdd, bdd-framework
spring-jooq-flyway-testcontainers-junit5
🚀 Example project with configured Spring Boot, JooQ, TestContainers, MySQL container and JUnit5
Stars: ✭ 29 (+16%)
Mutual labels:  junit, junit5
bat
Gherkin based DSL for testing HTTP APIs via Cucumber.JS
Stars: ✭ 30 (+20%)
Mutual labels:  bdd, bdd-framework
kekiri
A .NET framework that supports writing low-ceremony BDD tests using Gherkin language
Stars: ✭ 19 (-24%)
Mutual labels:  bdd, bdd-framework
hitchstory
Type-safe, StrictYAML based BDD framework for python.
Stars: ✭ 24 (-4%)
Mutual labels:  bdd, bdd-framework
Spectrum
A BDD-style test runner for Java 8. Inspired by Jasmine, RSpec, and Cucumber.
Stars: ✭ 142 (+468%)
Mutual labels:  bdd, junit
eggplant
A behaviour driven development (BDD) library for Clojure. Simplicity is key.
Stars: ✭ 16 (-36%)
Mutual labels:  bdd, bdd-framework
junit5-kubernetes
Use kubernetes pod from your Junit5 test classes
Stars: ✭ 40 (+60%)
Mutual labels:  junit, junit5
flyway-junit5-extensions
Flyway JUnit 5 Extension to clean / migrate your database in tests.
Stars: ✭ 14 (-44%)
Mutual labels:  junit, junit5
kheera-testrunner-android
BDD Framework for Android
Stars: ✭ 18 (-28%)
Mutual labels:  bdd, bdd-framework
junit5-demo
Demos for JUnit 5
Stars: ✭ 46 (+84%)
Mutual labels:  junit, junit5
ginkgo4j
A Java BDD Testing Framework (based on RSpec and Ginkgo)
Stars: ✭ 25 (+0%)
Mutual labels:  bdd, junit

BDD

A BDD library that provides a custom extension based on JUnit 5 Jupiter Extension Model. This library can be used to create and run stories and behaviors a.k.a BDD specification tests.

Basic Usage

You need to add JUnit 5 dependencies before using this library. If you are using a build tool like Maven or Gradle, add the following dependency after setting-up JUnit:

  • Maven pom.xml

     <dependency>
       <groupId>io.github.udaychandra.bdd</groupId>
       <artifactId>bdd-junit</artifactId>
       <version>0.1.0</version>
       <scope>test</scope>
     </dependency>
  • Gradle build.gradle

     dependencies {
       testImplementation 'io.github.udaychandra.bdd:bdd-junit:0.1.0'
     }

You can now write stories using @Story and @Scenario annotations provided by this library. Here's an example:

import io.github.udaychandra.bdd.ext.Scenario;
import io.github.udaychandra.bdd.ext.Story;

@Story(name = "Returns go back to the stockpile",
        description = "As a store owner, in order to keep track of stock," +
                " I want to add items back to stock when they're returned.")
public class StoreFrontTest {

    @Scenario("Refunded items should be returned to stock")
    public void refundAndRestock(Scene scene) {
        scene.
            given("that a customer previously bought a black sweater from me",
                    () -> scene.put("store", new StoreFront(0, 4).buyBlack(1))).

            and("I have three black sweaters in stock",
                    () -> assertEquals(3, scene.<StoreFront>get("store").getBlacks(),
                            "Store should carry 3 black sweaters")).

            when("the customer returns the black sweater for a refund",
                    () -> scene.<StoreFront>get("store").refundBlack(1)).

            then("I should have four black sweaters in stock",
                    () -> assertEquals(4, scene.<StoreFront>get("store").getBlacks(),
                            "Store should carry 4 black sweaters")).
            run();
    }
}

The "Scene" object injected into each test method can be used to store and retrieve arbitrary objects.

When you run these stories (tests), text reports like the one shown below are generated:

STORY: Returns go back to the stockpile

As a store owner, in order to keep track of stock, I want to add items back to stock when they're returned.

SCENARIO: Refunded items should be returned to stock
   GIVEN that a customer previously bought a black sweater from me
     AND I have three black sweaters in stock
    WHEN the customer returns the black sweater for a refund
    THEN I should have four black sweaters in stock

You will find the text reports in a folder named "bdd-reports" located under your test classes build folder.

Development

This is a community project. All contributions are welcome.

To start contributing, do the following:

  • Install JDK 8+
  • Fork or clone the source code
  • Run the build using the gradle wrapper
gradlew clean build

You can read this InfoQ article for more insights.

License

Apache License 2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].