JavaScript Unit Testing – The Practical Guide

th_wmtJGGnvMx4OIQgPE0KU2YMFXpiQAhD4

自动化测试是现代(Web)开发中的一个关键概念。然而,这个概念一开始可能会令人生畏,因此许多开发人员回避潜入测试并将测试添加到他们的项目中。

本课程将从头开始教您使用 JavaScript 进行自动化单元和集成测试。您将了解如何编写测试并将其添加到您的项目中,应该(和不应该)测试什么以及如何测试简单和更复杂的代码。

您将了解编写自动化测试所需的软件和设置,并将作为课程的一部分提供示例项目。这是一门动手实践的课程,因此您不会被困在理论中 – 相反,您将能够通过实际示例学习所有关键概念。

在课程中,Vitest 将作为主要的测试库和工具。它是提供 Jest 兼容性的现代 JavaScript 测试运行器和断言库。因此,无论您使用 Vitest 还是 Jest,您将在本课程中学到的内容都会对您有所帮助。无论您使用哪种测试设置,核心概念都将适用!

作为本课程的一部分,将定义和解决典型的测试问题,并详细教授模拟或与间谍合作等常见策略。本课程也不关注特定类型的 JavaScript 项目——也不关注任何特定的库或框架。

相反,您将学习如何自动测试您的(普通)JavaScript 代码,无论它是 NodeJS 还是前端项目。您将在本课程中获得的基础知识将在您未来的所有项目中为您提供帮助 – 后端(NodeJS)和前端(vanilla JS、React、Vue、Angular)等。

本课程将为您提供一个非常坚实的基础,以便您可以开始向所有 JavaScript 项目添加测试。

详细,本课程将教你

  • 究竟什么是“测试”或“自动化测试”(以及为什么需要它)
  • “单元测试”具体是什么
  • 在项目中启用自动化单元测试需要哪些工具
  • 如何编写单元测试
  • 如何开始集成测试
  • 如何制定不同的期望(断言)
  • 编写测试时要遵循哪些模式
  • 如何测试异步和同步代码
  • 如何在间谍和模拟的帮助下处理副作用
  • 如何在实际项目和示例中应用所有这些概念

Learn how to write automated tests (unit & integration tests) for your JavaScript projects with Vitest & Jest

Published 05/2022
MP4 | Video: h264, 1280×720 | Audio: AAC, 44.1 KHz, 2 Ch
Genre: eLearning | Language: English + srt | Duration: 91 lectures (5h 39m) | Size: 2.29 GB

What you’ll learn

Write and structure unit & integration tests
Remove side effects from tests via mocking and spies
Work with popular JavaScript test runners and libraries
Write good tests and focus on testing core business logic

Requirements

Basic JavaScript knowledge is required
NO prior testing knowledge is necessary at all

Description

Automated testing is a key concept in modern (web) development.

Yet it is a concept that can be intimidating at first, hence many developers shy away from diving into testing and adding tests to their projects.

This course will teach you automated unit & integration testing with JavaScript from the ground up. You will learn how tests are written and added to your projects, what should (and should not) be tested and how you can test both simple as well as more complex code.

You will learn about the software and setup required to write automated tests and example projects will be provided as part of the course. It’s a hands-on, practical course, hence you won’t get stuck in theory – instead you’ll be able to learn all key concepts at real examples.

In the course, Vitest will be used as the main testing library & tool. It’s a modern JavaScript test runner and assertion library that provides Jest compatibility. Hence what you’ll learn in this course will help you no matter if you’re working with Vitest or Jest. And the core concepts will apply, no matter which testing setup you’re using at all!

As part of this course, typical testing problems will be defined and solved and common strategies like mocking or working with spies are taught in great detail. This course also does not focus on specific types of JavaScript projects – neither does it focus on any specific library or framework.

Instead, you’ll learn how to automatically test your (vanilla) JavaScript code, no matter if it’s a NodeJS or frontend project. The fundamentals you’ll gain in this course will help you in all your future projects – backend (NodeJS) and frontend (vanilla JS, React, Vue, Angular) alike.

This course will provide you with an extremely solid foundation to build up on, such that you can start adding tests to all your JavaScript projects.

In detail, this course will teach you

What exactly “testing” or “automated testing” is (and why you need it)

What “unit testing” is specifically

Which tools you need to enable automated unit tests in your projects

How to write unit tests

How to get started with integration tests

How to formulate different expectations (assertions)

Which patterns to follow when writing tests

How to test asynchronous and synchronous code

How to deal with side effects with help of spies & mocks

How to apply all these concepts in real projects & examples

Who this course is for
JavaScript developers who want to add tests to their projects
Developers who always considered automated testing to be intimidating

shVE9fiK2bvh5mWpZQWsBfuyR1jS8YQt

资源下载此资源仅限VIP下载,请先
本站资源仅限VIP会员下载点击购买VIP会员

原创文章,作者:steven,如若转载,请注明出处:https://rr3d.cn/32571.html

赞 (0)
steven的头像steven
上一篇 2022年5月5日 上午8:47
下一篇 2022年5月5日

相关推荐

发表回复

登录后才能评论
分享本页
返回顶部