Skip to content

Latest commit

 

History

History
61 lines (37 loc) · 1.91 KB

File metadata and controls

61 lines (37 loc) · 1.91 KB

👾 Unit Test

Introduction

AppFlowy is becoming a complex application, in order to maintain stability, we encourage developers to write more tests. Testing your code ensures that the software you develop works as expected and makes it less vulnerable to attackers.

This article will cover:

  • The tests in AppFlowy
  • How to run the tests in AppFlowy
  • How to write a test in AppFlowy
  • Code coverage

The tests in AppFlowy

AppFlowy is written in Dart and Rust. We call it frontend tests in Dart and Backend tests in Rust.

frontend tests

The frontend tests locate in frontend/app_flowy/test. It contains three folders. The bloc test folder, integration test folder, and widget test folder.

bloc test It contains the bloc tests of AppFlowy.
widget test It contains the widget tests of AppFlowy.
integration test It contains the integration tests of AppFlowy

When creating a new test, you should put it in the right folder.

Backend tests

WIP

How to run the tests

Run tests one by one

In order to run the tests one by one, it needs to build the Backend library first.

// Make sure your current path is AppFlowy/frontend
cargo make build-test-lib

After building the Backend library, you can click the Run|Debug button to run the test.

Run all the tests

// Make sure your current path is AppFlowy/frontend
cargo make dart_unit_test

How to write a test

WIP

Code coverage

WIP