Subscribe by Email


Showing posts with label Control Structure Testing. Show all posts
Showing posts with label Control Structure Testing. Show all posts

Monday, April 11, 2011

Software Test Case Design Methods - White Box Testing Methods

Software is tested in two ways:
- First approach is test the internal workings of software. It is also called white box testing.
- Second approach is to test the software as a whole, i.e., know how the software works and tests if it conforms to the specified functionality in the requirements. It is also called black box testing.

White Box Testing Techniques


It is a test case design technique that uses the internal control structure of the software component. It is also called glass box testing. It ensures that no logical errors, incorrect assumptions and typographical errors have been missed. The test cases that are included are testing all logical conditions, loops, independent paths, internal data structures. Techniques involved are:

- Basis Path Testing
It enables the test case designer to derive a logical complexity measure based on the procedural specification of a software component.
STEP 1: Use a procedural specification as input in deriving the basic set of execution path.
STEP 2: Draw the flow graph of the procedural specification.
STEP 3: Compute for the complexity of the code.
STEP 4: Determine the basic set of execution paths.
STEP 5: Document the test cases based on the identified execution path.

- Control Structure Testing
A white box testing technique that tests three types of program control - condition testing, loop testing and data flow testing.
Condition testing test the logical conditions contained in a procedural specification.
Looping testing is a method that focuses exclusively on the validity of iterative constructs or repetition.
Data Flow Testing method selects test paths of a program according to the locations of the definitions and uses of variables in the program.


Sunday, February 6, 2011

Control Structure Testing - Condition Testing, Data Flow Testing, Loop Testing

Control structure testing is a group of white-box testing methods.
CONDITION TESTING
- It is a test case design method.
- It works on logical conditions in program module.
- It involves testing of both relational expressions and arithmetic expressions.
- If a condition is incorrect, then at least one component of the condition is incorrect.
- Types of errors in condition testing are boolean operator errors, boolean variable errors, boolean parenthesis errors, relational operator errors, and arithmetic expression errors.
- Simple condition: Boolean variable or relational expression, possibly proceeded by a NOT operator.
- Compound condition: It is composed of two or more simple conditions, Boolean operators and parentheses.
- Boolean expression: It is a condition without Relational expressions.

DATA FLOW TESTING
- Data flow testing method is effective for error protection because it is based on the relationship between statements in the program according to the definition and uses of variables.
- Test paths are selected according to the location of definitions and uses of variables in the program.
- It is unrealistic to assume that data flow testing will be used extensively when testing a large system, However, it can be used in a targeted fashion for areas of software that are suspect.

LOOP TESTING
- Loop testing method concentrates on validity of the loop structures.
- Loops are fundamental to many algorithms and need thorough testing.
- Loops can be defined as simple, concatenated, nested, and unstructured.
- In simple loops, test cases that can be applied are skip loop entirely, only one or two passes through loop, m passes through loop where m is than n, (n-1), n, and (n+1) passes through the loop where n is the maximum number of allowed passes.
- In nested loops, start with inner loop, set all other loops to minimum values, conduct simple loop testing on inner loop, work outwards and continue until all loops tested.
- In concatenated loops, if loops are independent, use simple loop testing. If dependent, treat as nested loops.
- In unstructured loops, redesign the class of loops.


Saturday, July 17, 2010

What can be white box testing used for, tools used for white box testing.

White box testing (WBT) is also called Structural or Glass box testing. It deals with the internal logic and structure of the code. A software engineer can design test cases that exercise independent paths within a module or unit, exercise logical decisions on both their true and false side, execute loops at their boundaries and within their operational bounds and exercise internal data structures to ensure their validity. White Box testing can be used for :
- looking into the internal structures of a program.
- test the detailed design specifications prior to writing actual code using the static analysis techniques.
- organizing unit and integration test processes.
- testing the program source code using static analysis and dynamic analysis techniques.

Tools used for White Box testing:
- Provide run-time error and memory leak detection.
- Record the exact amount of time the application spends in any given block of code for the purpose of finding inefficient code bottlenecks.
- Pinpoint areas of the application that have and have not been executed.

