Javascript for testing
Introduction
Install Node.js
Sample use of node.js
Create project
Install Visual Studio Code
Install Jest
Setup Jest
Add the first test
Add test statements : Arrange
Add test statements: Act
Add test statement: Assert
Add second test
Basic Javascript - Variables
Basic Javascript - Functions
Basic Javascript - Array
Basic Javascript - Object
Install REST client library
Testing REST API
Simple testing REST API with Request
Acceptance testing REST API
Websocket
Install web socket library
Testing websocket
Test fixture - Data preparation
Install MongoDB library
Sample use of node.js
Powered by
GitBook
Add the first test
Add the first test
สร้างไฟล์ชื่อ first.test.js
ข้างในไฟล์ first.test.js เพิ่มโค้ดดังนี้
test(
"Add two number"
,
function
(
)
{ })
ลอง execute test
npm test
ควรได้ผลลัพธ์ ดังรูป
results matching "
"
No results matching "
"