Skip to content

Commit a50f1d9

Browse files
authored
Update README.md
1 parent 32f44d2 commit a50f1d9

File tree

1 file changed

+21
-183
lines changed

1 file changed

+21
-183
lines changed

docs/README.md

Lines changed: 21 additions & 183 deletions
Original file line numberDiff line numberDiff line change
@@ -18,202 +18,40 @@ In order to demonstrate the knowledge acquired in virtual classes, this project
1818

1919
## Learned and Developed Knowledge
2020

21-
### Testing
21+
### Software Testing
2222

23-
#### Definition and Objectives
23+
Testing is essential to detect bugs before deployment, increase confidence in the code, support release decisions, and promote good development practices. It is a key part of methodologies like Waterfall, Agile, and DevOps, where tests are often automated in continuous integration and delivery cycles.
2424

25-
Software testing is a fundamental process whose main purpose is to identify errors (bugs) before code is deployed to production. Its implementation pursues the following objectives:
25+
### Types of Tests
2626

27-
1. **Early error detection**: Allow the identification of defects during the early stages of the development cycle, in order to minimize the cost and impact of fixes.
28-
2. **Increased confidence in the code**: Provide greater assurance regarding the stability and functionality of the software, although no set of tests can guarantee a complete absence of failures.
29-
3. **Support in deployment decision-making**: Facilitate the assessment of whether the software is ready to incorporate new features or, conversely, whether it is preferable to delay the release to correct issues.
30-
4. **Promotion of code quality and cleanliness**: Encourage developers to write modular and well-structured code, since more readable and organized code is easier to test and maintain.
31-
32-
#### Role in Project Management (PM) and DevOps
33-
34-
Software testing must be integrated into any development methodology, whether Waterfall, Agile, or DevOps. In particular, within a DevOps environment, testing is part of a continuous delivery loop (known as the “infinite loop”) and is usually automated to ensure fast and reliable deployments.
35-
36-
- In **Waterfall** methodologies, testing phases are planned after the completion of each design or development stage.
37-
- In **Agile** methodologies, testing is incorporated iteratively into each sprint, fostering constant feedback.
38-
- In **DevOps** environments, test automation allows the software to be validated with each change in the repository, maintaining quality throughout the entire lifecycle.
39-
40-
### Types of Testing
41-
42-
#### 1. External Tests (End-to-End Visual)
43-
44-
1. **Manual**
45-
Involve a tester following a predefined set of steps and visually verifying the correct operation of the user interface. This approach helps detect usability and flow issues that sometimes escape automated tests.
46-
47-
2. **Automated**
48-
Based on recording and replaying user interactions with the application (clicks, text entries, navigation, etc.). These tests are scheduled to run periodically to validate that the interface maintains its expected behavior after code changes.
27+
#### 1. External Tests (End-to-End)
28+
- Manual: A tester visually verifies the application's behavior following predefined steps.
29+
- Automated: Simulate user interactions to validate behavior after code changes.
4930

5031
#### 2. Functional Tests
51-
52-
1. **Unit**
53-
Evaluate individual units of code (functions, classes, or modules) in isolation. Each test should verify a single aspect of the unit’s behavior under controlled conditions.
54-
55-
2. **Integration**
56-
Verify that multiple components, modules, or services work correctly together. For example, in a backend context, this involves making HTTP requests to the API and validating the responses received, ensuring that each layer (controller, service, database) interacts as intended.
57-
58-
3. **End-to-End (E2E)**
59-
Simulate complete user flows, such as login processes, purchase workflows, or any other typical application journey. These tests ensure that the application, in its entirety, responds appropriately to user actions. Due to their complexity in creation and maintenance, it is recommended to limit their use to the most critical scenarios.
32+
- Unit: Evaluate individual functions or modules in isolation.
33+
- Integration: Check that multiple components work correctly together.
34+
- End-to-End: Simulate complete user flows to ensure the application functions as expected.
6035

6136
#### 3. Non-Functional Tests
37+
- Security: Detect vulnerabilities and validate the protection of sensitive data.
38+
- Performance: Evaluate response times and behavior under load.
39+
- Usability: Analyze real user experience within the interface.
40+
- Accessibility: Ensure the application is usable by people with disabilities.
6241

