From 976ddb7475eb22d6bf4aa46641e6ae06521abeff Mon Sep 17 00:00:00 2001 From: Vojtech Novak Date: Wed, 1 Apr 2020 17:37:40 +0200 Subject: [PATCH 1/3] minor improvements to testing guide --- docs/testing-overview.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/testing-overview.md b/docs/testing-overview.md index 37ed1e02af4..fbcec209609 100644 --- a/docs/testing-overview.md +++ b/docs/testing-overview.md @@ -14,13 +14,13 @@ In this guide, we will cover different, automated ways to ensure your app works ## Why Test -We're humans, and humans make mistakes. Testing is important because it helps you uncover these mistakes or verifies that your code is working. Perhaps even more importantly, testing ensures that your code continues to work in the future as you add new features, refactor the existing ones, or upgrade major dependencies of your project. +We're humans, and humans make mistakes. Testing is important because it helps you uncover these mistakes and verifies that your code is working. Perhaps even more importantly, testing ensures that your code continues to work in the future as you add new features, refactor the existing ones, or upgrade major dependencies of your project. There is more value in testing than you might realize. One of the best ways to fix a bug in your code is to write a failing test that exposes it. Then when you fix the bug and re-run the test, if it passes it means the bug is fixed, never reintroduced into the code base. Tests can also serve as documentation for new people joining your team. For people who have never seen a codebase before, reading tests can help them understand how the existing code works. -Last but not least, more automated testing means less time spent with manual QA, freeing up valuable development time. +Last but not least, more automated testing means less time spent with manual QA, freeing up valuable time. ## Static Analysis @@ -41,7 +41,7 @@ To make your app more testable, start by separating the view part of your app— Theoretically, you could go so far as to move all logic and data fetching out of your components. This way your components would be solely dedicated to rendering. Your state would be entirely independent of your components. Your app’s logic would work without any React components at all! -> We encourage you to further explore the topic of testabile coding in other learning resources. +> We encourage you to further explore the topic of testable code in other learning resources. ## Writing Tests @@ -107,8 +107,9 @@ In integration testing, real individual units are combined (same as in your app) > Please note that the terminology around what integration testing means is not always consistent. Also, the line between what is a unit test and what is an integration test may not always be clear. For this guide, your test falls into "integration testing" if it: > -> - Uses an external system (such as weather service API) -> - Makes a network call to other application +> - Combines several modules of your app as described above +> - Uses an external system (such as a native module or a `node_modules` dependency) +> - Makes a network call to other application (such as the weather service API) > - Does any kind of file or database I/O  @@ -240,7 +241,7 @@ Instead, E2E testing libraries allow you to find and control elements in the scr E2E tests give you the highest possible confidence that part of your app is working. The tradeoffs include: - writing them is more time consuming compared to the other types of tests -- they can be slower to run +- they are slower to run - they are more prone to flakiness (a "flaky" test is a test which randomly passes and fails without any change to code) Try to cover the vital parts of your app with E2E tests: authentication flow, core functionalities, payments, etc. Use faster JS tests for the non-vital parts of your app. The more tests you add, the higher your confidence, but also, the more time you'll spend maintaining and running them. Consider the tradeoffs and decide what's best for you. From e01c57b8d32386e2eae39c1b0d0fdcc705fafd92 Mon Sep 17 00:00:00 2001 From: Vojtech Novak Date: Thu, 2 Apr 2020 15:11:53 +0200 Subject: [PATCH 2/3] Update testing-overview.md --- docs/testing-overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/testing-overview.md b/docs/testing-overview.md index fbcec209609..ea5d709e498 100644 --- a/docs/testing-overview.md +++ b/docs/testing-overview.md @@ -108,7 +108,7 @@ In integration testing, real individual units are combined (same as in your app) > Please note that the terminology around what integration testing means is not always consistent. Also, the line between what is a unit test and what is an integration test may not always be clear. For this guide, your test falls into "integration testing" if it: > > - Combines several modules of your app as described above -> - Uses an external system (such as a native module or a `node_modules` dependency) +> - Uses an external system (such as a `node_modules` dependency) > - Makes a network call to other application (such as the weather service API) > - Does any kind of file or database I/O From 8f9f7394ecc05d085d86cd3cb5c948cda0411744 Mon Sep 17 00:00:00 2001 From: Vojtech Novak Date: Fri, 3 Apr 2020 11:28:42 +0200 Subject: [PATCH 3/3] Update testing-overview.md --- docs/testing-overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/testing-overview.md b/docs/testing-overview.md index ea5d709e498..30d745bf0cc 100644 --- a/docs/testing-overview.md +++ b/docs/testing-overview.md @@ -108,7 +108,7 @@ In integration testing, real individual units are combined (same as in your app) > Please note that the terminology around what integration testing means is not always consistent. Also, the line between what is a unit test and what is an integration test may not always be clear. For this guide, your test falls into "integration testing" if it: > > - Combines several modules of your app as described above -> - Uses an external system (such as a `node_modules` dependency) +> - Uses an external system > - Makes a network call to other application (such as the weather service API) > - Does any kind of file or database I/O