Skip to main content

测试 Ionic React

🌐 Testing Ionic React

本文档概述了如何测试使用 @ionic/react 构建的应用。它涵盖了使用 React 进行测试的基础知识,以及开发者可以用来测试其应用的特定工具和库。

🌐 This document provides an overview of how to test an application built with @ionic/react. It covers the basics of testing with React, as well as the specific tools and libraries developers can use to test their applications.

介绍

🌐 Introduction

测试是开发过程中的一个重要环节,它有助于确保应用按预期工作。在 @ionic/react 中,测试是使用一组合工具和库进行的,包括 Jest 或 Vitest、React 测试库、Playwright 或 Cypress。

🌐 Testing is an important part of the development process, and it helps to ensure that an application is working as intended. In @ionic/react, testing is done using a combination of tools and libraries, including Jest or Vitest, React Testing Library, Playwright or Cypress.

测试类型

🌐 Types of Tests

可以编写两种类型的测试:

🌐 There are two types of tests that can be written:

单元测试:单元测试用于独立测试各个函数和组件。常用的单元测试工具有 JestVitestReact Testing Library

集成测试:集成测试用于测试不同组件如何协同工作。CypressPlaywright 通常用于集成测试。