ST Unit 2
ST Unit 2
Testing methodologies in Software Testing are nothing more than strategies designed to tackle one of
the biggest problems in development; finding errors and fixing them.
With every passing minute, the deck of technologies, coding languages, possible integrations, and
more is growing in sheer number. We cannot expect to have only one set methodology for every other
kind of development process.
This is why software testing is divided into specific types, from which you get to choose and apply the
most suitable one for your project.
Types of Software Testing Methodologies
It is a way of software testing in which the It is a way of testing the software in which the
internal structure or the program or the code is tester has knowledge about the internal structure
hidden and nothing is known about it. or the code or the program of the software.
Black Box Testing White Box Testing
Implementation of code is not needed for black Code implementation is necessary for white box
box testing. testing.
This testing can be initiated based on the This type of testing of software is started after a
requirement specifications document. detail design document.
It is the behavior testing of the software. It is the logic testing of the software.
It is applicable to the higher levels of testing of It is generally applicable to the lower levels of
software. software testing.
Can be done by trial and error ways and Data domains along with inner or internal
methods. boundaries can be better tested.
It is less exhaustive as compared to white box It is comparatively more exhaustive than black
testing. box testing.
2. Branch Coverage:
In this technique, test cases are designed so that each branch from all decision points is traversed at
least once. In a flowchart, all edges must be traversed at least once.
4 test cases are required such that all branches of all decisions are covered, i.e, all edges of the
3. Condition Coverage
In this technique, all individual conditions must be covered as shown in the following example:
READ X, Y
IF(X == 0 || Y == 0)
PRINT ‘0’
#TC1 – X = 0, Y = 55
#TC2 – X = 5, Y = 0
4. Multiple Condition Coverage
In this technique, all the possible combinations of the possible outcomes of conditions are tested at
least once. Let’s consider the following example:
READ X, Y
IF(X == 0 || Y == 0)
PRINT ‘0’
#TC1: X = 0, Y = 0
#TC2: X = 0, Y = 5
#TC3: X = 55, Y = 0
#TC4: X = 55, Y = 5
5. Basis Path Testing
In this technique, control flow graphs are made from code or flowchart and then Cyclomatic
complexity is calculated which defines the number of independent paths so that the minimal number
of test cases can be designed for each independent path. Steps:
Make the corresponding control flow graph
Calculate the cyclomatic complexity
Find the independent paths
Design test cases corresponding to each independent path
V(G) = P + 1, where P is the number of predicate nodes in the flow graph
V(G) = E – N + 2, where E is the number of edges and N is the total number of nodes
V(G) = Number of non-overlapping regions in the graph
#P1: 1 – 2 – 4 – 7 – 8
#P2: 1 – 2 – 3 – 5 – 7 – 8
#P3: 1 – 2 – 3 – 6 – 7 – 8
#P4: 1 – 2 – 4 – 7 – 1 – . . . – 7 – 8
6. Loop Testing
Loops are widely used and these are fundamental to many algorithms hence, their testing is very
important. Errors often occur at the beginnings and ends of loops.
Simple loops: For simple loops of size n, test cases are designed that:
1. Skip the loop entirely
2. Only one pass through the loop
3. 2 passes
4. m passes, where m < n
5. n-1 ans n+1 passes
Nested loops: For nested loops, all the loops are set to their minimum count, and we start
from the innermost loop. Simple loop tests are conducted for the innermost loop and this
is worked outwards till all the loops have been tested.
Concatenated loops: Independent loops, one after another. Simple loop tests are applied
for each. If they’re not independent, treat them like nesting.
White Testing is performed in 2 Steps
1. Tester should understand the code well
2. Tester should write some code for test cases and execute them
Tools required for White box testing:
PyUnit
Sqlmap
Nmap
Parasoft Jtest
Nunit
VeraUnit
CppUnit
Bugzilla
Fiddler
JSUnit.net
OpenGrok
Wireshark
HP Fortify
CSUnit
Features of White box Testing
1. Code coverage analysis: White box testing helps to analyze the code coverage of an
application, which helps to identify the areas of the code that are not being tested.
2. Access to the source code: White box testing requires access to the application’s source
code, which makes it possible to test individual functions, methods, and modules.
3. Knowledge of programming languages: Testers performing white box testing must
have knowledge of programming languages like Java, C++, Python, and PHP to
understand the code structure and write tests.
4. Identifying logical errors: White box testing helps to identify logical errors in the code,
such as infinite loops or incorrect conditional statements.
5. Integration testing: White box testing is useful for integration testing, as it allows testers
to verify that the different components of an application are working together as
expected.
6. Unit testing: White box testing is also used for unit testing, which involves testing
individual units of code to ensure that they are working correctly.
7. Optimization of code: White box testing can help to optimize the code by identifying
any performance issues, redundant code, or other areas that can be improved.
8. Security testing: White box testing can also be used for security testing, as it allows
testers to identify any vulnerabilities in the application’s code.
9. Verification of Design: It verifies that the software’s internal design is implemented in
accordance with the designated design documents.
10. Check for Accurate Code: It verifies that the code operates in accordance with the
guidelines and specifications.
11. Identifying Coding Mistakes: It finds and fix programming flaws in your code,
including syntactic and logical errors.
12. Path Examination: It ensures that each possible path of code execution is explored and
test various iterations of the code.
13. Determining the Dead Code: It finds and remove any code that isn’t used when the
programme is running normally (dead code).
Advantages of Whitebox Testing
1. Thorough Testing: White box testing is thorough as the entire code and structures are
tested.
2. Code Optimization: It results in the optimization of code removing errors and helps in
removing extra lines of code.
3. Early Detection of Defects: It can start at an earlier stage as it doesn’t require any
interface as in the case of black box testing.
4. Integration with SDLC: White box testing can be easily started in Software
Development Life Cycle.
5. Detection of Complex Defects: Testers can identify defects that cannot be detected
through other testing techniques.
6. Comprehensive Test Cases: Testers can create more comprehensive and effective test
cases that cover all code paths.
7. Testers can ensure that the code meets coding standards and is optimized for
performance.
Disadvantages of White box Testing
1. Programming Knowledge and Source Code Access: Testers need to have programming
knowledge and access to the source code to perform tests.
2. Overemphasis on Internal Workings: Testers may focus too much on the internal
workings of the software and may miss external issues.
3. Bias in Testing: Testers may have a biased view of the software since they are familiar
with its internal workings.
4. Test Case Overhead: Redesigning code and rewriting code needs test cases to be written
again.
5. Dependency on Tester Expertise: Testers are required to have in-depth knowledge of
the code and programming language as opposed to black-box testing.
6. Inability to Detect Missing Functionalities: Missing functionalities cannot be detected
as the code that exists is tested.
7. Increased Production Errors: High chances of errors in production.
BLACK BOX TESTING
Black-box testing is a type of software testing in which the tester is not concerned with the internal
knowledge or implementation details of the software but rather focuses on validating the
functionality based on the provided specifications or requirements.
Prerequisite - Software Testing | Basics
Black box testing can be done in the following ways:
1. Syntax-Driven Testing – This type of testing is applied to systems that can be syntactically
represented by some language. For example, language can be represented by context-free grammar.
In this, the test cases are generated so that each grammar rule is used at least once.
2. Equivalence partitioning – It is often seen that many types of inputs work similarly so instead of
giving all of them separately we can group them and test only one input of each group. The idea is to
partition the input domain of the system into several equivalence classes such that each member of
the class works similarly, i.e., if a test case in one class results in some error, other members of the
class would also result in the same error.
4. Cause effect graphing – This technique establishes a relationship between logical input called
causes with corresponding actions called the effect. The causes and effects are represented using
Boolean graphs. The following steps are followed:
1. Identify inputs (causes) and outputs (effect).
2. Develop a cause-effect graph.
3. Transform the graph into a decision table.
4. Convert decision table rules to test cases.
For example, in the following cause-effect graph:
Boundary value analysis is one of the widely used case design technique for black box testing. It is
used to test boundary values because the input values near the boundary have higher chances of error.
Whenever we do the testing by boundary value analysis, the tester focuses on, while entering boundary
value whether the software is producing correct output or not.
Boundary values are those that contain the upper and lower limit of a variable. Assume that, age is a
variable of any function, and its minimum value is 18 and the maximum value is 30, both 18 and 30
will be considered as boundary values.
The basic assumption of boundary value analysis is, the test cases that are created using boundary
values are most likely to cause an error.
There is 18 and 30 are the boundary values that's why tester pays more attention to these values, but
this doesn't mean that the middle values like 19, 20, 21, 27, 29 are ignored. Test cases are developed
for each and every value of the range.
Testing of boundary values is done by making valid and invalid partitions. Invalid partitions are tested
because testing of output in adverse condition is also essential.
Imagine, there is a function that accepts a number between 18 to 30, where 18 is the minimum and 30
is the maximum value of valid partition, the other values of this partition are 19, 20, 21, 22, 23, 24, 25,
26, 27, 28 and 29. The invalid partition consists of the numbers which are less than 18 such as 12, 14,
15, 16 and 17, and more than 30 such as 31, 32, 34, 36 and 40. Tester develops test cases for both
valid and invalid partitions to capture the behavior of the system on different input conditions.
The software system will be passed in the test if it accepts a valid number and gives the desired output,
if it is not, then it is unsuccessful. In another scenario, the software system should not accept invalid
numbers, and if the entered number is invalid, then it should display error massage.
If the software which is under test, follows all the testing guidelines and specifications then it is sent to
the releasing team otherwise to the development team to fix the defects.
Equivalence partitioning is a technique of software testing in which input data is divided into partitions
of valid and invalid values, and it is mandatory that all partitions must exhibit the same behavior. If a
condition of one partition is true, then the condition of another equal partition must also be true, and if
a condition of one partition is false, then the condition of another equal partition must also be false.
The principle of equivalence partitioning is, test cases should be designed to cover each partition at
least once. Each value of every equal partition must exhibit the same behavior as other.
The equivalence partitions are derived from requirements and specifications of the software. The
advantage of this approach is, it helps to reduce the time of testing due to a smaller number of test
cases from infinite to finite. It is applicable at all levels of the testing process.
In both examples, we can see that there is a partition of two equally valid and invalid partitions, on
applying valid value such as OTP of six digits in the first example and mobile number of 10 digits in
the second example, both valid partitions behave same, i.e. redirected to the next page.
Another two partitions contain invalid values such as 5 or less than 5 and 7 or more than 7 digits in the
first example and 9 or less than 9 and 11 or more than 11 digits in the second example, and on
applying these invalid values, both invalid partitions behave same, i.e. redirected to the error page.
We can see in the example, there are only three test cases for each example and that is also the
principal of equivalence partitioning which states that this method intended to reduce the number of
test cases.
Let us see how pressman and general practice approaches are going to use in different conditions:
Condition1
If the requirement is a range of values, then derive the test case for one valid and two invalid inputs.
Here, the Range of values implies that whenever we want to identify the range values, we go for
equivalence partitioning to achieve the minimum test coverage. And after that, we go for error
guessing to achieve maximum test coverage.
According to pressman:
For example, the Amount of test field accepts a Range (100-400) of values:
Whenever the requirement is Range + criteria, then divide the Range into the internals and check for
all these values.
For example:
In the below image, the pressman technique is enough to test for an age text field for one valid and two
invalids. But, if we have the condition for insurance of ten years and above are required and multiple
policies for various age groups in the age text field, then we need to use the practice method.
Condition2
If the requirement is a set of values, then derive the test case for one valid and two invalid inputs.
Here, Set of values implies that whenever we have to test a set of values, we go for one
positive and two negative inputs, then we moved for error guessing, and we also need to verify that
all the sets of values are as per the requirement.
Example 1
If we have things like loans, we should go for the general practice approach and separate the stuff into
the intervals to achieve the minimum test coverage.
Example 2
if we are doing online shopping, mobile phone product, and the different Product ID -1,4,7,9
Here, 1 → phone covers 4 → earphones 7 → charger 9 → Screen guard
And if we give the product id as 4, it will be accepted, and it is one valid value, and if we provide the
product id as 5 and phone cover, it will not be accepted as per the requirement, and these are the two
invalid values.
Condition 3
If the requirement id Boolean (true/false), then derive the test case for both true/false values.
The Boolean value can be true and false for the radio button, checkboxes.
For example
Note:
Here, we are testing the application by deriving the below inputs values:
ADVERTISEMENT
When the pressman technique is used, the first two conditions are tested, but if we use the practice
method, all three conditions are covered.
We don't need to use the practice approach for all applications. Sometime we will use the pressman
method also.
But, if the application has much precision, then we go for the practice method.
If we want to use the practice method, it should follow the below aspects:
o It should be product-specific
o It should be case-specific
o The number of divisions depends on the precision( 2% and 3 % deduction)
We can achieve the Minimum test This technique will not consider the condition for
coverage boundary value analysis.
It helps to decrease the general test The test engineer might assume that the output for all
execution time and also reduce the set data set is right, which leads to the problem during the
of test data. testing process.
Error guessing is a technique in which there is no specific method for identifying the error. It is based
on the experience of the test analyst, where the tester uses the experience to guess the problematic
areas of the software. It is a type of black box testing technique which does not have any defined
structure to
In this approach, every test engineer will derive the values or inputs based on their understanding or
assumption of the requirements, and we do not follow any kind of rules to perform error guessing
technique.
The accomplishment of the error guessing technique is dependent on the ability and product
knowledge of the tester because a good test engineer knows where the bugs are most likely to be,
which helps to save lots of time.
The implementation of this technique depends on the experience of the tester or analyst having prior
experience with similar applications. It requires only well-experienced testers with quick error
guessing technique. This technique is used to find errors that may not be easily captured by formal
black box testing techniques, and that is the reason, it is done after all formal techniques.
The scope of the error guessing technique entirely depends on the tester and type of experience in the
previous testing involvements because it does not follow any method and guidelines. Test cases are
prepared by the analyst to identify conditions. The conditions are prepared by identifying most error
probable areas and then test cases are designed for them.
The main purpose of this technique is to identify common errors at any level of testing by exercising
the following tasks:
The main purpose of the error guessing technique is to deal with all possible errors which cannot be
identified as informal testing.
o The main purpose of error guessing technique is to deal with all possible errors which cannot
be identified informal testing.
o It must contain the all-inclusive sets of test cases without skipping any problematic areas and
without involving redundant test cases.
o This technique accomplishes the characteristics left incomplete during the formal testing.
Depending on the tester's intuition and experience, all the defects cannot be corrected. There are some
factors that can be used by the examiner while using their experience -
o Tester's intuition
o Historical learning
o Review checklist
o Risk reports of the software
o Application UI
o General testing rules
o Previous test results
o Defects occurred in the past
o Variety of data which is used for testing
o Knowledge of AUT
Example1
A function of the application requires a mobile number which must be of 10 characters. Now, below
are the techniques that can be applied to guess error in the mobile number field:
o What will be the result, if the entered character is other than a number?
o What will be the result, if entered characters are less than 10 digits?
o What will be the result, if the mobile field is left blank?
After implementing these techniques, if the output is similar to the expected result, the function is
considered to be bug-free, but if the output is not similar to the expected result, so it is sent to the
development team to fix the defects.
However, error guessing is the key technique among all testing techniques as it depends on the
experience of a tester, but it does not give surety of highest quality benchmark. It does not provide full
coverage to the software. This technique can yield a better result if combined with other techniques of
testing.
Example2
Suppose we have one bank account, and we have to deposit some money over there, but the amount
will be accepted on a particular range of which is 5000-7000. So here, we will provide the different
input's value until it covers the maximum test coverage based on the error guessing technique, and see
whether it is accepted or give the error message:
Value description
6000 Accept
5555 Accept
---- ----
---- ----
Note:
And, if we enter 5000 → error message (not accepted based on the condition)
Advantages
Disadvantage
o The error guessing technique is person-oriented rather than process-oriented because it depends
on the person's thinking.
o If we use this technique, we may not achieve the minimum test coverage.
o With the help of this, we may not cover all the input or boundary values.
o With this, we cannot give the surety of the product quality.
o The Error guessing technique can be done by those people who have product knowledge; it
annot be done by those who are new to the product.