Certified Tester Foundation Level Chapter 5

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is Decision Testing?

A white box test design technique in which test cases are designed to execute decision outcomes.

Define Decision Coverage.

The percentage of decision outcomes that have been executed by a test suite.

What does Decision Coverage imply?

  • 100% Branch Coverage
  • 100% Statement Coverage
  • Both a and b (correct)
  • None of the above

Decision coverage is a stronger criteria than statement coverage.

<p>True (A)</p> Signup and view all the answers

What is the purpose of statement coverage in testing?

<p>Ensures that all statements in the test object are executed at least once</p> Signup and view all the answers

How is statement coverage calculated?

<p>Statement coverage = Statements executed / Total statements * 100%</p> Signup and view all the answers

How is a test case defined in statement coverage?

<p>A test case is defined from a path of the control flow graph where the edges must be executed in sequence.</p> Signup and view all the answers

What is the key criteria for a test to be viewed as completed in statement coverage?

<p>Once the previously determined level of coverage is reached.</p> Signup and view all the answers

What is the weakness associated with statement coverage?

<p>It may not cover every possible scenario such as empty edges.</p> Signup and view all the answers

What is the purpose of the while loop in the provided code snippet?

<p>To continue executing the loop as long as the condition (r != 0) is true.</p> Signup and view all the answers

Which variable gets assigned the remainder of 'm' divided by 'n'?

<p>r (A)</p> Signup and view all the answers

Java uses && and || for bit-wise operations.

<p>False (B)</p> Signup and view all the answers

Decision coverage considers exclusively the resulting truth value of a logical decision (true/false) to determine the ______ in the control flow graph.

<p>branch</p> Signup and view all the answers

What is the primary focus of white-box test design techniques?

<p>Internal structure of a component or system (D)</p> Signup and view all the answers

Black-box tests are derived with knowledge of the program logic.

<p>False (B)</p> Signup and view all the answers

Define 'White-Box Test Design Technique.'

<p>Procedure to derive and select test cases based on an analysis of the internal structure of a component or system.</p> Signup and view all the answers

What is the primary purpose of white-box testing? Testing based on an analysis of the __________ of the component or system.

<p>internal structure</p> Signup and view all the answers

Match the following criteria with their respective white-box testing techniques:

<p>Statement coverage = Code coverage Decision coverage = Control-flow-based testing Data-flow-based testing = Path coverage</p> Signup and view all the answers

What is the formula for calculating path coverage?

<p>Path coverage = (Number of paths executed / Total paths) * 100%</p> Signup and view all the answers

Path coverage is more important as a theoretical measure than in practice. (True/False)

<p>True (A)</p> Signup and view all the answers

What can be considered when deriving test cases from paths in software testing?

<p>All of the above (D)</p> Signup and view all the answers

Path: (1, 2-3, 4-6, 7, 8, 9-11, 8, 12, 13). For statement coverage, the logical (abstract) test case is: { ___ > ___ ∧ ___ % ___ ≠ 0 ∧ ___ % (___ % ) = 0 ; gcd(, ___) }

Signup and view all the answers

What does the MC/DC coverage requested in DO-178B demand?

<p>at least one case is defined for each atomic assertion which has an influence on the total decision outcome</p> Signup and view all the answers

What is the focus of the 'Linear Code Sequence and Jump' (LCSAJ) test design techniques?

<p>Testing combinations of code sequences with jumps (D)</p> Signup and view all the answers

True or False: The 'Modified Condition/Decision Coverage' (MC/DC) requested in DO-178B is identical to the minimal multiple condition coverage.

<p>False (B)</p> Signup and view all the answers

In source code, ___ means that conditions are only tested until the truth value has been determined.

<p>lazy evaluation</p> Signup and view all the answers

Match the following coverage criteria with their descriptions:

<p>Decision coverage = Ensures each decision in a program is executed by at least one test case Path coverage = Tests all possible paths through a program Statement coverage = Ensures each statement in a program is executed by at least one test case</p> Signup and view all the answers

What is the fundamental idea of experience-based test design techniques?

<p>Experience and knowledge of the tester is used in the definition of test cases</p> Signup and view all the answers

Which of the following are examples of experience-based test design techniques? (Select all that apply)

<p>Error guessing (B), Exploratory testing (C)</p> Signup and view all the answers

What is error guessing in the context of software testing?

<p>A test design technique where the experience and knowledge of the tester is used to anticipate defects and design tests to expose them</p> Signup and view all the answers

What is the purpose of the mutation test system as described in the text?

<p>To deliberately build in defects in a program and test if the test cases can detect these defects.</p> Signup and view all the answers

Which of the following is not a mutation operation defined by the mutation test system in the text?

<p>Replacing division with multiplication operators (D)</p> Signup and view all the answers

Statement: All mutants are considered good if they have passed all test cases successfully.

<p>False (B)</p> Signup and view all the answers

