dbc-bdd

0.2.7 • Public • Published

Dbc-Bdd project

Light BDD-framework for developing the tests: unit, integration, etc...

Supports:

  • asynchronous test execution
  • test grouping

Depends on:

  • Dbc project for using the design-by-contract approach

How to use library in your own project:

const bdd   = require("../build/bdd.js");
const group = bdd.createGroup({
    name         : "My first test-group",
    runAtBrowser : true,
    tests        : new Array(
        bdd.describe("Testing the methods of the dynamically loaded module", async() => {
            await loadAsBlobUrl("module.math.js");
            const awaitedResult = 5;

            const myMath = new MyMath();
            const result = myMath.add(2, 3);

            contract.isNumber(result);
            contract.areNumbersEqual(result, awaitedResult);
        }),
        bdd.describe("Simple test", async() => {
            contract.isNotEmptyString("Moscow");
        }),
        bdd.describe("Empty-array check test", async() => {
            contract.isEmptyArray([]);
        }),
        bdd.describe("Array check test", async() => {
            contract.isNotEmptyArray([ 1, 2, 3 ]);
        }),
    )
});

How to install/test library:

Run the following commands at the library source path:

// for restoring the dependencies
npm install

// for the project build
npm run build

// for the live sample of the library use
npm run show-sdk

Package Sidebar

Install

npm i dbc-bdd

Weekly Downloads

0

Version

0.2.7

License

MIT

Last publish

Collaborators

  • neverlands