63-
1. **Security**
64-
Aim to detect vulnerabilities in dependencies and packages, as well as ensure proper encryption and handling of sensitive data. They include penetration testing, dependency audits, and authentication/authorization checks.
65-
66-
2. **Performance**
67-
Evaluate metrics such as Time To First Byte (TTFB), the application’s capacity to handle simultaneous load, and the calculation of operating costs based on usage. These tests are essential for ensuring optimal performance in high-concurrency production environments.
68-
69-
3. **Usability**
70-
Analyze real user interactions with the application in order to identify potential difficulties or barriers in navigation. Usability studies, user testing, and interaction metrics analysis can be employed.
71-
72-
4. **Accessibility**
73-
Verify that the interface is usable for people with disabilities, ensuring that all visual elements are correctly rendered and that alternatives exist for keyboard navigation or screen readers. Color contrast and semantic HTML adequacy are also checked.
74-
75-
### Support Tools
76-
77-
#### Basic Requirements
78-
79-
- **Deep knowledge of the programming language** to be tested.
80-
- **Familiarity with the existing code**, as well as the application’s architecture.
81-
- **Understanding of the functionalities to be tested**, including requirements and acceptance criteria.
82-
83-
#### Recommended Software
84-
85-
1. **Unit Testing**
86-
87-
- **Jasmine**: Testing framework for JavaScript.
88-
- **Jest**: Testing tool developed by Facebook, widely used in React and Node.js projects.
89-
- **Mocha + Chai**: Combination of runner (Mocha) and assertion library (Chai) for Node.js.
90-
91-
2. **Functional Testing**
92-
93-
- **Supertest**: Library for making HTTP requests and validating responses in Node.js environments.
94-
95-
3. **E2E Testing**
96-
- **Selenium**: Framework that allows browser automation.
97-
- **Puppeteer**: High-level library to control Chrome/Chromium via the DevTools Protocol.
98-
- **Protractor**: Solution specifically for Angular projects.
99-
- **Playwright**: Cross-platform tool for reliable testing in web environments (Chrome, Firefox, Safari).
100-
101-
## Jest
102-
103-
Jest is a unit testing framework developed by Facebook, designed to be fast, extensible, and easy to configure. Its main features include:
104-
105-
1. **Configuration and Settings**
106-
107-
- Allows defining configuration files (`jest.config.js`) to establish search patterns, directory exclusions, code transformations (e.g., Babel), and module mapping.
108-
109-
2. **Hooks (beforeEach, afterEach, etc.)**
110-
111-
- Provides lifecycle functions to set up the environment before each test (`beforeEach`) and perform cleanup after execution (`afterEach`). It also includes `beforeAll` and `afterAll` for suite-level actions.
112-
113-
3. **Exception Handling**
114-
115-
- Supports assertions that expect certain functions to throw exceptions (`toThrow()`) and captures asynchronous errors.
116-
117-
4. **Promise Testing**
118-
119-
- Facilitates validation of resolved and rejected promises using methods like `resolves` and `rejects`, as well as the `async/await` syntax.
120-
121-
5. **Mocking Modules and Functions**
122-
123-
- Enables simulating dependencies and replacing real implementations with mocks, which makes it possible to isolate the unit under test and control the behavior of external modules.
124-
125-
6. **Code Coverage**
126-
- Generates coverage reports that indicate which lines, branches, and functions have been executed during tests. This helps quantify test effectiveness and pinpoint untested areas.
127-
128-
## TDD (Test Driven Development)
129-
130-
### Definition
131-
132-
Test Driven Development (TDD) is an iterative methodology in which automated tests are written before implementing functionality. The basic cycle, known as **Red–Green–Refactor**, consists of:
133-
134-
1. **Red**: Write a test that fails (since the functionality does not yet exist).
135-
2. **Green**: Implement the minimal functionality required for the test to pass.
136-
3. **Refactor**: Improve the code without changing its behavior, ensuring that all tests continue to pass.
137-
138-
This cycle repeats continuously for each new requirement or change in the system.
139-
140-
#### TDD Laws (Robert C. Martin)
141-
142-
1. **Do not write production code without first writing a test that fails.**
143-
2. **Do not write more than one unit test that is sufficient to cause a single failure.** (Even a compilation error counts as a failure.)
144-
3. **Do not write more code than is necessary to make the test pass.**
145-
146-
#### Additional Rules
147-
148-
1. **Clearly specify the functionality requirements**: Without precise definitions, the TDD process loses effectiveness.
149-
2. **Consider all possible cases** (including successes and failures) within the acceptance criteria.
150-
3. **Design each test to verify only the logic of the unit under test**, using mocks when necessary to isolate it from external dependencies.
151-
4. **Determine exactly what aspect is being tested in each test**, avoiding covering multiple criteria in a single test.
152-
5. **The number of tests is not predetermined**, but depends on the scenarios covered by the implemented functionality.
153-
154-
#### SOLID Principles Applied in TDD
155-
156-
- **S – Single Responsibility Principle**: Each class or module should have only one responsibility.
157-
- **O – Open/Closed Principle**: Code should be extendable without modifying its existing implementation.
158-
- **L – Liskov Substitution Principle**: Any derived type must be substitutable for its base type without altering the correct behavior of the program.
159-
- **I – Interface Segregation Principle**: Do not force a class to depend on interfaces it does not use.
160-
- **D – Dependency Inversion Principle**: Implementation details should depend on abstractions, not the other way around.
161-
162-
#### Benefits of TDD
163-
164-
- Improves overall code quality by forcing developers to think about requirements before writing implementation.
165-
- Promotes requirement-driven design, reducing unnecessary features.
166-
- Produces simpler code focused on minimal viable functionality.
167-
- Reduces redundancy and facilitates early error identification.
168-
- Decreases debugging time and increases team productivity.
169-
- Contributes to a codebase less prone to future defects.
170-
171-
#### Drawbacks of TDD
172-
173-
- Requires a steep learning curve for developers inexperienced with this methodology.
174-
- There is a risk of losing the big-picture perspective by focusing excessively on unit tests and specific cases.
175-
- If requirements are not well-defined, tests may be constructed incorrectly.
176-
- Integrating external services (databases, APIs) can become complex if mocks and stubs are not handled properly.
177-
- Adoption in frontend development can be more challenging, as focus often shifts to business logic rather than the user interface.
178-
- Requires a significant investment of time and resources at the beginning of the project.
179-
180-
## Related Approaches
181-
182-
### BDD (Behavior Driven Development)
183-
184-
Behavior Driven Development (BDD) extends TDD concepts through a shared language between technical teams and business stakeholders. Acceptance tests, written in a natural language style (such as Gherkin), describe the expected system behavior from the user’s perspective.
185-
186-
- **Main Tools**:
187-
188-
- **Cucumber**: Framework that interprets Gherkin files to perform automated tests.
189-
- **Gherkin**: Plain-text syntax based on keywords (Given, When, Then) to describe behavior scenarios.
190-
191-
- **Advantages**:
192-
193-
1. Defines behaviors instead of specific tests, fostering collaboration among developers, testers, and business users.
194-
2. Improves communication and mutual understanding by using a natural language to describe features.
195-
3. Presents a smaller learning curve than pure TDD, since it does not focus solely on unit tests.
196-
4. Facilitates the adoption of Agile methodologies by providing a framework for defining acceptance criteria before implementation begins.
197-
5. Allows reaching a consensus on the functionalities to be developed before writing code.
198-
199-
- **Disadvantages**:
200-
1. There is a risk of omitting relevant cases if behavior scenarios are not defined exhaustively.
201-
2. Maintaining behavior tests for databases and rich frontend applications can become complex.
202-
3. Requires a medium-to-high time investment to write and maintain Gherkin scripts.
203-
4. Demands constant communication among different roles (developers, testers, and clients), which can slow down teams not accustomed to this approach.
42+
### Tools Used
20443

