-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Rishikesh Dhokare edited this page Feb 26, 2018
·
4 revisions
Testing is integral part of any application lifecycle. There are many levels of testing as per test pyramid and most of them follow similar set of steps -
- setup data
- execute the functionality
- verify the result
Often it becomes difficult or tedious to setup various types ``of data e.g. some random integer, string, date etc. In a test suite having many tests there is chance that you might end up repeating this data creation. Though its a test code, its really valuable in providing quick feedback and in a way confidence to the software team. This library is an attempt to help this data creation.
Import the library as below -
var fakedata = require('@rishikeshdhokare/fakedata');
Following are the set of api exposed through this library -
API | Description | Example |
---|---|---|
fakedata.boolean() | returns true or false
|
true, false |
fakedata.int(min, max) | returns an integer greater than min and lower than max
|
for min=1 & max=10 - 5, 9 |
fakedata.float(min, max, precision) | returns a float greater than min and lower than max with precision
|
for min=1, max=10 & precision=2 - 5.5, 9.4 |
fakedata.alphabetic(length) | alphabetic string with length
|
for length=5 - akqde |
fakedata.alphanumeric(length) | alphanumeric string with length
|
for length=5 - miv97 |
fakedata.random(length) | string with alphabets, numbers and special characters with length
|
for length=5 - es28% |
fakedata.date() | random date | Mon Feb 26 2018 22:31:26 GMT+0530 (IST) |