rapid data modeling and testing with fakeit
TRANSCRIPT
![Page 1: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/1.jpg)
Rapid Data Modeling and Testing
AARON BENTON
![Page 3: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/3.jpg)
![Page 4: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/4.jpg)
+
![Page 5: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/5.jpg)
![Page 6: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/6.jpg)
OUR CAPABILITIES
6
![Page 7: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/7.jpg)
Enthusiasm Disillusionment Panic
Search for the Guilty
Punishment of the Innocent
Praise for Non-Participants
![Page 8: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/8.jpg)
First, solve the problem. Then, write the code.“ ”John Johnson
![Page 9: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/9.jpg)
Data Modeling
![Page 10: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/10.jpg)
Phases• Conceptual • Logical • Physical
![Page 11: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/11.jpg)
Conceptual Data Modeling
Entity NamesEntity Relationships
Users Products
Line Items
Orders
![Page 12: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/12.jpg)
N 1Person Birthplace Location Person Location
Born In
Birthplace of
Person Location(1, 1) Born In
Birthplace of (0, N)
<< Entity >> Person
0. .N
1
<< Entity >> Location
<< Relationship >>Born in >
< Birthplace of
Chen
Person LocationIDEF1x
Person LocationBorn In
Birthplace of
Bachman
Crow's Foot
ISO
UML
![Page 13: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/13.jpg)
Logical Data Modeling
Entity NamesEntity AttributesEntity Relationships
UsersUser ID (PK)
Username
Password
First Name
Last Name
Address
City
State
Zip Code
Country
Phone
OrdersOrder ID (PK)
Order Number
User ID (FK)
Order Date
Address
City
State
Zip Code
Country
Phone
Credit Card
Expiration Date
Order Line ItemsOrder ID (FK)
Product ID (FK)
Quantity
Total
ProductsProduct ID (PK)
Product Name
Description
Price
![Page 14: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/14.jpg)
Physical Data ModelingEntity Names -> Table NamesEntity Attributes -> Field NamesEntity Relationships -> Keys Data Types
![Page 15: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/15.jpg)
NoSql Modeling• How do you represent a model? • What tools do you use? • How do you show relationships? • Does code define the model? • What key patterns should be used?
![Page 16: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/16.jpg)
JSON
![Page 17: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/17.jpg)
JSON Schema
![Page 18: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/18.jpg)
YAML
![Page 19: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/19.jpg)
Now What?
![Page 20: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/20.jpg)
20
![Page 21: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/21.jpg)
![Page 22: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/22.jpg)
![Page 23: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/23.jpg)
Fake Data Generators• FakerJS • ChanceJS • json-generator.com • objgen.com/json • mockaroo.com • jsonschema.net
![Page 24: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/24.jpg)
Relationships are Hard
![Page 25: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/25.jpg)
FakeIT
![Page 26: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/26.jpg)
Fakeit• CLI Tool inspired by Swagger • Models defined in YAML • Generates JSON, CSON, YAML, CSV • Exports to Couchbase, Sync Gateway, Zip,
Console
![Page 27: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/27.jpg)
Fakeit Data• Exposes FakerJS and ChanceJS • Custom Build Functions w/ Pre and Post • Multiple Models • Dependencies • Definitions
*fakeit is for structure, cbworkloadgen is for sizing
![Page 28: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/28.jpg)
npm install fakeit -g
![Page 29: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/29.jpg)
Original YAML Model
![Page 30: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/30.jpg)
Simple Model
30
Data Attribute
![Page 31: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/31.jpg)
Console Output
![Page 32: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/32.jpg)
File Output
![Page 33: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/33.jpg)
Output Formats
![Page 34: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/34.jpg)
CSV Output
![Page 35: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/35.jpg)
Zip Archive
![Page 36: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/36.jpg)
. . . ?
![Page 37: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/37.jpg)
Couchbase
![Page 38: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/38.jpg)
What about Mobile…?
![Page 39: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/39.jpg)
Sync Gateway
![Page 40: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/40.jpg)
Sync Gateway with Auth
![Page 41: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/41.jpg)
How does it Work?
![Page 42: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/42.jpg)
Property Data:
value
• A static value to be used • Executed at build time
fake
• A FakerJS template string • Executed at build time
pre_build
• Function body used to initialize a property
• Property is set to the returned value
build
• Function body used to set a property
• Property is set to the returned value
post_build
• Function body used to manipulate a property after it has been set
• Property is set to the returned value
pre_run
• Function body that is executed before any models are generated
post_run
• Function body that is executed before after all models have been generated
![Page 43: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/43.jpg)
![Page 44: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/44.jpg)
FlowModel
Pre_RUNModel
PRE_BUILD
Initialize Property
Value (EACH)
Start Document
Run
Property PRE_BUILD +
BUILD (EACH)
PROPERTY POST_BUILD
(EACH)
MODEL POST_BUILD
MODEL POST_RUN
![Page 45: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/45.jpg)
Flow
![Page 46: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/46.jpg)
Flow
![Page 47: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/47.jpg)
Multiple Models
![Page 48: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/48.jpg)
Multiple Models
![Page 49: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/49.jpg)
Dependencies
Users Products Reviews Orders
![Page 50: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/50.jpg)
Dependencies
![Page 51: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/51.jpg)
Dependencies
![Page 52: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/52.jpg)
Definitions
![Page 53: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/53.jpg)
Definitions
![Page 54: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/54.jpg)
![Page 55: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/55.jpg)
continents.json countries.csv
Input
![Page 56: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/56.jpg)
continents.json countries.csv
Input
![Page 57: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/57.jpg)
How we use FakeIt• YAML models store in the repository • Make commands to generate data • Docker Compose:
• Nginx • Couchbase • Sync Gateway
• Testing / QA
![Page 58: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/58.jpg)
Demos
![Page 59: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/59.jpg)
Fakeit Examples• Contacts • Ecommerce • Flat • Flight Data • Music • Simple • Social
github.com/bentonam/fakeit-examples
![Page 60: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/60.jpg)
Questions?
![Page 61: Rapid Data Modeling and Testing with FakeIt](https://reader031.vdocuments.mx/reader031/viewer/2022030402/5878cbdd1a28ab26728b7347/html5/thumbnails/61.jpg)
HOW TO CONTACT MEDon’t hesitate to contact with me. I will be happy to answer your questions.
TWITTER: @bentonam
github.com/bentonam
EMAIL: [email protected]
THANK YOU