1.0.4 • Published 5 years ago

testease v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

TestEase

Build Status

An NPM repository to ease the testing of Node projects, where instead of writing whole test files,you only need to define the testcases with path, function name, input, and expected output, saving a lot of time in writing testcases, and focusing more on your product, or project.

Usage

To install the package,

npm i -g testease
testease

NOTE: This package is to be installed globally

Documentation

File specifiication

{
    "name": "testease",
    "functions": [
        {
            "path": "Path to file",
            "describe":"optional description of your testcase to better track your tests",
            "name": "Name of the function ( if no name given, file is assumed to export a function",
            "input": [
                "variables",
                "in",
                "order"
            ],
            "returnFunctionType": "promise OR value",
            "returnType": "Type of data returned",
            "returnValue": "Value of data"
        }
    ]
}

functions is an array where the testcases need to be defined, along with the path to the module, name of the function if any, input, and also specifying the return type of the function, such as whether the return type is a value, or a promise, and type of the data returned.

NOTE: path must be defined from the base of the project, or where the testease.json resides, i.e. where testease was called initially. The starting `. must be avoided.

Type of entries

AttributetypeofSignificance
pathstringPath to the module
namestringName of function, if not given, module is expected to export only one function
inputlistList of variables in order of declaration in function
returnFunctionTypestringType of return promise / value
returnTypestringType of value returned i.e. number, string, boolean, etc.
returnValueanyValue, in the type it is to be returned

In case the return type is an object

    "returnType": {
            "success": "boolean",
            "message": "string"
            },
    "returnValue": {
            "success": false
            }

Returned types can be defined, and if they aren't defined, it will throw an error. If it not defined in returnValue, and if it is of the type in returnType, it will not throw an error.

NOTE: Returned objects supported

Command line options

  • testease --help or testease -h

    • Get more information on the command line options
  • testease init

    • Create the default testease.json file where the testcases need to be entered
  • testease test

    • Test against testcases defined in testease.json
Additional command line options
  • --logs BOOL

    • Specify to include logging or not
  • --log-file FILEPATH

    • Specify file path if you want to log to a file
1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago