Tests Documationtion
what tests we run ?
We run 4 Types of Test :
-
Static tests – Static code analysis is a method of debugging by examining source code before a program is run. It's done by analyzing a set of code against a set (or multiple sets) of coding rules. Static code analysis and static analysis are often used interchangeably, along with source code analysis.
-
Unit tests – They test the smallest chunks of functionalities isolated from other components or the whole process. They are, relatively speaking, the easiest, quickest and cheapest to create, maintain and modify. But they do not guarantee, that the application as a whole will work after deployment.
-
Integration tests – They play a helper role to bridge the gap between unit and E2E tests. They test how parts of an application interact with one another.
-
End-to-end(E2E) tests - They test the whole application’s processes. Can also check UI layer and test for visual regressions (any unwanted quirks of user interface, that may emerge after latest changes being deployed). Due to their complexity, they are slower, more expensive and harder to create, maintain and modify. But at the same time, they give you the most confidence when you need to decide if your software is working or not and if it will fulfil user’s needs.
Summary
Static Tests:
Goal : Debugging by examining the code without executing the program..
Tools : Eslint
Unit Tests:
Goal : Verify that individual, isolated parts work as expected.
Tools : Jest + React-testing-library
Integration Tests
Goal : Verify that several units work together in harmony.
Tools : Jest + React-testing-library
End to End (E2E) Tests
Goal : A helper robot that behaves like a user to click around the app and verify that it functions correctly.
Tools : Cypress
Cypress
ALL Commands retlated to testing
Runs Both integration + Unit
npm run test
Unit
npm run test:unit
Integration
npm run test:integration
End to End E2E
npm run test:e2e
Watch mode
npm run test:watch
Test coverage
npm run test:coverage
Test Static
npm run lint
References
- Naming Convention PFQCN: /quality_assurance/naming-convention-pfqcn
- Tests E2E Cypress : /quality_assurance/tests-E2E-Cypress
- Tests integration : /quality_assurance/tests-Integration
- Tests static : /quality_assurance/tests-Static
- Tests unit jest : /quality_assurance/tests-Unit-Jest