
Explore why testing matters and cover unit, integration, and end-to-end tests, then apply test driven development to write unit and integration tests for React components with a mock server.
Install Visual Studio Code by downloading it for your operating system and running the installer with next and finish, a tool widely used for frontend development.
Install the Node.js runtime to run JavaScript on your computer outside the browser. Node.js is built on Chrome V8 and enables local JavaScript execution; download the long-term support version and install.
Explore why testing matters in the software development life cycle, from development to production environments, and how automation test scripts enable unit and integration testing.
Compare bdd and tdd approaches in testing a user form, focusing on behavior through user interactions and button enablement when fields are valid.
This lecture clarifies unit testing, integration testing, and end-to-end testing, explains how each validates components, their roles in the build versus test environments, and tools like selenium or Cyprus.
Create a fresh React app with npx create-react-app, open it in Visual Studio Code, and use the pre-installed testing libraries, including testing library and jest-dom, to run tests.
Open and simplify the test file, remove extra code, and create a minimal React app with an h2, an input placeholder enter email, and a basic ul for testing.
Write and run your first test for a React app by rendering the app component, locating a button with getByRole, and asserting its presence with jest-dom.
Learn to determine element roles in React tests by logging roles with testing library's logRoles, then fetch elements using getByTestId and test with role-based selectors.
Learn the differences between getBy, queryBy, and findBy in the testing library, including behavior with found, not found, and multiple matches, and how getAllBy and findAllBy relate to asynchronous testing.
Use getBy, getAllBy, and queryBy in Jest tests to handle button elements, resolve single or multiple matches, and assert presence or absence in the document.
Validate unit tests for a feedback form in React and integration testing for feedback overview; ensure the form includes a textbox, checkbox, and a button enabled only when input exists.
Demonstrates test driven development by writing tests first, then code to pass them, organizing a tests folder with a feedback form and feedback overview components, and installing a code-generation extension.
Learn to write an onload test case for a feedback form in a React app, rendering the component and asserting input, checkbox, and button existence and initial disabled state.
group related tests into a describe block to improve readability, then validate that a button enables only when the text input and checkbox are both filled, using placeholder text queries.
Simulate user interactions by entering text in a textbox and ticking a checkbox to enable the button, using fireEvent change and click events in Jest tests.
Explore the React project flow and structure, from public/index.html and the root div to index.js rendering the app and a feedback form component with component CSS; practice test‑driven development.
Create and use state variables with the useState hook to bind form inputs—text box and checkbox—to state. Set default values and handlers to store user feedback.
Learn that in React, a functional component is an arrow function that returns JSX, which must be wrapped by a parent element or fragment with opening and closing tags.
Develop a React feedback form by binding an input to a state variable with onChange and enabling the submit button only when the checkbox is checked.
Compare manual testing with unit tests in a test-driven workflow, using npm test to validate functionality and catch regressions before code changes.
Replace fireEvent with userEvent to test real user interactions in React tests, including typing and clicking. Learn proper imports, async handling, and common setup patterns.
Write unit tests for the feedback overview component in React, ensuring empty feedback shows no feedback found and a non-empty list renders as n rows via parent props.
Develop a Jest test for the feedback overview component to cover the no feedback found scenario, asserting that a no feedback message appears when the feedback list is empty.
demonstrates test driven development for Jest unit and integration testing with React by validating a feedback found scenario, using get by text, query by text, and list item count expectations.
Develop a feedback overview component in a React app, passing a feedback list via props, rendering items with map and keys, and handling empty states.
Diagnose and fix failing React Jest tests by debugging text matching, handling empty inputs, and ensuring the correct no feedback scenarios are rendered, demonstrating practical unit testing for React components.
Improve your test cases by replacing hard coded data with feedbacks.length, so tests automatically adapt as entries change, boosting code quality and maintainability.
Explore integration testing scenarios for a feedback app by verifying that adding new feedback to the list preserves existing items, and that the feedback form and overview components interact correctly.
Define an integration test that renders the app component, fills the text box with new feedback, checks the checkbox, clicks the submit button, and verifies the new feedback appears.
Implement integration test scenario two using Jest with React, reinforcing unit and integration testing skills for reliable component interactions.
Develop and test the functionality for adding new feedback in a React app, using Jest unit and integration tests.
Learn how to mock API calls for unit and integration tests in a React Jest workflow, bypassing real back-end calls to improve test speed and reliability.
Install the mock service worker (msw) to mock API calls and use findBy queries to wait for responses, then define GraphQL or API mocks in a handler file.
Create a mock msw handler for the create feedback endpoint, intercepting frontend calls to localhost:5000, returning a fake response with an id and the submitted text.
Set up and integrate a mock server by adding a handler in the mock folder, importing mock service worker settings, and starting the server, with tests updated to call it.
Update the integration test to switch from get to find by text, await promises, and intercept the save feedback api call, then add the endpoint to make the test pass.
Implement a fetch-based API call to save user feedback using async/await, configuring post requests with JSON headers and stringified body, and confirm integration tests pass.
Debug a passing Jest unit and integration test in React, fix input duplication by adding a clear after save, and validate the fix with screen.debug and integration tests.
Explore how integration tests run with a mock server to simulate api calls, intercept requests, and drive user interface updates with fake data.
Learn test driven development with a real backend API and a mock server, build a simple node express backend, and perform end-to-end manual testing from frontend to backend.
In this course you will learn about jest testing library and how to use it to write Unit and Integration test for any react Js application.
We will start by learning how does software development and testing takes place in a real live project in any company.
Then we will learn about the importance of automation tests and importance of writing unit and integration tests.
We will then learn about Behavior driven development (BDD) and Test driven development(TDD) and the difference between the two techniques.
We will also learn to create react app and functional components. Then write tests for these components.
We will also see how to Mock real API calls for our integrating test.
All these and much more we will learn in handson based approach in a step by step manner.
Following is the sequence we will cover the various topics:
0-Introduction video - Course Overview
1-Why we need Testing and SDLC
2-BDD vs TDD Testing Approach
3-Types of Testing - UT, IT, E2E
4-Creating React App and Adding Testing Capability
5-Creating Some DOM elements for Basic Testing
6-Writting and Running our First Test
7-How to get the Role of an Element
8-Understanding difference between getBy queryBy and findBy
9-Code Hands-on for getBy queryBy
10-Requirements for Unit Test Cases
11-Setup project structure and install react extention
12-Test case for Feedback Form Onload Scenario
13-Grouping similar Tests in one Describe block
14-Adding user interaction to our Test with the help of fireEvent
15-Understanding React Project Flow and Structure
16-State variable and useState hook
17-React Functional component and JSX
18-Developing the Feedback Form
19-Testing the Application manually and with Unit test
20-Using userEvent to test user interaction
21-Unit test Requirement for Feedback Overview component
22-Feedback Overview Test for No Feedback Found
23-Feedback Overview Test for 2 Feedback Found
24-Developing the Feedback Overview Component and Passing data
25-Executing the test cases
26-How to Improve your test cases
27-Requirements for Integration test scenarios
28-Implementing Integration test Scenario 1
29-Implementing Integration test Scenario 2
30-Developing the functionality of adding new feedback
31-Requirements overview for Mocking API calls
32-Installing MSW library
33-Creating MSW handler for create feedback
34-Setting up the mock server
35-Update the Integration test based on API call
36-Make API call for saving feedback via fetch method
37-How to Debug the Test case
38-Deep dive into understanding the Integration test and Mock server flow
39-Backend Node API and testing Frontend with Real backend