- name
- framework-testing
- description
- Specialist in Software Testing Engineering. Broad command of Black-Box techniques (BVA, Equivalence Partitioning, Decision Tables, FSM, Pairwise), White-Box techniques (CFG, McCabe, MC/DC, Data Flow/du-paths, Program Slicing), Mutation Testing, Integration (Call Graph, MM-Paths), TDD, and ISTQB Test Management.
# AI Skill: Testing Engineering (Testing Specialist)
This skill guides the AI to act as a senior-level specialist in **Software Testing Engineering and Quality**, grounded in the classic and academic bodies of knowledge: **Paul C. Jorgensen** (*Software Testing: A Craftsman's Approach*), **Ali Mili & Fairouz Tchier** (*Software Testing: Concepts and Operations*), and **Brian Hambling et al.** (*Software Testing: ISTQB/ISEB Guide*).
The goal is to design, architect, and implement rigorous, balanced, and mathematically grounded test suites to ensure no regression reaches the production environment.
---
## 🧭 Fundamentals and Principles of Testing Engineering
### 1. Propagation Chain: Fault, Error, and Failure
- **Fault / Bug**: A static anomaly present in the source code or specification, generated by human mistake.
- **Error**: An incorrect intermediate system state during execution, resulting from an activated fault.
- **Failure**: An externally observable deviation between the behavior expected by the oracle and the system's actual output/result.
### 2. The Oracle Problem
A **Test Oracle** is any mechanism capable of determining whether the output produced by the program under test is correct for a given input.
- When a direct oracle is feasible: Explicit assertions, nominal values, and contracts.
- When a direct oracle is absent or expensive: Application of **Metamorphic Testing** through relational relations ($f(k \cdot x) = k \cdot f(x)$) and **Property-Based Testing**.
### 3. The Test Pyramid and Isolation Strategy
- **Unit Tests (70-80%)**: Test atomic units at the method or class level with full isolation via Mocks, Stubs, and Spies.
- **Integration Tests (15-20%)**: Test inter-module and inter-class collaboration using the Call Graph and MM-Paths.
- **End-to-End / E2E Tests (5-10%)**: Test complete user flows (Atomic System Tests) in an integrated environment.
---
## 📐 Formal Black-Box (Functional) Techniques
See the complete guide in [black-box-techniques.md](./references/black-box-techniques.md).
### 1. Boundary Value Analysis (BVA)
For each continuous variable in $[a, b]$, sample the canonical points:
- $a$ ($min$), $a^+$ ($min+$), $nom$ ($nominal$), $b^-$ ($max-$), $b$ ($max$), $a^-$ ($min-$), $b^+$ ($max+$).
- **Traditional BVA ($4n + 1$)**: Single-fault hypothesis within the valid boundaries.
- **Robustness BVA ($6n + 1$)**: Tests valid boundaries and values immediately outside the domain to validate exception handling.
- **Worst-Case BVA ($5^n$)**: Cartesian product of all 5 points across all $n$ variables to detect multiple-interaction faults.
- **Robust Worst-Case BVA ($7^n$)**: Exhaustive combination of valid and invalid values.
### 2. Equivalence Partitioning
- **Weak Normal**: 1 value from each valid class (single-fault hypothesis).
- **Strong Normal**: Cartesian product of all valid partitions (interactions).
- **Weak Robust**: Covers invalid classes in isolation, one per test.
- **Strong Robust**: Cartesian combination of all valid and invalid partitions.
### 3. Decision Tables
- Complete mapping of boolean combinations to intricate business rules.
- Application of boolean algebra for simplification via "Don't Care" ($-$) and verification of rule completeness and consistency.
### 4. Finite State Machines (FSM) and Combinatorial Testing (Pairwise)
- **Transition Coverage (0-switch)** and **Transition Pairs (1-switch)** for event-driven reactive systems.
- **All-Pairs / Orthogonal Arrays**: Exponential reduction of parameter combinations while guaranteeing 100% coverage of interaction pairs ($t=2$).
---
## 🔬 Formal White-Box (Structural) Techniques
See the complete guide in [white-box-and-dataflow.md](./references/white-box-and-dataflow.md).
### 1. Control Flow Graph (CFG) and Cyclomatic Complexity
- **McCabe Cyclomatic Complexity**: $V(G) = e - n + 2p$ or $V(G) = d + 1$ (where $d$ is the number of predicate nodes).
- **Basis Path Testing**: Construction of a set of $V(G)$ linearly independent paths in the graph basis.
### 2. Structural Coverage Hierarchy
- **Statement ($C_0$)**: 100% of statements executed.
- **Branch / Decision ($C_1$)**: 100% of conditional branches (True and False) exercised.
- **Modified Condition/Decision Coverage (MC/DC)**: Each atomic condition inside a compound boolean expression is shown to independently change the final result. Required for high-reliability critical systems.
### 3. Data Flow Testing
- Analysis of definition and use pairs: $\text{def}(v, n)$ and $\text{use}(v, n)$ (computational $\text{c-use}$ and predicate $\text{p-use}$).
- Coverage criteria: **All-Defs**, **All-Uses**, and **All-DU-Paths** (all definition-free simple paths between definition and use).
### 4. Program Slicing
- **Static Slicing**: Identification of the statements that affect a variable at a given point in the code, for safe isolation of regression suites.
- **Dynamic Slicing**: Tracing the slice activated during failing executions for automatic root-cause localization of the fault.
---
## 🧬 Mutation Testing and Reliability Models
See the complete guide in [mutation-and-fault-based-testing.md](./references/mutation-and-fault-based-testing.md).
- **Mutation Score ($MS$)**:
$$MS(T, P) = \frac{\text{Mutantes Mortos}}{\text{Total de Mutantes} - \text{Mutantes Equivalentes}} \times 100\%$$
- **Mutation Operators**: AOR (Arithmetic), ROR (Relational), COR (Conditional), SDL (Statement Deletion).
- **Mills Fault Seeding Model (Capture-Recapture)**:
$$\hat{N} = \frac{n \cdot S}{s} \implies N_{\text{residual}} = n \left(\frac{S}{s} - 1\right)$$
---
## 🏗️ Integration and Object-Oriented Strategies
See the complete guide in [integration-and-system-testing.md](./references/integration-and-system-testing.md).
- **Call-Graph-Based Integration**: Pairwise Integration and Neighborhood Integration instead of naive static decomposition.
- **MM-Paths (Method-to-Method Paths)**: Inter-class method execution chains triggered by messages.
- **OO Testing**: Mitigation for Inheritance pitfalls (test flattening), Polymorphism (dynamic binding matrices), and Object State.
---
## 📋 In-Depth Reference Documents
1. [Black-Box Techniques (BVA, Partitions, Decision Tables, FSM, Pairwise)](./references/black-box-techniques.md)
2. [Structural Testing, McCabe Complexity, MC/DC, and Data Flow](./references/white-box-and-dataflow.md)
3. [Mutation Testing, Fault Seeding, and Metamorphic Testing](./references/mutation-and-fault-based-testing.md)
4. [Integration Strategies, MM-Paths, and OO Testing](./references/integration-and-system-testing.md)
5. [Test Management, Static Reviews, and ISTQB](./references/istqb-test-management-and-reviews.md)
---
## 🛠️ Practical Example: BVA + Decision Table in TypeScript
```typescript
import { describe, it, expect } from 'vitest';
// Função de cálculo de desconto e elegibilidade
export interface DiscountInput {
customerAge: number; // Limites válidos: [18, 100]
cartValue: number; // Limites válidos: [1, 10000]
isLoyalMember: boolean;
}
export function calculateDiscount(input: DiscountInput): number {
if (input.customerAge < 18 || input.customerAge > 100) {
throw new Error('Idade fora do intervalo permitido [18, 100].');
}
if (input.cartValue < 1 || input.cartValue > 10000) {
throw new Error('Valor do carrinho fora do intervalo [1, 10000].');
}
if (input.isLoyalMember && input.cartValue >= 1000) {
return 0.20; // 20% desconto
}
if (input.isLoyalMember || input.customerAge >= 60) {
return 0.10; // 10% desconto
}
return 0.0;
}
describe('calculateDiscount - BVA & Decision Table Tests', () => {
// 1. Testes de Robustez nos Limites de Idade [18, 100]
it.each([
{ age: 17, cart: 500, loyal: false, error: true }, // min- (Robusto Inválido)
{ age: 18, cart: 500, loyal: false, expected: 0.0 }, // min
{ age: 19, cart: 500, loyal: false, expected: 0.0 }, // min+
{ age: 99, cart: 500, loyal: false, expected: 0.10 },// max- (Idoso)
{ age: 100, cart: 500, loyal: false, expected: 0.10 },// max
{ age: 101, cart: 500, loyal: false, error: true }, // max+ (Robusto Inválido)
])('valida limites de idade (BVA): age=$age', ({ age, cart, loyal, expected, error }) => {
if (error) {
expect(() => calculateDiscount({ customerAge: age, cartValue: cart, isLoyalMember: loyal })).toThrow();
} else {
const discount = calculateDiscount({ customerAge: age, cartValue: cart, isLoyalMember: loyal });
expect(discount).toBe(expected);
}
});
// 2. Testes de Regras da Tabela de Decisão
it('aplica 20% de desconto para membro fiel com carrinho >= 1000', () => {
const discount = calculateDiscount({ customerAge: 30, cartValue: 1000, isLoyalMember: true });
expect(discount).toBe(0.20);
});
});
```
---
## 🔗 Integration with Other Skills
- [qa-engineer](../../roles/qa-engineer/SKILL.md): Quality planning and orchestration and defect reports.
- [framework-pytest](../framework-testing-python/SKILL.md): Test automation in Python with fixtures and formal parameterized tests.
- [framework-unittest](../framework-testing-python/SKILL.md): Unit tests with structured TestCase classes.
- [framework-jest](../framework-testing-javascript/SKILL.md) / [framework-mocha](../framework-testing-javascript/SKILL.md): Automation in JS/TS ecosystems.
- [framework-criterion](../framework-criterion/SKILL.md): Low-level testing for compiled C/C++ languages.
View on GitHub