Module 4
Module 4
Structural testing, also known as glass box testing or white box testing is an approach
where the tests are derived from the knowledge of the software's structure or internal
implementation.
The other names of structural testing includes clear box testing, open box testing, logic
driven testing or path driven testing.
Structural Testing Techniques:
Statement Coverage - This technique is aimed at exercising all programming
statements with minimal tests.
Branch Coverage - This technique is running a series of tests to ensure that all
branches are tested at least once.
Path Coverage - This technique corresponds to testing all possible paths which
means that each statement and branch are covered.
Contd..
Advantages of Structural Testing:
• Forces test developer to reason carefully about implementation
• Reveals errors in "hidden" code
• Spots the Dead Code or other issues with respect to best programming practices.
Disadvantages of Structural Box Testing:
• Expensive as one has to spend both time and money to perform white box
testing.
• Every possibility that few lines of code is missed accidentally.
• In-depth knowledge about the programming language is necessary to perform
white box testing.
What is Functional Testing?
• Functional testing is a quality assurance (QA) process[1] and a type of black-box testing
that bases its test cases on the specifications of the software component under test.
• Functions are tested by feeding them input and examining the output, and internal
program structure is rarely considered (unlike white-box testing).
• Functional Testing is a testing technique that is used to test the features/functionality of
the system or Software, should cover all the scenarios including failure paths and
boundary cases.
• It is basically defined as a type of testing which verifies that each function of the
software application works in conformance with the requirement and specification.
• This testing is not concerned about the source code of the application.
• Each functionality of the software application is tested by providing appropriate test
input, expecting the output and comparing the actual output with the expected output.
• This testing focuses on checking of user interface, APIs, database, security, client or
server application and functionality of the Application Under Test.
The other major Functional Testing techniques
include:
• Unit Testing
• Integration Testing
• Smoke Testing
• User Acceptance Testing
• Localization Testing
• Interface Testing
• Usability Testing
• System Testing
• Regression Testing
• Globalization Testing
Test-generation Strategies
• Test-generation any form of test generation uses a source document.
• In the most informal of test methods, the source document resides in the mind
of the tester who generates tests based on a knowledge of the requirements.
• In several commercial environments, the process is a bit more formal.
• The tests are generated using a mix of formal and informal methods either
directly from the requirements document serving as the source.
• In more advanced test processes, requirements serve as a source for the
development of formal models
Contd..
Model based: require that a subset of the requirements be modeled using a formal
notation (usually graphical).
Models: Finite State Machines, Timed automata, Petri net, etc. Specification based:
require that a subset of the requirements be modeled using a formal mathematical
notation.
Code based: generate tests directly from the code
Comparing specification-based test case identification methods
Comparing code-based test case identification methods
Error and fault taxonomies
Error and Fault Taxonomies Process versus Product process refers to
how we do something, and product is the end result of a process SQA is
more concerned with reducing errors endemic in the development
process, while testing is more concerned with discovering faults in a
product. Faults can be classified in several ways:
• the development phase where the corresponding error occurred,
• the consequences of corresponding failures,
• difficulty to resolve,
• risk of no resolution, and so on
contd….
Contd..
Contd..
Contd..
Contd..
Levels of Testing
• Perhaps one of the reasons for the longevity of this example is that it
contains clear but complex logic.
• It also typifies some of the incomplete definitions that impair
communication among customers, developers, and testers.
• The first specification presumes the developers know some details
about triangles, particularly the triangle inequality: the sum of any
pair of sides must be strictly greater than the third side.
Traditional Implementation
3 3 3 Equilateral
3 3 2 Isosceles
3 4 5 Scalene
1 2 3 Not a Triangle
0 2 2 Not a Triangle
-1 2 3 Invalid input
Condition Rule 1 Rule 2 Rule 3 Rule 4 Rule 5 Rule 6
All sides > 0 Y Y Y Y Y N
Triangle
inequality is Y Y Y N Y —
satisfied
a=b=c Y N N — N —
Exactly two
sides equal
— Y N — N —
(a=b, b=c, or
a=c)
All sides
— — Y — Y —
different
Action
Not a
(Triangle Equilateral Isosceles Scalene Scalene Invalid Input
Triangle
Type)
Contd..
Contd..
Contd..
EndIf
‗
End Triangle1
Structured Implementations
• The pseudocode for [Improved Version]
Contd..
The Next Date Function
• the complexity in the triangle program is due to the relationships
between inputs and correct outputs.
• We will use the Next Date function to illustrate a different kind of
complexity—logical relationships among the input variables.
Contd..
• As we did with the triangle program, we can make our problem statement
more specific.
• This entails defining responses for invalid values of the input values for the
day, month, and year.
• We can also define responses for invalid combinations of inputs, such as
June 31 of any year.
• If any of conditions c1, c2, or c3 fails, NextDate produces an output
indicating the corresponding variable has an out-of-range value—for
example, ―Value of month not in the range 1...12.ǁ Because numerous
invalid day–month–year combinations exist, NextDate collapses these into
one message: ―Invalid Input Date.ǁ
• Two sources of complexity exist in the Next Date function: the complexity
of the input domain discussed previously, and the rule that determines
when a year is a leap year.
• A year is 365.2422 days long; therefore, leap years are used for the ―extra
dayǁ problem.
• If we declared a leap year every fourth year, a slight error would occur.
• The Gregorian calendar (after Pope Gregory) resolves this by adjusting leap
years on century years.
• Thus, a year is a leap year if it is divisible by 4, unless it is a century year.
Century years are leap years only if they are multiples of 400 (Inglis, 1961);
thus, 1992, 1996, and 2000 are leap years, while the year 1900 is not a leap
year.
• The Next Date function also illustrates a sidelight of software testing.
Scenario Input Date Expected Output