ST - Unit - II PDF
ST - Unit - II PDF
1
Each Level Consist of ( Except Level 1 ) diagram
• A set of Maturity goal
• Supporting Maturity sub goal
• Activities task and responsibilities
The Smarter Tester
Responsibility :
Reveal Defects
To evaluate software performance usability, and reliability.
Testing is usually performed under budget and time constraints, Testers often
are subject to enormous pressure from the management and marketing .
The smart tester must
plan for testing, insure that the resource and
select the test cases, time allocated for the job are
monitor the process utilized effectively
Approach-1 :
Test a module or component using all possible i/p , this will enable to
detect all defects
Approach-2:
Select i/p at random
Goal of the smart tester is to understand the functionality, input/output
domain, and the environment of use for the code being tested.
Tester must also understand in detail how the code is constructed.
Smart tester need to use knowledge of the types of defects that are commonly
injected during development or maintenance of this type of software.
Tester should maximize the use of resources; it takes more time & effort.
TEST CASE DESIGN STRATEGIES
Develop effective test cases for execution based testing.
positive consequences of effective test cases
•A greater probability of detecting defects
•A more efficient use of organizational resources
•A higher probability for test reuse
•Closer adherence to testing and project schedules and budgets
•The possibility for delivery of higher quality software products
The two basic testing strategies
Test Strategy & Tester’s View Knowledge Sources Methods
3
Guidelines
Input Conditions no of equivalent EXAMPLE
classes
range of one valid & Eg: range of 1-499
values two invalid Valid -> all values from 1-99
classes Invalid -> values < 1
Invalid values > 499
specific one valid & Eg:- If the specification for a
value two invalid college code ,
classes Valid -> valid college code {210}
Invalid -> valid college code <210
Invalid valid college code>210
Members one valid & eg:- paint module states that the
of a set one invalid Color RED, BLUE, GREEN and
classes YELLOW are allowed as inputs
Valid -> RED
Invalid -> BLACK
must be one valid & Eg:- if a specification for a module
condition one invalid states that the first character of a
(Boolean) classes part identifier must be a letter
Valid -> TOTAL
Invalid -> 3PI
If the input specification in an equivalence class is not handled in an
identical way by the software under test, then the class should be further
partitioned into smaller equivalence classes
Example: A specification of a square root function.
Function square_root
message (x:real)
when x >_0.0
reply (y:real)
where y >_0.0 & approximately (y*y,x)
otherwise reply exception imaginary_square_root
end function
4
IV) Summary of Test I/ps using EC Partitioning
Test case Id i/p Valid EC Invalid EC
TC1 -3 - EC4
TC2 4.0 EC1,EC3 -
TC3 AB - EC2
TC4 -6.2 - EC4
3)Boundary Value Analysis :
The test cases developed based on equivalence class partitioning can be
strengthened by use of an another technique called boundary value analysis.
boundary value analysis requires that the tester select elements close to the
edges, so that both the upper and lower edges of an equivalence class are
covered by test cases.
Guidelines
Input Valid & Invalid Test Case EXAMPLE
Conditions
range of values valid test cases- ends of Eg: range between _1.0 and _1.0
the range, input values of -1.0, -1.1, and 1.0,
invalid test cases - above 1.1.
and below the ends of the
range.
number valid test cases –min & Ex: house can have one to four
of values Max Numbers owners
Invalid Test Case – Min-1 , 0,1 owners and 4,5 owners
max+1 numbers
ordered set, focus on the first and i/p: {25,27,28}
last elements of the set. last element 27,28,29
first element 24,25,26
Example:
The input specification for the module states that a widget identifier should consist of 3–
15 alphanumeric characters of which the first two must be letters.
I) conditions that apply to the input:
(i) it must consist of alphanumeric characters,
(ii) the range for the total number of characters is between 3 and 15, and,
(iii) the first two characters must be letters.
Condition2:
EC3. The widget identifier has between 3 and 15 characters, valid.
EC4. The widget identifier has less than 3 characters, invalid.
EC5. The widget identifier has greater than 15 characters, invalid.
Condition3:
EC6. The first 2 characters are letters, valid.
EC7. The first 2 characters are not letters, invalid.
7
RTM helps in identifying the relationship between the requirements and test
cases. Combinations are
one (requirements ) to one (Test Case)
one to many
many to one
many to many
one to none.
RTM in Requirement Based Testing:
it is a tool to track the testing status of each requirement, without missing any
requirements
prioritization enables selecting the right features to test
list of test cases that address the particular requirement can be viewed
Test metrics
1. Requirements addressed priority wise
2. Number of test case requirement wise
3. Total no of test cases
Test results
1. Total no of test cases passed
2. Total no of test cases failed
3. Total no of defects in requirements
4. No of requirements completed
5. No of requirements pending
9
6) Cause effect Graphing
• Equivalence class partitioning weakness -- does not allow testers to combine
conditions .
• dynamic test case writing technique.
• Cause and effect graphing is technique that can be used to combine conditions
and derive an effective set of test cases that may inconsistencies in a
specifications
• It restates the requirements specification in terms of logical relationship
between the input and output conditions. Since it is logical, it is obvious to use
Boolean operators like AND, OR and NOT.
Steps:
1. The tester must decompose the specification of a complex software component
into lower level units
2. Identify causes and effects
Cause - distinct i/p condition or an equivalence class of i/p conditions.
Effect - an output condition or a system transformation
3. From the cause and effect information, a Boolean cause and Effect graph is
created.
Graph : Node causes(Left Side) and effects (Right side). logical operators
such as AND, OR and NOT and are associated with the arcs.
10
Input length of the string
character to search for.
Output Char position
NOT FOUND
out of range
Step2 : Identify causes and effects
Rules or relationship :-
If C1 and C2, then E2.
If C1 and Not C2, then E3
If not C1, then E1.
C2
E3
Step 5: Convert the graph into a decision table(1- true , 0-false , - don’t care)
T1 T2 T3
C1 1 1 0
C2 1 0 -
E1 0 0 1
E2 1 0 0
E3 0 1 0
11
To prove that the product work as per specification
is to prove that the product works as per specification and expectations. A
product delivering an error when it is expected to give an error, is also a
part of positive testing.
+ve testing is done to verify the known test conditions.
Ex; Lock & Key
Negative Testing
Negative testing is done to show that the product does not fail when an
unexpected input is given. The purpose of negative testing is to try to break the
system. Negative testing covers scenarios for which the product is
not designed and coded. In other words, the input values may not have been
represented in the specification of the product.
-ve testing is done to break the product with unknowns
8)Compatibility testing
It ensures the working of the product with different infrastructure components
(Non-functional testing ).
test case results depend on infrastructure for delivering functionality
infrastructure parameter are changed , product is expected to still behave
correctly and produce desired results.
infrastructure parameter H/W , S/W , other components
12
Example
Test the application in same browsers but in different versions. For e.g. to
test the compatibility of site ebay.com. Download different versions of Firefox
and install them one by one and test the ebay site. Ebay site should behave
equally same in each version.
Test the application in different browsers but in different versions. For e.g.
testing of site ebay.com in different available browsers like Firefox, Safari,
Chrome, Internet Explorer and Opera etc.
Parameters:
Processor (Pentium III / IV, Xenon, SPARC)
Architecture( 32 bit / 64 bit )
Resource Availability (RAM & Hard disk space)
Equipment (printer , Modem, Router).
Operating System
Middle-tier infrastructure components (Web Server, App server)
Back end components (Oracle, MS SQL )
Any s/w used to generate product binaries (compiler, linker)
Technological components (SDK, JDK)
Compatibility matrix :
Each row represents a unique combination of a specific set of values of the
parameter
Ex: Mail App
Server App Server Web Client Browser MS Office Mail
Server Server
Common Techniques
Horizontal Combination( HC ): Parameters of the row grouped together for
executing the test cases
Intelligent Sampling:
In HC each feature of the product has to be tested with each row
in the compatibility matrix involves time & effort
Various permutation and combination methods used
Selection of intelligent sampling based on
Information collected on the set of dependencies of the
product with parameter.
Less dependent removed from the list
Can include parameters that are part of product
Types:
Backward compatibility Testing is to verify the behavior of the developed
hardware/software with the older versions of the hardware/software.
Forward compatibility Testing is to verify the behavior of the developed
hardware/software with the newer versions of the hardware/software.
13
Tools for compatibility testing:
Adobe Browser Lab - Browser Compatibility Testing
Secure Platform - Hardware Compatibility tool
Virtual Desktops - Operating System Compatibility
9) User documentation testing:
User Documentation includes
Manuals user guides installation guides setup guides
online help read me files software release notes
Objective
To check if what is stated in the document is available in the product
To check if what is there in the product is explained correctly in the
document.
Product upgraded documentation upgraded
Lack of coordination documentation group & testing /development group
sitting in front of the system & verifying screen by screen , transaction by
transaction , report by report
checks language aspects (spell check & grammar)
Advantages
Aids in highlighting problems overlooked during reviews
High quality documentation minimizes defect reported by the customer
Results in less difficult support calls
New Programmer & testers can use doc. to learn the external functionality of the
product
Customer need less training & can proceed more quickly to the advanced
training
The effort & money spent on this would form a valuable investment in the long
run for the organization.
10) Domain Testing :
Testing the product purely based on domain knowledge &expertise in the
domain of application
Requires business domain knowledge, Extension of black box testing
When to apply domain testing?
14
o Ability to design and execute test cases that relate to the people who will buy
and use the software.
o Concerned about everything in the business flow
o Testing the product , not by going through the logic built into the product.
o Business flow determines the steps, not the software under test “ Business
Vertical Testing”
o To Test the software for “Domain Intelligence” , tester is expected to have
intelligence & knowledge of business flow
o Earlier phases of Black box Testing deals with Equivalent Class Partitioning
,Decision Table (Cause Effect Graphing)
o Domain testing is done all components are integrated and product has been
tested using black box approaches.
15
Static Vs Structural Testing
Static Structural
Product is tested by tester by Tests are run by computer on
going through the source code the built product
not the executable or binaries
Does not involve executing the Involves executing the program
program against predesigned test cases
Static test reveals :
Disadvantages
A developer is not the best person to detect problems in his or her own code.
He or she may be tunnel visioned and have blind spots to certain types of
problems.
Developers generally prefer to write new code rather than do any
form of testing
This method is essentially person-dependent and informal and thus may not
work consistently across all developers.
2. Code walkthrough
Group oriented - method and formal inspection are group-oriented
methods
16
Multiple perspective – walkthroughs and inspections is very thin and
varies from organization to organization. The advantage is that it brings
multiple perspectives
Multiple roles - a set of people look at the' program code and raise
questions for the author. The author explains the logic of the code, and
answers the questions. If the author is unable to answer some questions,
he or she then takes those questions and finds their answers
3. Formal /Fagan Inspection:
1) Group oriented , highly formal & structured
2) specific roles , requires thorough preparation
This method increases the number of defects detected by
1) demanding thorough preparation before an inspection/review;
2) enlisting multiple diverse views;
3) assigning specific roles to the multiple participants; and
4) going sequentially through the code in a structured manner.
Roles :
1) Author
2) Moderator - expected to formally run the inspection according to the
process.
3) Inspector/Reviewer - provides, review comments for the code.
4) Scribe - takes detailed notes during the inspection meeting and circulates
them to the inspection team after the meeting.
Process:
Author & Moderator select the review team
Introductory Meeting
o Author present his perspective
o Typical Document (code, Design, SRS, Stds) is circulated
o Moderator informs date ,time venue – inspection meeting
Defect Logging Meeting:
The moderator takes the team sequentially through the program code, asking
each inspector if there are any defects in that part of the code. If any of the
inspectors raises a defect, then the inspection team deliberates on the defect
and, when agreed that there is a defect, classifies it in two dimensions
a. Initially Quick test – the developer can perform certain obvious tests, knowing
the input variables and the corresponding expected output Variables
b. modules with Complex logic & condition – build debug version( ex:
intermediate print statement)
c. run the product under debugger or IDE (single stepping of instruction, break
points etc)
2. Code Coverage Testing
Code coverage testing involves designing and executing test cases and finding
out the percentage of code that is covered by testing.
instrumentation
% of code covered by testing is found by a technique
specialized tool to rebuild the product , link with the set of lib
Reporting on the portion of the code covered frequently, so easy to identify
critical & most often code.
Types of coverage
a)Statement Coverage b)Path Coverage
c)Condition Coverage d)Function Coverage
a)Statement Coverage
Programming constructs (4 types)
1. Sequential control flow
2. Two-way decision statements like if then else
3. Multi-way decision statements like Switch
4. Loops like while do, repeat until and for
18
2) Two-way decision statements –if then else
Have data to test the then part
Have data to test the else part
Relevance of statement coverage ?
If the program implements wrong requirements and this wrongly implemented
code is "fully tested," with 100 percent code coverage, it still is a wrong program
and hence the 100 percent code coverage does not mean anything.
b)Path Coverage
statement coverage may not indicate “true coverage”
path coverage gives better representation, split a program into a number distinct
paths.
-prev ex : having data go through the THEN part & ELSE part gives only
50% coverage , irrespective of number of statements in each path.
Path Coverage= # of path exercised/Total # of path in the program
19
Summary of Test inputs
TC ID Path ( Description) Input Expected o/p
TC1 A ( Month Wrong Path) 20/ 0/2000 Invalid Date
TC2 B-D-G ( Not Feb - days wrong) 31/4/2015 Invalid Date
TC3 B-D-H ( Not Feb - days correct) 31/1/2015 valid Date
TC4 B-C-E-G ( Feb , Leap Year - days wrong) 30/2/2016 Invalid Date
TC5 B-C-E-H ( Feb , Leap Year - days correct) 29/2/2016 valid Date
TC6 B-C-F-G ( Feb , Not Leap Year - days wrong) 29/2/2014 Invalid Date
TC7 B-C-F-H ( Feb , Not Leap Year - days Correct) 10/2/2014 valid Date
C)Condition Coverage
Further refinement of path coverage , Make sure each Boolean expression is
covered for TRUE as well as FALSE paths
Ex: Path A covered on giving mm < 1 , reporting invalid month
Program not tested for mm> 12
Compliers perform optimizations to minimize the number of Boolean operations
and all the conditions may not get evaluated, even though the right path is
chosen.
For example, when there is an OR condition (as in the first IF statement above),
once the first part of the IF (for example, mm < 1) is found to be true, the second
part will not be evaluated at all as the overall value of the Boolean is TRUE.
Similarly, when there is an AND condition in a Boolean expression, when the
first condition evaluates to FALSE, the rest of the expression need not be
evaluated at all.
Condition Coverage= # of conditions exercised/Total # of conditions in the program
20
d)Function Coverage
finds how many functions are covered by test cases
Ex: Database s/w -- inserting a row into the database
Payroll app – calculate tax
Adv: 1) Functions are easier to identify
2)Higher level of abstraction than code, easy to achieve 100%
3) more logical mapping to requirements than other type of coverage
4) importance of functions can be prioritized based on the importance of
requirements
5) provides natural transition to black box testing
Function Coverage= # of function exercised/Total # of functions in the program
21
3) Combine all sequential statements into a single node
4) When a set of sequential statements are followed by a simple predicate ,
combine all the sequential statements & predicate check into one node & have 2
edges emanating from this one node
5) Make sure that all the edges terminate at some node.
22
2) Calculate the cyclomatic complexity of the resultant flow graph
i)V(G)= E - N+2 E= 7, N= 6 V(G) = 7 - 6 + 2 =3
ii)V(G)= P+1 P=2 V(G) = 2+1 = 3
iii) V(G) = No of Regions(R) R=3 V(G) = 3
3)Determine a basis set
A path is a sequence of control flow nodes usually beginning from the entry
node of a graph through to the exit node.
(i) 1-2-3-4-8
(ii) 1-2-3-4-5-6-7-4-8
(iii) 1-2-3-4-5-7-4-8
4) Prepare summary of test cases
Test Input Expected o/p Actual o/p Result
case Id :Pass/Fail
TC1 num_of_entries = -5 0 0 Pass
23
20-40 Very complex , testability is low ,cost/effort to maintain is
high
>40 Not testable ,any amount of money /effort to maintain may
not be enough
24
3. Random TAC: ignores both program structure& specification
Ex: TAC focus on statement/branch properties
“A test data set is statement, or branch , adequate if a test set T for program P
Causes all the statements, or branches to be executed respectively”
Coverage Analysis: The TAC & the requirement that certain features of the code
are to be exercised by the test case, also named as coverage criteria
25
Ex: DU Chain (Def-Use Path) Chain in Data flow Testing
Def-Use Path a path from a variable definition to a use is called a def-use path
Axioms
set of axioms that allow testers to formalize properties which should be satisfied
by any good program-based test data adequacy criterion
Testers can use the axioms to
recognize both strong and weak adequacy criteria;
26
focus attention on the properties that an effective test data adequacy criterion
should exhibit;
select an appropriate criterion for the item under test;
stimulate thought for the development of new criteria;
Mutation Testing
• is a testing technique that focuses on measuring the adequacy of test cases.
• A test case is adequate if it is useful in detecting faults in a program.
• A test case can be shown to be adequate by finding at least one mutant program
that generates a different output than does the original program for that test
case.
• If the original program and all mutant programs generate the same output, the
test case is inadequate.
27
Basic Steps
Kinds of Mutation
A mutation is a small change in a program.
Value Mutations: these mutations involve changing the values of constants
or parameters (by adding or subtracting values etc), e.g. loop bounds { being
one out on the start or finish is a very common error.
Decision Mutations: this involves modifying conditions to reflect potential
slips and errors in the coding of conditions in programs, e.g. a typical mutation
might be replacing a > by a < in a comparison.
Statement Mutations: these might involve deleting certain lines to reflect
omissions in coding or swapping the order of lines of code. There are other
operations, e.g. changing operations in arithmetic expressions. A typical
omission might be to omit the increment on some variable in a while loop.
Example of Testing By Decision Mutation
First test data set--M=1, N=2 , the original function returns 2
• five mutants: replace”>“ operator in if statements by (>,<,<=or=)
Program Mutants
function MAX(M ,N:INTEGER) Mutants Outputs Comparison
return INTEGER is if M>=N then 2 live
begin if M<N then 1 dead
if M>N then if M<=N then 1 dead
return M; if M=N then 2 live
else if M< >N then 1 dead
return N;
end if:
end MAX;
• Executing each mutant: adding test data M=2, N=1 will eliminate the latter live
mutant, but the former live mutant remains live because it is equivalent to the
original function. No test data can eliminate it.
28
University Questions :
PART – B
29
30