Showing posts with label Whitebox and Blackbox. Show all posts
Showing posts with label Whitebox and Blackbox. Show all posts

Thursday, November 22, 2012

Basis Path Testing


1.3 Basis Path Testing

A testing mechanism proposed by McCabe.
Aim is to derive a logical complexity measure of a procedural design and use this as a guide for defining a basic set of execution paths.
Test cases which exercise basic set will execute every statement at least once.

1.3.1 Flow Graph Notation

Notation for representing control flow


On a flow graph:
  • Arrows called edges represent flow of control
  • Circles called nodes represent one or more actions.
  • Areas bounded by edges and nodes called regions.
  • predicate node is a node containing a condition
Any procedural design can be translated into a flow graph.
Note that compound boolean expressions at tests generate at least two predicate node and additional arcs.
Example:

1.3.2 Cyclomatic Complexity

The cyclomatic complexity gives a quantitative measure of the logical complexity.
This value gives the number of independent paths in the basis set, and an upper bound for the number of tests to ensure that each statement and both sides of every condition is executed at least once.
An independent path is any path through a program that introduces at least one new set of processing statements (i.e., a new node) or a new condition (i.e., a new edge)

Example has:
  • Independent Paths:
    1. 1, 9
    2. 1, 2, 3, 8, 1, 9
    3. 1, 2, 4, 5, 7, 8, 1, 9
    4. 1, 2, 4, 6, 7, 8, 1, 9
  • Cyclomatic Complexity of 4; computed using any of these 3 formulas:
    1. #Edges - #Nodes + #terminal vertices (usually 2)
    2. #Predicate Nodes + 1
    3. Number of regions of flow graph.
Cyclomatic complexity provides upper bound for number of tests required to guarantee coverage of all program statements.
Could we omit path #1 since it's covered in #2?

1.3.3 Deriving Test Cases

  1. Using the design or code, draw the corresponding flow graph.
  2. Determine the cyclomatic complexity of the flow graph.
  3. Determine a basis set of independent paths.
  4. Prepare test cases that will force execution of each path in the basis set.
Note: some paths may only be able to be executed as part of another test.

I have example such as:




Friday, October 26, 2012

Testing Principles


Principle 1: Testing shows presence of defects

Principle 2: Exhaustive testing is impossible

Principle 3: Early testing

Principle 4: Defect clustering

Principle 5: Pesticide paradox

Principle 6: Testing is context dependent

Principle 7: Absence-of-errors fallacy


Whitebox and Blackbox(Overview blackbox and whitebox)



Chúng ta đi vào các kỹ thuật test rồiJ

Blackbox testing chúng ta nên tìm hiểu theo những từ khóa sau:
a. Equivalence Partitioning
b. Boundary Value Analysis
c. State Transition
d. Table Decision
e. Pair-wise
f. Estimation

Whitebox test chúng ta sẽ tìm hiểu theo từ khóa:
a.       Control Flow
b.      Data Flow

Ngoài ra chúng ta nên tìm hiểu thêm Static test, dynamic test, Function test, Non-Function test.

Bên cạnh đó việc tìm hiểu thêm testing principles và software development models cũng rất là quan trọng.


Blackbox is included technical such as:

 a. Equivalence Partitioning
b. Boundary Value Analysis
c. State Transition
d. Table Decision
e. Pair-wise
f. Estimation

Whitebox is included technical such as:
a. Control flow
b. Data flow

Beside we need to search Static test, dynamic test, Function test and Non-Function test