In white-box test design techniques, the test object must be _____________ at strategically important points before the test is executed.

<p>instrumented</p> Signup and view all the answers

What does simple condition coverage require in terms of testing single conditions in decision statements?

<p>Testing each single condition as True and False (D)</p> Signup and view all the answers

What is the formula for condition coverage?

<p>(Number of true/false single conditions tested / Total single conditions) * 100%</p> Signup and view all the answers

What does multiple condition coverage consider in addition to simple condition coverage?

<p>Combinations of single condition outcomes within one statement (C)</p> Signup and view all the answers

What is the purpose of Multiple Condition Coverage?

<p>To evaluate all conditions with both true and false values, fulfilling statement and decision coverages.</p> Signup and view all the answers

Condition Determination Coverage tests the percentage of all single condition outcomes that independently affect a decision outcome that have been exercised by a test case suite. It implies 100% decision coverage if it achieves ____% Condition Determination Coverage.

<p>100</p> Signup and view all the answers

What is the formula for calculating Path Coverage?

<p>Path Coverage = (Number of paths executed / Total paths) * 100%</p> Signup and view all the answers

Why are statement coverage and decision coverage insufficient for object-oriented systems?

<p>Complexity in object-oriented systems lies in class correlations and object interactions. (B)</p> Signup and view all the answers

In White-Box Testing, what is used to evaluate the completeness of the test according to the data use?

<p>data flow</p> Signup and view all the answers

Flashcards are hidden until you start studying

Study Notes

Dynamic Testing - White-Box

  • White-box testing is a type of software testing that involves analyzing the internal structure of a component or system to detect faults.
  • It is also known as structure-based, structure-oriented, or structural testing.

Structure-Based Testing

  • Control flow-based testing:
    • Statement coverage (C0-coverage): all nodes of the control flow graph are executed.
    • Decision coverage (C1-coverage): all edges of the control flow graph are executed.
    • Boundary-interior coverage (Cgi): all loops are executed once, repeatedly, and rejected once.
    • Path coverage (C∞-coverage): all possible paths of the control flow graph are executed.
  • Data flow-based testing:
    • All definitions (all defs): all definitions of variables are executed.
    • All definition-use pairs (all def-uses): all pairs of definitions and uses of variables are executed.
  • Condition-based testing:
    • Simple condition coverage: all conditions are executed.
    • Multiple condition coverage: all combinations of conditions are executed.
    • Minimal multiple condition coverage: all minimal combinations of conditions are executed.

Experience-Based Testing

  • Error guessing: testing based on the tester's experience and intuition about where errors might occur.
  • Exploratory testing: testing that involves exploring the system's behavior without a preconceived notion of what might happen.

Choosing Test Design Techniques

  • The choice of test design technique depends on the specific context and requirements of the system.
  • Different techniques may be used for different parts of the system or for different testing phases.

White-Box Test Design Techniques

  • Statement coverage: ensures that all statements in the code are executed.
  • Decision coverage: ensures that all decisions in the code are executed.
  • Condition coverage: ensures that all conditions in the code are executed.
  • Path coverage: ensures that all possible paths of the code are executed.
  • Mutation testing: involves modifying the code in small ways to see if the tests detect the changes.
  • Data flow-based testing: ensures that all data flows through the code are executed.

Code Coverage

  • Code coverage measures the percentage of the code that is executed during testing.
  • It is used to evaluate the effectiveness of the testing.

Dynamic Test

  • Dynamic test is a type of testing that involves executing the code to see how it behaves.
  • It is used to evaluate the system's behavior under different conditions.

Black-Box vs. White-Box Testing

  • Black-box testing: testing that involves only the input and output of the system, without knowledge of the internal structure.
  • White-box testing: testing that involves analyzing the internal structure of the system to detect faults.

Test Design Techniques

  • Test design techniques are used to derive and select test cases based on the analysis of the internal structure of the system.
  • They are used to evaluate the completeness of the testing.

GCD Function

  • The GCD (Greatest Common Divisor) function is an example of a function that can be tested using white-box testing.
  • The function takes two integers as input and returns their greatest common divisor.

Control Flow Graph

  • A control flow graph is a graphical representation of the flow of control through a program.
  • It is used to visualize the structure of the program and to identify the different paths that the program can take.

UML/Java Specifications

  • UML (Unified Modeling Language) is a language used to specify the behavior of systems.
  • Java is a programming language used to implement the system.
  • The specification of the GCD function in UML/Java is used to define the expected behavior of the function.### Control Flow-Based Coverage Criteria
  • Statement coverage is a dynamic, control flow-based test design technique that requires all statements of the test object to be executed at least once.
    • Formula: Statement coverage = (Statements executed / Total statements) * 100%
    • Each test case is defined from a path of the control flow graph, and the edges of the graph that are on the path must be executed in the test case.

Example: Statement Coverage for gcd()

  • Path: (1, 2-3, 4-6, 7, 8, 9-11, 8, 12, 13)
  • gcd() function example is used to illustrate statement coverage.

