- why?
- how?
- what? comes from experience and the system we're testing and even the tech stack.
- when? test-first vs test after.
Confidence (in the sense of trusting your code). Verifying correctess.
We write code to test our code.
Why learn it?
- good for resume.
- can work on QA and DevOps.
- helps understand how an application works.
- prevents regressions.
- safety net.
Tooling: Test runner (Mocha) + assertion library (Chai).
We are using Jest.
What could happen if I have no tests.
- test manually, as the app grows, the time needed will not scale.
- regressions, code that used to work breaks.
- you just don't know if the code is correct for all cases.
- adding new features becomes slow.
Types
- unit tests. Fastest.
- integration tests.
- end to end. Slow.
- component testing. (for component based frameworks, like React, Angular, Vue, etc.)
- snapshot testing. (unique to our stack/tools)
- coverage test.
- functional testing.
- performance testing.
- aceptance test.
We'll concentrate on:
- unit
- component
- snapshot
when, then