0.2.1 • Published 5 years ago

@redbee/judo v0.2.1

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

Judo

Build Status David

SQL Stored Procedures Testing Made SIMPLE

INSERT EPIC INTRODUCTION HERE

Scenario: calculate monthly summary for one user with several expenses

    Given a table transactions
      | user  | amount | concept   | createdAt  |
      | john  | 100    | food      | 2019-06-10 |
      | john  | 50     | clothing  | 2019-06-10 |
      | john  | 10     | food      | 2019-06-10 |
      | clair | 200    | transport | 2019-06-10 |
      | clair | 50     | food      | 2019-06-10 |
    
    When I execute monthly_expenses
    
    Then summary should have
      | user  | month | total |
      | john  | 6     | 160   |
      | clair | 6     | 250   |

Supported Engines

MSSQLMySQLOraclePostgreSQL
YESNOIN PROGRESSNO

Currently Judo can only be used with MSSQL, it's in my intentions to add support for other SQL engines.

Install

$ npm install @redbee/judo

Important: judo will not work as a global package as it depends on cucumber (see cucumber-js/issues/908)

Usage

Judo is based on Cucumber's runtime but all the steps necessary are already implemented. The only thing you need to do is define your Judo Features (.feature files in gherkin syntax) using our available steps and execute Judo.

ie: SQL-server

  1. Create .feature files.
  2. Run:
    $ npx judo [features_dir] --judo.engine mssql --mssql.password mySecr3t
    # OR directly from node_modules
    $ ./node_modules/.bin/judo --judo.engine mssql --mssql.password mySecr3t

Configuration

SQL Connection

There are several ways to override the config properties: using ENV_VARS, CLI args, or a CommonJS config file.

defaultenv variablescli argssql.conf.js
user'sa'MSSQL_USERsql.useruser
password''MSSQL_PASSWORDsql.passwordpassword
server'localhost'MSSQL_SERVERsql.serverserver
port1433MSSQL_PORTsql.portport
database'master'MSSQL_DATABASEsql.databasedatabase

Sandbox

By default every scenario is run inside a TRANSACTION, which is rolled back at the end. If we want to persist the changes we can tell Judo that is running against a "sandbox" environment.

$ npx judo [features_dir] --judo.sandbox

Examples

See docs/examples directory

Available Steps: