Software Testing
Software Testing
TESTING
FUNDAMENTALS
CONTENTS
I. Examining the Specification
1. Black-Box Testing and White-Box Testing
2. Static and Dynamic Testing
3. Static Black-Box Testing: Testing the Specification
a) Performing a High Level Review of the Specification:
b) Low Level Specification Techniques:
Anuradha Bhatia
Software Testing
Figure 2.1
Anuradha Bhatia
Software Testing
1. This is also known as glass box, clear box, and open box testing.
2. In white box testing, test cases are created by looking at the code to detect any
potential failure scenarios.
3. The suitable input data for testing various APIs and the special code paths that
need to be tested by analysing the source code for the application block.
4. Therefore, the test plans need to be updated before starting white box testing
and only after a stable build of the code is available.
5. White box testing assumes that the tester can take a look at the code for the
application block and create test cases that look for any potential failure
scenarios.
6. During white box testing, analyze the code of the application block and prepare
test cases for testing the functionality to ensure that the class is behaving in
accordance with the specifications and testing for robustness.
7. A failure of a white box test may result in a change that requires all black box
testing to be repeated and white box testing paths to be reviewed and possibly
changed.
Anuradha Bhatia
Software Testing
1. The first step is to stand back and view it from a high level. Examine the
specifications for large fundamental problems, oversights, and omissions.
2. It is important to do research before testing, but ultimately the research is a
means to better understand what the software should do.
3. Research leads to the better understanding of the product on which testing is to
be performed.
4. For performing the high level review the guidelines are for pretending to be a
customer, research existing guidelines and review the similar test cases.
1. The easiest thing for a tester to do when he first receives a specification for
review is to pretend to be the customer.
2. Learn about the area where it will be used and implemented it’s important to
understand the customer’s expectations.
3. As the quality means “meeting the customer’s needs.” As a tester, to understand
those needs and to test the software is important.
4. The tester should be an expert in the field of testing.
Anuradha Bhatia
Software Testing
4. The guidelines are followed for the existing software’s are implemented.
1. Scale: - Will your software be smaller or larger? Will that size make a difference
in your testing? As the size of the software increases the hardware requirement
also changes. Keeping in mind the system requirement the software has to be
developed.
2. Complexity: - Will your software be more or less complex? Will this impact
your testing? The data structure used has to be pre-decided to reduce the
complexity in the program and modules should be well defined.
3. Testability: -Will you have the resources, time, and expertise to test software
such as this? The software has to be tested unit by unit and then the complete
integration testing to be performed for the product to be ready for deployment.
4. Quality/Reliability: -Is this software representative of the overall quality
planned for your software? Will your software be more or less reliable? The
update of the product to be made available and the proper documentation to be
prepared for future reference.
After you complete the high-level review of the product specification the testing
of the low level specification is done.
Anuradha Bhatia
Software Testing
Anuradha Bhatia
Software Testing
4. The testing approach has to be designed for it to work perfectly and for a
successful software tester.
1. Dynamic Black-Box Testing
a) Testing the Software while Blindfolded
(Question: Explain the concept of testing the software blindfolded in dynamic
black box testing = 4 marks)
1. Testing software without having an insight into the details of underlying code is
dynamic black-box testing.
2. It’s dynamic because the program is running and testing is done simultaneously
using it as a customer would. And, it’s black-box because you’re testing it
without knowing exactly how it works—with blinders on.
3. The inputs are entered, and receiving outputs and checking the results are
tabulated.
4. Another name commonly used for dynamic black-box testing is behavioral
testing because you’re testing how the software actually behaves when it’s used.
There are two fundamental approaches to testing software test-to-pass and test-
to-fail.
1. When you test-to-pass, you really assure only that the software minimally
works and as a software tester it is the first positive approach.
2. Don’t push its capabilities; don’t see what you can do to break it. Test the
software by applying the simplest and most straightforward test cases.
3. The software should be tested for it to work under the best ideal condition.
4. During test to fail, the software should be tested for the boundary conditions on
its various limits.
5. If the program is using integer numbers, than the output should be tested in the
limits of the integer variable.
For example
1. #include<stdio.h>
2. void main()
3. {
4. int i , fact= 1, n;
5. printf(“enter the number “);
6. scanf(“%d”,&n);
7. for(i =1 ;i <=n;i++)
Anuradha Bhatia
Software Testing
8. fact = fact * i;
9. printf (“the factorial of a number is ”%d”, fact);
10. }
The above program works for the integer values from 1 to 7, and fails as soon as
the input value is entered as 8, as it exceeds the integer range of variable for
fact.
c) Equivalence Partitioning
1. Type of black box testing that divides that divides the input domain of
the program into classes of data from which the test cases can be
divided.
2. This method is typically used to reduce the total number of test cases to a finite
set of testable test cases, still covering maximum requirements.
3. It is the process of taking all possible test cases and placing them into classes.
One test value is picked from each class while testing.
For example:
If you are testing for an input box accepting numbers from 1 to 1000 then there
is no use in writing thousand test cases for all 1000 valid input numbers plus
other test cases for invalid data.
1. Using equivalence partitioning method above test cases can be divided into
three sets of input data called as classes. Each test case is a representative of
respective class.
2. For the above example we can divide our test cases into three equivalence
classes of some valid and invalid inputs.
Test cases for input box accepting numbers between 1 and 1000 using
Equivalence Partitioning:
1. One input data class with all valid inputs. Pick a single value from range 1 to
1000 as a valid test case. If you select other values between 1 and 1000 then
result is going to be same. So one test case for valid input data should be
sufficient.
2. Input data class with all values below lower limit. i.e. any value below 1, as an
invalid input data test case.
3. Input data with any value greater than 1000 to represent third invalid input
class.
4. So using equivalence partitioning all possible test cases is partitioned into three
classes. Test cases with other values from any class should give you the same
result.
5. We have selected one representative from every input class to design our test
cases. Test case values are selected in such a way that largest number of
attributes of equivalence class can be exercised.
Anuradha Bhatia
Software Testing
2. Data Testing
(Question: Explain the concept data testing in dynamic black box testing = 4
marks)
1. The simplest view of software is to divide its world into two parts: the data and
the program.
2. The data is the keyboard input, mouse clicks, disk files, printouts, and so on.
3. The program is the executable flow, transitions, logic, and computations.
4. When software testing is performed on the data, the user information is checked
and the data is tabulated with the expected results.
Examples of data would be
•The words you type into a word processor
•The numbers entered into a spreadsheet
•The number of shots you have remaining in your space game
•The picture printed by your photo software
•The backup files stored on your floppy disk
•The data being sent by your modem over the phone lines
a) Boundary Condition
(Question: Explain the concept of boundary conditions and sub boundary
condition s in dynamic black box testing – 2 marks each = 4 marks)
Anuradha Bhatia
Software Testing
7. for(i =1 ;i <=n;i++)
8. fact = fact * i;
9. printf (“the factorial of a number is ”%d”, fact);
10. }
The boundary condition in the above example is for the integer variable.
b) Sub-Boundary Conditions
1. They’re the ones defined in the specification or evident when using the software.
2. Some boundaries, though, that are internal to the software aren’t necessarily
apparent to an end user but still need to be checked by the software tester.
3. These are known as sub-boundary conditions or internal boundary conditions.
4. In the given example the sub boundary condition is the value of factorial
For example
1. #include<stdio.h>
2. void main()
3. {
4. int i , fact=1, n;
5. printf(“enter the number “);
6. scanf(“%d”,&n);
7. for(i =1 ;i <=n;i++)
8. fact = fact * i;
9. printf (“the factorial of a number is ”%d”, fact);
10. }
Anuradha Bhatia
Software Testing
3. State Testing
(Question: Explain the concept state testing in dynamic black box testing –4
marks)
1. The data gets tested on the numbers, words, inputs, and outputs of the software.
2. The product or the software should be tested for the program’s logic flow
through its various states.
3. A software state is a condition or mode that the software is currently in.
4. Consider Figures 2.2, which illustrates the software mode of the paint software
in airbrush mode.
Figure 2.2
a) Testing Software’s Logic Flow
1. Testing the software’s states and logic flow has the same problems. It’s usually
possible to visit
2. Check for the all possible states for test to pass condition
3. The complexity of the software, especially due to the richness of today’s user
interfaces, provides so many choices and options that the number of paths
grows exponentially.
Anuradha Bhatia
Software Testing
Figure 2.3
Anuradha Bhatia
Software Testing
Anuradha Bhatia
Software Testing
10. Stress testing is running the software under less-than-ideal conditions such
as low memory, low disk space, slow CPUs, slow modems.
11. The software should be tested for external resources and dependencies it has
on them.
12. Stress testing is simply limiting them to their bare minimum.
Anuradha Bhatia