The first step in white box testing is to comprehend and analyze available design documentation, source code, and other relevant development artifacts, so knowing what makes software secure is a fundamental requirement. Second, to create tests that exploit software, a tester must think like an attacker. Third, to perform testing effectively.


Monday, November 23, 2009

Control Structure Testing : Loop testing

Loops are the basis of most algorithms implemented using software. However, often we do consider them when conducting testing. Loop testing is a white box testing approach that concentrates on the validity of loop constructs. Four loops can be defined: simple loops, concatenate loops, nested loops, and unstructured loops.

- Simple Loops, where n is the maximum number of allowable passes through the loop.
o Skip loop entirely.
o Only one pass through loop.
o Two passes through loop.
o m passes through loop where m o n-1, n, and n+1 passes through the loop.
- Nested Loops
o Start with inner loop. Set all other loops to minimum values.
o Conduct simple loop testing on inner loop.
o Work outwards.
o Continue until all loops tested.
- Concatenated Loops
o If independent loops, use simple loop testing.
o If dependent, treat as nested loops.
- Unstructured loops
o Don't test - redesign.

Types of Loop


Control Structure Testing : Data Flow Testing

Data Flow Testing is a technique which is used effectively alongside Control Flow Testing. It is another type of white-box testing which looks at how data moves within a program. Data flow occurs when variables are declared and then accessed and changed as the program progresses.
A "definition-clear path" is a path which involves no changes of the variable being tested. For a statement with S as its statement number,

DEF(S) = {X| statement S contains a definition of X}
USE(S) = {X| statement S contains a use of X}

If statement S is an if or loop statement, its DEF set is left empty and its USE set is founded on the condition of statement S. The definition of a variable X at statement S is live at statement S’ if there exists a path from statement S to S’ which does not contain any condition of X.

A definition-use chain (or DU chain) of variable X is of the type [X,S,S’] where S and S’ are statement numbers, X is in DEF(S), USE(S’), and the definition of X in statement S is live at statement S’.

One basic data flow testing strategy is that each DU chain be covered at least once. Data flow testing strategies are helpful for choosing test paths of a program including nested if and loop statements.


Control Structure Testing : Condition testing

Condition testing is a test case design approach that exercises the logical conditions contained in a program module. Errors in conditions can be due to:
* Boolean operator error
* Boolean variable error
* Boolean parenthesis error
* Relational operator error
* Arithmetic expression error
The condition testing method concentrates on testing each condition in a program. The purpose of condition testing is to determine not only errors in the conditions of a program but also other errors in the program. A number of condition testing approaches have been identified.
Domain testing needs three and four tests to be produced for a relational expression. For a relational expression of the form
E1 < relational-operator > E2
Three tests are required the make the value of E1 greater than, equal to and less than E2,respectively.


Control Structure Testing : Branch Testing

Although basis path testing is simple and highly effective, it is not enough in itself. Next we consider variations on control structure testing that broaden testing coverage and improve the quality of white box testing. Control structure testing is a group of white-box testing methods.
* 1.0 Branch Testing
* 1.1 Condition Testing
* 1.2 Data Flow Testing
* 1.3 Loop Testing

Branch Testing : Branch Testing is a structural or white box technique, because it is conducted with reference to the code. A decision is an executable statement that may transfer control to another statement. It is also called Decision Testing. For every decision, each branch needs to be executed at least once. It ignores implicit paths that result from compound conditionals. It treats a compound conditional as a single statement.
- This example has two branches to be executed:
IF ( a equals b) THEN
statement 1
ELSE
statement 2
END IF
- This examples also has just two branches to be executed, despite the compound conditional:
IF ( a equals b AND c less than d ) THEN
statement 1
ELSE
statement 2
END IF
- This example has three branches to be executed:
IF ( a equals b) THEN
statement 1
ELSE
IF ( c equals d) THEN
statement 2
ELSE
statement 3
END IF
END IF
- Obvious decision statements are if, for, while, switch.
- Subtle decisions are return (boolean expression), ternary expressions, try-catch.


Facebook activity