unittestsbuilder v1.0.17
Create and execute unit tests within minutes
Unit Tests builder
is a testing toolkit developed on the top of Facebook's Jest framework for the developers and testers to seamlessly write unit tests for every scenarios.
Installation
npm i unittestsbuilder --save
Configuration
const testApp = require('unittestsbuilder');
const test = new testApp({<--config-->})
Set-up your config
Property | Description | Default Value | Type |
---|---|---|---|
file_path | Excel File Path | UnitTest.xlsx | string |
jest_flags | Jest CLI Flags | [] | array of string |
suite_name | Name of the test suite | Unit Test Suite | string |
html_report | Test case execution report in HTML format | false | boolean |
excel_report | Test case execution report in Excel format | false | boolean |
text_report | Test case execution report in Text format | false | boolean |
Steps
- Create an excel file.
- Add the unit tests. (each row will be considered as a single test)
- Configure excel path.
- Run the code.
Excel Columns
Test Case Name | Data | Expected Data | Validation | Function | Path |
---|
- Test Case Name - Name of the Test Case
- Data - Data that has to be provided to the function (Given Data)
- Expected Data - Data that is expected after successful completion of test case or the data that is to be passed to the validations.
- Validation - Jest validation expect functions. (For more: https://jestjs.io/docs/expect)
- Function - Name of the function (without parentheses) that is to be executed for a specific test case.
- Path - Relative path of the file where the function is declared.
Note: (1) All the above colums are mandatory with the same name (2) To use multiple validations in one unit test use '/' as a delimeter.
eg: toBe/toEqual
(3) If you're not specifying the parameters in jest validation functions, it will take Expected Data as a parameter. e.g: If theExpected Data
is"Login Success"
andValidation
istoBe
, thentoBe
function will take"Login Success"
as a parameter. Similarly, if you can also pass the parameters inside the validation functioneg: toBeGreaterThan(20)
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago