-
Notifications
You must be signed in to change notification settings - Fork 25
Created a Learning hour for introducing differences between front-end and back-end testing strategies #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ronheywood
wants to merge
2
commits into
sammancoaching:main
Choose a base branch
from
ronheywood:frontend-tdd
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
_learning_hours/frontend_testing/introducing_frontend_tdd.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| --- | ||
| theme: frontend_testing | ||
| title: Introducing Frontend TDD | ||
| difficulty: 1 | ||
| author: ronheywood | ||
| affiliation: Spektrix | ||
| tags: frontend tdd javascript testing | ||
| --- | ||
|
|
||
| # Introducing Frontend TDD | ||
|
|
||
| Goal: Understand how TDD applies to browser-based development and how the testing pyramid maps to modern JavaScript apps. | ||
|
|
||
| # Connect: | ||
|
|
||
| ## Bug Stories | ||
|
|
||
| In pairs, share stories about bugs you've encountered on websites or bugs you've released yourself: | ||
| - What happened? | ||
| - How did it make you feel? | ||
| - What was the impact (on users, business, team morale)? | ||
| - How was it discovered? | ||
| - Could it have been prevented with better testing? | ||
|
|
||
| After 5 minutes of discussion, ask for volunteers to share key insights with the whole group. | ||
|
|
||
| # Concept: | ||
|
|
||
| **Introduce the differences between front-end and back-end testing strategies** | ||
|
|
||
| **Reference the Test Desiderata: speed, reliability, feedback, cost (see [Test Desiderata]({% link _learning_hours/test_design/test_desiderata.md %}))** | ||
|
|
||
| **An updated test pyramid (static, unit, integration, End to end)** | ||
|
|
||
|  | ||
|
|
||
| > The pyramid is based on the assumption that broad-stack tests are expensive, slow, and brittle compared to more focused tests, such as unit tests. | ||
|
|
||
| In front-end testing, our integration tests are much more valuable, and they're much faster than backend integration tests too, since there's often little to no infrastructure required. | ||
|
|
||
| End to end tests remain slow and sometimes brittle, so we still use these sparingly to give us confidence on those components that could cause reputational damage if they fail. | ||
|
|
||
| ### The Test Trophy | ||
| Visualize the pyramid now more like: | ||
|  | ||
|
|
||
| ### Static Test Tools | ||
| * [ESLint](https://eslint.org/) - Identifies problematic patterns in JavaScript code | ||
| * [TypeScript](https://www.typescriptlang.org/) - Static type checking for JavaScript | ||
| * [Prettier](https://prettier.io/) - Code formatting tool | ||
| * [SonarQube](https://www.sonarsource.com/products/sonarqube/) - Code quality and security scanner | ||
|
|
||
| ### Unit Test Tools | ||
| * [Jest](https://jestjs.io/) - JavaScript testing framework with built-in assertion library | ||
| * [Vitest](https://vitest.dev/) - Blazing fast unit test framework powered by Vite | ||
| * [Mocha](https://mochajs.org/) - Flexible JavaScript test framework | ||
| * [Jasmine](https://jasmine.github.io/) - Behavior-driven development framework | ||
|
|
||
| ### Integration Test Tools | ||
| * [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/) - Testing React components | ||
| * [Vue Test Utils](https://test-utils.vuejs.org/) - Testing Vue components | ||
| * [Angular Testing Utilities](https://angular.io/guide/testing) - Testing Angular components | ||
| * [Playwright Component Testing](https://playwright.dev/docs/test-components) - Component testing across frameworks | ||
|
|
||
| ### End to End Test Tools | ||
| * [Cypress](https://www.cypress.io/) - JavaScript end-to-end testing framework | ||
| * [Playwright](https://playwright.dev/) - Reliable end-to-end testing for modern web apps | ||
| * [Selenium](https://www.selenium.dev/) - Browser automation tool | ||
| * [TestCafe](https://testcafe.io/) - Automated browser testing | ||
|
|
||
| ## Concrete Practice: | ||
|
|
||
| Diagram the test trophy as it would apply to your website. | ||
| Which features and components would benefit from which kind of test? | ||
|
|
||
| ## Conclusions: | ||
|
|
||
|
|
||
| ### Further Reading: | ||
| [Martin Fowler – The Practical Test Pyramid](https://martinfowler.com/bliki/TestPyramid.html) | ||
|
|
||
| [Kent C. Dodds – Write Tests. Not Too Many. Mostly Integration](https://kentcdodds.com/blog/write-tests) | ||
|
|
||
| <iframe width="1007" height="566" src="https://www.youtube.com/embed/Fha2bVoC8SE?list=PLV5CVI1eNcJgNqzNwcs4UKrlJdhfDjshf" title="Kent C. Dodds – Write tests. Not too many. Mostly integration." frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen aria-label="Video: Kent C. Dodds explains testing strategy focusing on integration tests"></iframe> | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it's a good idea to talk about Tools in this one - maybe change it to be more what value these categories provide, and what the scope is