205-
### ATDD (Acceptance Test Driven Development)
44+
- Jasmine, Jest, Mocha + Chai: Unit testing for JavaScript and Node.js.
45+
- Supertest: Functional testing in backend environments.
46+
- Selenium, Puppeteer, Protractor, Playwright: Automated E2E tests in browsers.
20647

207-
Acceptance Test Driven Development (ATDD) is similar to BDD but places greater emphasis on ensuring that the correct objectives are met from the project’s outset.
48+
### TDD (Test Driven Development)
20849

209-
- **Main Objective**: Ensure the team works only on necessary features, avoiding effort on unneeded components.
210-
- **Advantages**:
50+
TDD consists of writing the test first, then the minimal code to pass it, and finally refactoring. This approach improves quality, avoids unnecessary complexity, and helps catch bugs early. It is supported by SOLID principles and promotes cleaner, more maintainable code.
21151

212-
1. Promotes a flexible design prepared for future changes, without conditioning the solution to the UI or database.
213-
2. Provides early feedback on the fulfillment of project objectives.
214-
3. Allows the Product Owner to review and validate acceptance criteria, increasing confidence in the development team.
52+
### BDD and ATDD
21553

216-
- **Operation Mode**: Based on defining acceptance tests that describe the desired system behavior in a comprehensible way for all involved parties. Once validated, the development team implements the functionality iteratively, ensuring that these tests pass before proceeding to new tasks.
54+
BDD (Behavior Driven Development) and ATDD (Acceptance Test Driven Development) aim to align developers, testers, and stakeholders by clearly defining expected behaviors. They use structured languages like Gherkin to describe test scenarios in a format understandable by all involved.
21755

21856
<!-- ------------------------------------------------------------------------------------------- -->
21957

0 commit comments

Comments
 (0)