Discussion about Statement Coverage

  • Statement coverage is a relatively weak criteria.
  • Empty edges have no meaning for statement coverage.
  • 100% coverage of statements is not always reachable in practice.
  • May indicate the presence of unreachable statements (dead code).

Decision Coverage

  • Decision coverage is a white box test design technique that requires test cases to execute decision outcomes.
    • Formula: Decision coverage = (Decision results executed / Total decisions) * 100%
    • Each test case is determined by a path through the control flow graph to the decision being considered.
  • Decision coverage is stronger than statement coverage.

Example: Decision Coverage for gcd()

  • Path 1 = (1, 2-3, 4-6, 7, 8, 12, 13)
  • Path 2 = (1, 2-3, 7, 8, 12, 13)
  • Decision coverage is calculated based on the number of decision outcomes executed.

Discussion about Decision Coverage

  • Decision coverage is a stronger criteria than statement coverage.
  • Decision coverage can detect missing statements.
  • 100% decision coverage implies 100% branch coverage and 100% statement coverage.

Addendum: Boundary-Interior Coverage

  • Boundary-Interior coverage is a dynamic, control flow-based test design technique that requires each loop to be executed in at least three test cases.
    • Not at all (only if loops deter, e.g., while- or for-loop for which abort condition is true at first evaluation)
    • Exactly once
    • More than once
    • Formula: Boundary-Interior coverage = (Number of (gi)-tested loops executed / Total loops) * 100%

Addendum: Path Coverage

  • Path coverage is a dynamic, control flow-based test design technique that requires each path in a control flow graph to be executed at least once.
    • Formula: Path coverage = (Number of paths executed / Total paths) * 100%
    • In practice, not reachable, more important as a theoretical measure.

Example: Path Coverage for gcd()

  • Multiple paths are demonstrated for the gcd() function.

From Path to Test Case

  • Previously, paths were determined through the control flow graph, which were to be executed by the test cases.
  • Question: Which input values can enforce these paths?
  • Idea: Consider the conditions of statements that determine control flow.
  • Constraints for program variables can then be »computed«.

Test Case for Statement Coverage

  • Logical (abstract) test case: { n > m ∧ n % m ≠ 0 ∧ n % (n % m) = 0 ; gcd(m, n) }

  • Low-level (concrete) test case: { m = 4, n = 6; 2 }### Test Case for Decision Coverage

  • Path: (1, 2-3, 7, 8, 12, 13)

  • Logical (abstract) test case: {n ≤ m ∧ m % n = 0 ; gcd(m, n) }

  • Low level (concrete) test case: { m = 4, n = 4; 4 }

Control Flow-Based and Object-Oriented Software

  • Statement coverage and decision coverage are insufficient for object-oriented systems
  • Complexity of object-oriented systems are often hidden in the correlations of classes or the interactions of objects
  • Methods in the classes are usually less extensive and of less complexity (McCabe: 2-4)
  • The required statement and/or decision coverage is then reachable with less effort
  • Tool support for measuring coverage metrics is available for object-oriented systems

White-Box Techniques

  • Exploratory testing, error guessing, experience-based testing, and evaluation of white-box techniques
  • Power of white-box techniques, mutation testing, and concept of white-box techniques
  • Further white-box test design techniques: mutation, LCSAJ, condition testing, data-flow-based testing
  • Differences between black-box and white-box techniques, and evaluation of white-box techniques

Data Flow-Based Test

  • Dynamic test in which the test cases are derived by considering the data used in the test object
  • Completeness of the test (coverage) will be evaluated according to the data use
  • Tests considering variable and data usage: value assignment, state change, use in expression, state preserving, and use in conditions
  • Use in expression, state preserving: Definitional use, def (r), and computational use, c-use (m,n) and def (r)

Addendum: Data Flow-Based Coverage Criteria

  • Hypothesis: defective data use!
  • All-defs criteria: Use each definition at least once in one c-use or p-use without creating any new def in between
  • Example: All-defs: 1, def m: p-use 3-4, 1, def n: p-use 3-4, ...
  • Further criteria: All p-uses / All c-uses / All uses /...

Conditions in Programs (and Specifications)

  • Truth values: false, true (often also 0, 1)
  • Single (basic) condition: Type of variables boolean, operations with return value of type boolean, comparative operations
  • Compounded condition: Linking partial conditions with boolean operators, basic-operators are and (∧, ∩), or (∨, ∪), not (¬ )
  • Decisions often use compound conditions to control the program flow
  • In Java: &, |, ^ Bit-wise and, or and exclusive-or-link, &&, || As above, but lazy evaluation

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

More Like This

White Box Testing Overview
7 questions

White Box Testing Overview

ArtisticDramaticIrony avatar
ArtisticDramaticIrony
Software Testing Techniques
42 questions
Use Quizgecko on...
Browser
Browser