Visão geral dos critérios de cobertura lógica: Os critérios de cobertura lógica são abordagens sistemáticas usadas em testes de software para garantir que vários componentes lógicos do software sejam exercitados durante o teste.
Esses critérios se concentram em diferentes aspectos da lógica do software para descobrir falhas relacionadas à tomada de decisões lógicas e ao tratamento de condições.
Tipos de critérios de cobertura lógica:
-
Cobertura de predicados (PC):
- Definição: Garante que cada predicado no software seja avaliado como verdadeiro e falso.
- Importância: Ajuda a verificar se cada ponto de decisão pode levar a ambos os resultados, confirmando que todas as ramificações em declarações condicionais são alcançáveis e funcionais.
-
Cobertura de cláusula (CC):
- Definição: Requer que cada condição básica em um predicado seja avaliada como verdadeira e falsa.
- Importância: Tem como objetivo testar o efeito de cada condição individual em um predicado, garantindo que cada condição possa influenciar independentemente o resultado do predicado.
-
Cobertura combinatória (CoC):
- Definição: Testa todas as combinações possíveis de condições básicas em um predicado.
- Importância: Essa abordagem exaustiva é prática para predicados com um pequeno número de cláusulas e garante uma avaliação completa de todas as possíveis combinações de condições.
-
**Cobertura de cláusula ativa (ACC):
- ACC geral (GACC): Para cada predicado e cada cláusula, testa a influência da cláusula no resultado do predicado sem exigir que as cláusulas menores permaneçam consistentes entre os testes.
- ACC restrito (RACC): Semelhante ao GACC, mas exige que as cláusulas secundárias não mudem entre os testes, adicionando uma camada de restrição que geralmente leva a casos de teste inviáveis.
- ACC correlacionado (CACC): Amplia o GACC garantindo que as alterações no valor da cláusula alterem o resultado do predicado, correlacionando, assim, os resultados do teste diretamente com o impacto lógico da cláusula.
-
Cobertura de cláusula inativa (ICC):
- General ICC (GICC): Garante que o resultado do predicado não dependa da cláusula que está sendo testada, com o valor da cláusula mudando independentemente das outras cláusulas.
- ICC restrito (RICC): Requer valores consistentes de cláusulas menores em diferentes avaliações da cláusula que está sendo testada, garantindo que a cláusula esteja efetivamente “inativa” para influenciar o resultado do predicado.
Exemplo de aplicação dos critérios de cobertura: Considere um predicado baseado em duas cláusulas e :
| Test Case | ( A ) | ( B ) | ( P ) | Coverage Type |
|---|---|---|---|---|
| 1 | T | T | T | PC, CC, CoC, ACC |
| 2 | F | T | F | PC, CC, ACC, ICC |
| 3 | T | F | F | PC, CC, ACC, ICC |
| 4 | F | F | F | PC, CC, CoC |
Importância no teste de software: Esses critérios de cobertura desempenham um papel fundamental para garantir o teste abrangente da lógica do software. Eles ajudam a identificar partes não testadas de um programa de software, especialmente os erros lógicos que geralmente são sutis e difíceis de detectar com outros métodos de teste.
Atomic Note: Logic Coverage Criteria
Overview of Logic Coverage Criteria: Logic coverage criteria are systematic approaches used in software testing to ensure that various logical components of the software are exercised during testing. These criteria focus on different aspects of the software’s logic to uncover faults related to logical decision-making and condition handling.
Types of Logic Coverage Criteria:
-
Predicate Coverage (PC):
- Definition: Ensures that each predicate in the software is evaluated both to true and to false.
- Importance: Helps verify that every decision point can lead to both outcomes, confirming that all branches in conditional statements are reachable and functional.
-
Clause Coverage (CC):
- Definition: Requires each basic condition within a predicate to be evaluated as true and false.
- Importance: Aims to test the effect of each individual condition within a predicate, ensuring that each condition can independently influence the outcome of the predicate.
-
Combinatorial Coverage (CoC):
- Definition: Tests every possible combination of basic conditions within a predicate.
- Importance: This exhaustive approach is practical for predicates with a small number of clauses and ensures a thorough evaluation of all potential combinations of conditions.
-
Active Clause Coverage (ACC):
- General ACC (GACC): For each predicate and each clause, tests the influence of the clause on the predicate’s outcome without requiring the minor clauses to remain consistent across tests.
- Restricted ACC (RACC): Similar to GACC, but requires that minor clauses must not change between tests, adding a layer of restriction that often leads to infeasible test cases.
- Correlated ACC (CACC): Extends GACC by ensuring that changes in the clause’s value change the predicate’s outcome, thus effectively correlating the test results directly with the clause’s logical impact.
-
Inactive Clause Coverage (ICC):
- General ICC (GICC): Ensures that the predicate’s outcome does not depend on the clause being tested, with the clause’s value changing independently of the other clauses.
- Restricted ICC (RICC): Requires consistent minor clause values across different evaluations of the clause being tested, ensuring the clause is effectively ‘inactive’ in influencing the predicate’s outcome.
Example of Coverage Criteria Application: Consider a predicate based on two clauses and :
| Test Case | ( A ) | ( B ) | ( P ) | Coverage Type |
|---|---|---|---|---|
| 1 | T | T | T | PC, CC, CoC, ACC |
| 2 | F | T | F | PC, CC, ACC, ICC |
| 3 | T | F | F | PC, CC, ACC, ICC |
| 4 | F | F | F | PC, CC, CoC |
Significance in Software Testing: These coverage criteria play a crucial role in ensuring comprehensive testing of software logic. They help in identifying untested parts of a software program, particularly the logical errors that are often subtle and difficult to detect with other testing methods.
This atomic note provides a detailed discussion of logic coverage criteria, highlighting how each criterion helps uncover different potential issues in software logic, thereby enhancing the reliability and robustness of software systems.