Ideia Principal: As tabelas de decisão são uma forma sistemática e concisa de modelar comportamentos condicionais complexos em programas de software, facilitando a criação de casos de teste claros e eficazes, detalhando vários cenários num formato estruturado.
Conteúdo:
-
Definição e função das tabelas de decisão
- Definição: Uma tabela de decisão é uma representação tabular de regras, condições e acções que descrevem o comportamento operacional de um sistema em vários cenários.
- Função: Elas são particularmente úteis para programas com lógica de decisão complexa envolvendo múltiplas condições, pois apresentam essas condições e as ações correspondentes de forma organizada, simplificando o processo de análise e teste.
-
Derivação de casos de teste a partir de tabelas de decisão
- Processo: Os casos de teste são derivados de tabelas de decisão examinando cada regra (ou coluna), que define uma combinação única de condições e as ações esperadas. Cada regra representa um cenário específico que pode ser traduzido diretamente para um caso de teste.
- Vantagens: Este método assegura uma cobertura abrangente de todos os cenários possíveis e ajuda a identificar condições ou ações em falta que podem não ser imediatamente aparentes, melhorando assim o rigor do teste.
-
Estrutura dos quadros de decisão:
- Componentes
- Condition Stubs: Listam condições ou critérios que devem ser cumpridos para que as ações ocorram.
- Action Stubs: Listam as ações que são tomadas com base nas condições.
- Regras: Colunas na tabela que especificam estados de condição (por exemplo, verdadeiro/falso, sim/não) e as ações que resultam quando essas condições são satisfeitas.
- Destacando relações: A estrutura ilustra explicitamente como diferentes combinações de condições levam a ações específicas, ajudando os testadores a entender os fluxos lógicos e as interdependências dentro da aplicação.
- Componentes
-
Exemplo de uma tabela de decisão:
- Abaixo está um exemplo de tabela de decisão simplificada para um recurso de login, mostrando como diferentes condições de entrada levam a ações específicas do sistema:
| Condição | Regra 1 | Regra 2 | Regra 3 |
|---|---|---|---|
| Nome de utilizador existe | Sim | Sim | Não |
| Palavra-passe válida | Sim | Não | N/A |
| Ação | Login | Erro | Erro |
Atomic Note: Introduction to Decision Tables in Software Testing
Title: Understanding Decision Tables in Software Testing
Main Idea: Decision tables are a systematic and concise way to model complex conditional behaviors in software programs, facilitating the creation of clear and effective test cases by detailing various scenarios in a structured format.
Content:
-
Definition and Role of Decision Tables:
- Definition: A decision table is a tabular representation of rules, conditions, and actions that describe the operational behavior of a system under various scenarios.
- Role: They are particularly useful for programs with complex decision logic involving multiple conditions, as they lay out these conditions and the corresponding actions in an organized manner, simplifying the analysis and testing process.
-
Derivation of Test Cases from Decision Tables:
- Process: Test cases are derived from decision tables by examining each rule (or column), which defines a unique combination of conditions and the expected actions. Each rule represents a specific scenario that can be directly translated into a test case.
- Benefits: This method ensures comprehensive coverage of all possible scenarios and helps in identifying missing conditions or actions that might not be immediately apparent, thus enhancing test thoroughness.
-
Structure of Decision Tables:
- Components:
- Condition Stubs: List conditions or criteria that must be met for actions to occur.
- Action Stubs: List actions that are taken based on the conditions.
- Rules: Columns in the table that specify condition states (e.g., true/false, yes/no) and the actions that result when those conditions are met.
- Highlighting Relationships: The structure explicitly illustrates how different combinations of conditions lead to specific actions, helping testers understand the logic flows and interdependencies within the application.
- Components:
-
Example of a Decision Table:
- Below is a simplified decision table example for a login feature, showing how different input conditions lead to specific system actions:
| Condition | Rule 1 | Rule 2 | Rule 3 |
|---|---|---|---|
| Username exists | Yes | Yes | No |
| Password valid | Yes | No | N/A |
| Action | Login | Error | Error |
Context & Linkage:
- This note is based on the foundational concepts of decision tables as discussed in the introduction section of your third class on “Black Box Testing - Decision Tables and Transition”. The approach aligns with standard practices in software testing where complex decision-making processes need clear documentation and rigorous testing.
- Related Notes: Can be linked to further exploration of decision table applications in different types of software, case studies showing effective use of decision tables in industry, and detailed methodologies for converting decision table rules into executable test cases.
This atomic note provides an overview of decision tables, explaining their definition, role, and structure within the context of software testing, and highlights how they can be effectively used to derive detailed and accurate test cases for complex systems.