TAU_Jest JavaScript Testing Framework
TAU_Jest JavaScript Testing Framework
v. Telegram: https://t.me/rajatt95
i. Appium + Java
c. API
-------------------------------------------------------------------------------------------------------------------------------
1
—------------------
1. Documents:
b. Google Drive:
https://drive.google.com/drive/folders/1tne9pZjgWvfrS0l9tVHs6k1jnQHpTLoA
—------------------
4. Course content:
a. Jest JavaScript Testing Framework
b. Chapter 1 - Introduction to Jest
c. Chapter 2 - Installing Jest
d. Chapter 3 - Writing Your First Test
e. Chapter 4 - Common Matchers
f. Chapter 5 - Jest Matchers Expanded
g. Chapter 6 - Before and After Code
h. Chapter 7 - Running Specific Tests
i. Chapter 8 - Asynchronous Testing in Jest
j. Chapter 9 - Snapshot Testing
—------------------
Softwares:
1. Programming language - Javascript
2. IDE - VS Code
a. https://code.visualstudio.com/download
b. Plugin
i. Playwright Test for VSCode
3. Engine:
a. https://nodejs.org/en/download/
—------------------
-------------------------------------------------------------------------------------------------------------------------------
2
—------------------
1. Learnings from Course (TAU - Toyer Mamoojee - JEST)
a. Links:
i. Jest
1. https://jestjs.io/docs/expect
—------------------
b. Jest
i. What is Jest?
ii. Why use Jest?
iii. When to use Jest?
—------------------
c. Common Matchers in Jest
i. toBe()
ii. toEqual()
iii. Matchers (https://jestjs.io/docs/expect)
1. String matchers
2. Number matchers
3. Truthiness matchers
4. Array matchers
—------------------
d. Before and After Types
i. beforeEach()
ii. afterEach()
iii. beforeAll()
iv. afterAll()
—------------------
e. Run tests
i. Run all tests in a project folder
ii. Run specific test file
iii. Run a single test in a file
iv. Run tests in watch mode
—------------------
f. Ways to handle asynchronous code
i. Callbacks
ii. Promises
iii. async/await
—------------------
g. Snapshot Testing
—------------------
-------------------------------------------------------------------------------------------------------------------------------
3
—------------------
h. Commands
i. To verify the setup for node JS
1. node --version
ii. Create package.json file
1. npm init -y
iii. Install Jest
1. npm install --save-dev jest
iv. If the Editor is not giving intellisense
1. npm i @types/jest --save-dev
v. Run tests
1. Run all tests in a project folder
a. npm run test
2. Run specific test file
a. npm run test multiply.test.js
3. Run a single test in a file
====================================================
-----------------------------------------
========Jest JavaScript Testing Framework ==========
-----------------------------------------
1. In this course, we’ll learn how to create automated tests using Jest
2. What is Jest
a. Open-source testing framework
b. It was initially developed by Facebook
c. It has the capabilities
i. Assertion library
ii. Execute tests parallelly
1. Faster test execution
—------------------
-------------------------------------------------------------------------------------------------------------------------------
4
-----------------------------------------
========Chapter 1 - Introduction to Jest ==========
-----------------------------------------
1. What is Jest?
a. It is an open-source javascript testing library from Facebook
b. It is not just a Test runner, but, it is a complete testing framework
i. That has brought modern testing to another level
—------------------
-------------------------------------------------------------------------------------------------------------------------------
5
-----------------------------------------
========Chapter 2 - Installing Jest ==========
-----------------------------------------
1. Pre-Requisites
a. IDE - VS Code
i. https://code.visualstudio.com/download
ii. Plugin
1. Playwright Test for VSCode
b. Engine:
i. https://nodejs.org/en/download/
2. Commands
a. To verify the setup for node JS
i. node --version
c. Install Jest
i. npm install --save-dev jest
—------------------
1.
-------------------------------------------------------------------------------------------------------------------------------
6
-----------------------------------------
========Chapter 3 - Writing Your First Test ==========
-----------------------------------------
1.
2.
—------------------
1. To execute the test
a. npm run test
2.
—------------------
-------------------------------------------------------------------------------------------------------------------------------
7
-----------------------------------------
========Chapter 4 - Common Matchers ==========
-----------------------------------------
2.
3.
—------------------
-------------------------------------------------------------------------------------------------------------------------------
8
-----------------------------------------
========Chapter 5 - Jest Matchers Expanded ==========
-----------------------------------------
1. Matchers (https://jestjs.io/docs/expect)
a. String matchers
b. Number matchers
c. Truthiness matchers
d. Array matchers
—------------------
1.
2.
-------------------------------------------------------------------------------------------------------------------------------
9
—------------------
3.
—------------------
1.
-------------------------------------------------------------------------------------------------------------------------------
10
—------------------
2.
-----------------------------------------
========Chapter 6 - Before and After Code ==========
-----------------------------------------
—------------------
-------------------------------------------------------------------------------------------------------------------------------
11
—------------------
1.
2.
—------------------
-------------------------------------------------------------------------------------------------------------------------------
12
-----------------------------------------
========Chapter 7 - Running Specific Tests ==========
-----------------------------------------
1. Run tests
ii.
—------------------
-------------------------------------------------------------------------------------------------------------------------------
13
—------------------
d. Run tests in watch mode
i.
1. npm run test:watch
2.
—------------------
-------------------------------------------------------------------------------------------------------------------------------
14
-----------------------------------------
========Chapter 8 - Asynchronous Testing in Jest ==========
-----------------------------------------
—------------------
1.
2.
—------------------
-------------------------------------------------------------------------------------------------------------------------------
15
-----------------------------------------
========Chapter 9 - Snapshot Testing ==========
-----------------------------------------
1. Snapshot Testing
a. According to the official documentation of Jest
i. It states that snapshots are a great new way of testing UI components
b. Very useful when you want to make sure that your application UI does not change
unexpectedly
c. The test fails
i. If snapshots are not matched
1. Snapshot #1 - Reference
2. Snapshot #2 - Takes at runtime
d. It is possible to test and assert the output of any serializable value
—------------------
1.
—------------------
-------------------------------------------------------------------------------------------------------------------------------
16
—------------------
2.
—------------------
1. Once we execute the tests
a.
i. A new folder (__snapshots__) gets created
1. It created a snapshot of our expected values
-------------------------------------------------------------------------------------------------------------------------------
17
=======================================================================
1. Documents
b. Google Drive:
https://drive.google.com/drive/folders/1tne9pZjgWvfrS0l9tVHs6k1jnQHpTLoA
3. To connect
a.
=======================================================================
=======================================================================
-------------------------------------------------------------------------------------------------------------------------------
18