Unit6 Software Testing
Unit6 Software Testing
Unit6 Software Testing
the long term. If the bugs are caught in the early phases of software testing,
it costs less to fix those errors.
Security: Security testing is a type of software testing that is focused on
1. Black Box Testing: Black box technique of testing in which the tester doesn’t
have access to the source code of the software and is conducted at the
software interface without any concern with the internal logical structure of
the software known as 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.
In this method, tester selects a function and gives input value to examine its
functionality, and checks whether the function is giving expected output or not. If
the function produces correct output, then it is passed in testing, otherwise failed.
The test team reports the result to the development team and then tests the next
function. After completing testing of all functions if there are severe problems, then
it is given back to the development team for correction.
Test procedure
The test procedure of black box testing is a kind of process in which the tester has
specific knowledge about the software's work, and it develops test cases to check the
accuracy of the software's functionality.
It does not require programming knowledge of the software. All test cases are designed
by considering the input and output of a particular function.A tester knows about the
definite output of a particular input, but not about how the result is arising. There are
various techniques used in black box testing for testing like decision table technique,
boundary value analysis technique, state transition, All-pair testing, cause-effect graph
technique, equivalence partitioning technique, error guessing technique, use case
technique and user story technique. All these techniques have been explained in detail
within the tutorial.
Test cases
Test cases are created considering the specification of the requirements. These test
cases are generally created from working descriptions of the software including
requirements, design parameters, and other specifications. For the testing, the test
designer selects both positive test scenario by taking valid input values and adverse test
scenario by taking invalid input values to determine the correct output. Test cases are
mainly designed for functional testing but can also be used for non-functional testing.
Test cases are designed by the testing team, there is not any involvement of the
development team of software.
Boundary Boundary Value Technique is used to test boundary values, boundary values are
Value those that contain the upper and lower limit of a variable. It tests, while entering
Technique boundary value whether the software is producing correct output or not.
State State Transition Technique is used to capture the behavior of the software application
Transition when different input values are given to the same function. This applies to those
Technique types of applications that provide the specific number of attempts to access the
application.
All-pair Testing All-pair testing Technique is used to test all the possible discrete combinations of
Technique values. This combinational method is used for testing the application that uses
checkbox input, radio button input, list box, text box, etc.
Cause-Effect Cause-Effect Technique underlines the relationship between a given result and all the
Technique factors affecting the result.It is based on a collection of requirements.
Equivalence Equivalence partitioning is a technique of software testing in which input data divided
Partitioning into partitions of valid and invalid values, and it is mandatory that all partitions must
Technique exhibit the same behavior.
Error Guessing Error guessing is a technique in which there is no specific method for identifying the
Technique 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.
Use Case Use case Technique used to identify the test cases from the beginning to the end of
Technique the system as per the usage of the system. By using this technique, the test team
creates a test scenario that can exercise the entire software based on the functionality
of each function from start to end.
Developers do white box testing. In this, the developer will test every line of the code of
the program. The developers perform the White-box testing and then send the
application or the software to the testing team, where they will perform the black box
testing and verify the application along with the requirements and identify the bugs and
sends it to the developer.
The developer fixes the bugs and does one round of white box testing and sends it to
the testing team. Here, fixing the bugs implies that the bug is deleted, and the particular
feature is working fine on the application.
The white box testing contains various tests, which are as follows:
o Path testing
o Loop testing
o Condition testing
o Testing based on the memory perspective
o Test performance of the program
And test all the independent paths implies that suppose a path from main() to function
G, first set the parameters and test if the program is correct in that particular path, and
in the same way test all other paths and fix the bugs.
Loop testing
In the loop testing, we will test the loops such as while, for, and do-while, etc. and also
check for ending condition if working correctly and if the size of the conditions is
enough.
For example: we have one program where the developers have given about 50,000
loops.
{
while(50,000)
……
……
}
We cannot test this program manually for all the 50,000 loops cycle. So we write a small
program that helps for all 50,000 cycles, as we can see in the below program, that test P
is written in the similar language as the source code program, and this is known as a
Unit test. And it is written by the developers only.
Test P
{
……
…… }
As we can see in the below image that, we have various requirements such as 1, 2, 3, 4.
And then, the developer writes the programs such as program 1,2,3,4 for the parallel
conditions. Here the application contains the 100s line of codes.
The developer will do the white box testing, and they will test all the five programs line
by line of code to find the bug. If they found any bug in any of the programs, they will
correct it. And they again have to test the system then this process contains lots of time
and effort and slows down the product release time.
Now, suppose we have another case, where the clients want to modify the requirements,
then the developer will do the required changes and test all four program again, which
take lots of time and efforts.
In this, we will write test for a similar program where the developer writes these test
code in the related language as the source code. Then they execute these test code,
which is also known as unit test programs. These test programs linked to the main
program and implemented as programs.
Therefore, if there is any requirement of modification or bug in the code, then the
developer makes the adjustment both in the main program and the test program and
then executes the test program.
Condition testing
In this, we will test all logical conditions for both true and false values; that is, we will
verify for both if and else condition.
For example:
if(condition) - true
{
…..
……
……
}
else - false
{
…..
……
……
}
The above program will work fine for both the conditions, which means that if the
condition is accurate, and then else should be false and conversely.
o The reuse of code is not there: let us take one example, where we have four programs
of the same application, and the first ten lines of the program are similar. We can write
these ten lines as a discrete function, and it should be accessible by the above four
programs as well. And also, if any bug is there, we can modify the line of code in the
function rather than the entire code.
o The developers use the logic that might be modified. If one programmer writes code
and the file size is up to 250kb, then another programmer could write a similar code
using the different logic, and the file size is up to 100kb.
o The developer declares so many functions and variables that might never be used in
any portion of the code. Therefore, the size of the program will increase.
For example,
A Int a=15;
Int b=20;
String S= "Welcome";
….
…..
…..
….
…..
Int p=b;
Create user()
{
……
……
….. 200's line of code
}
In the above code, we can see that the integer a has never been called anywhere in the
program, and also the function Create user has never been called anywhere in the code.
Therefore, it leads us to memory consumption.
We cannot remember this type of mistake manually by verifying the code because of
the large code. So, we have a built-in tool, which helps us to test the needless variables
and functions. And, here we have the tool called Rational purify.
Suppose we have three programs such as Program P, Q, and R, which provides the input
to S. And S goes into the programs and verifies the unused variables and then gives the
outcome. After that, the developers will click on several results and call or remove the
unnecessary function and the variables.
o The developer does not use the available in-built functions; instead they write the full
features using their logic. Therefore, it leads us to waste of time and also postpone the
product releases.
Test the performance (Speed, response time) of the
program
The application could be slow for the following reasons:
As we know that the developer is performing white box testing, they understand that
the code is running slow, or the performance of the program is also getting deliberate.
And the developer cannot go manually over the program and verify which line of the
code is slowing the program.
To recover with this condition, we have a tool called Rational Quantify, which resolves
these kinds of issues automatically. Once the entire code is ready, the rational quantify
tool will go through the code and execute it. And we can see the outcome in the result
sheet in the form of thick and thin lines.
Here, the thick line specifies which section of code is time-consuming. When we double-
click on the thick line, the tool will take us to that line or piece of code automatically,
which is also displayed in a different color. We can change that code and again and use
this tool. When the order of lines is all thin, we know that the presentation of the
program has enhanced. And the developers will perform the white box testing
automatically because it saves time rather than performing manually.
Test cases for white box testing are derived from the design phase of the software
development lifecycle. Data flow testing, control flow testing, path testing, branch
testing, statement and decision coverage all these techniques used by white box testing
as a guideline to create an error-free software.
White box testing follows some working steps to make testing manageable and easy to
understand what the next task to do. There are some basic steps to perform white box
testing.
AD
Data Flow Data flow testing is a group of testing strategies that examines the control flow of
Testing programs in order to explore the sequence of variables according to the sequence of
events.
Control Flow Control flow testing determines the execution order of statements or instructions of
Testing the program through a control structure. The control structure of a program is used
to develop a test case for the program. In this technique, a particular part of a large
program is selected by the tester to set the testing path. Test cases represented by
the control graph of the program.
Branch Branch coverage technique is used to cover all branches of the control flow graph. It
Testing covers all the possible outcomes (true and false) of each condition of decision point
at least once.
Statement Statement coverage technique is used to design white box test cases. This technique
Testing involves execution of all statements of the source code at least once. It is used to
calculate the total number of executed statements in the source code, out of total
statements present in the source code.
Decision This technique reports true and false outcomes of Boolean expressions. Whenever
Testing there is a possibility of two or more outcomes from the statements like do while
statement, if statement and case statement (Control flow statements), it is considered
as decision point because there are two outcomes either true or false.
Unit Testing
Unit testing involves the testing of each unit or an individual component of the software
application. It is the first level of functional testing. The aim behind unit testing is to
validate unit components with its performance.
A unit is a single testable part of a software system and tested during the development
phase of the application software.
The purpose of unit testing is to test the correctness of isolated code. A unit component
is an individual function or code of the application. White box testing approach used for
unit testing and usually done by the developers.
Whenever the application is ready and given to the Test engineer, he/she will start
checking every component of the module or module of the application independently
or one by one, and this process is known as Unit testing or components testing.
o Unit testing helps tester and developers to understand the base of code that
makes them able to change defect causing code quickly.
o Unit testing helps in the documentation.
o Unit testing fixes defects very early in the development phase that's why there is
a possibility to occur a smaller number of defects in upcoming testing levels.
o It helps with code reusability by migrating code and test cases.
1. Amount transfer
Below are the application access details, which is given by the customer
While performing unit testing, we should follow some rules, which are as follows:
When we feel that the maximum test coverage is achieved, we will stop the testing.
Now, we will start performing the unit testing on the different components such as
o NUnit
o JUnit
o PHPunit
o Parasoft Jtest
o EMMA
Advantages
o Unit testing uses module approach due to that any part can be tested without waiting
for completion of another parts testing.
o The developing team focuses on the provided functionality of the unit and how
functionality should look in unit test suits to understand the unit API.
o Unit testing allows the developer to refactor code after a number of days and ensure the
module still working without any defect.
Disadvantages
o It cannot identify integration or broad level error as it works on units of the code.
o In the unit testing, evaluation of all execution paths is not possible, so unit testing is not
able to catch each and every error in a program.
o It is best suitable for conjunction with other testing activities.
Integration testing
Integration testing is the second level of the software testing process comes after unit
testing. In this testing, units or individual components of the software are tested in a
group. The focus of the integration testing level is to expose defects at the time of
interaction between integrated components or units.
Once all the components or modules are working independently, then we need to check
the data flow between the dependent modules is known as integration testing.
Let us see one sample example of a banking application, as we can see in the below
image of amount transfer.
o First, we will login as a user P to amount transfer and send Rs200 amount, the
confirmation message should be displayed on the screen as amount transfer
successfully. Now logout as P and login as user Q and go to amount balance page and
check for a balance in that account = Present balance + Received Balance. Therefore, the
integration test is successful.
o Also, we check if the amount of balance has reduced by Rs200 in P user account.
o Click on the transaction, in P and Q, the message should be displayed regarding the data
and time of the amount transfer.
o Top-Down approach
o Bottom-Up approach
Top-Down Approach
The top-down testing strategy deals with the process in which higher level modules are
tested with lower level modules until the successful completion of testing of all the
modules. Major design flaws can be detected and fixed early because critical modules
tested first. In this type of method, we will add the modules incrementally or one by one
and check the data flow in the same order.
In the top-down approach, we will be ensuring that the module we are adding is
the child of the previous one like Child C is a child of Child B and so on as we can
see in the below image:
Advantages:
Disadvantages:
Bottom-Up Method
The bottom to up testing strategy deals with the process in which lower level modules
are tested with higher level modules until the successful completion of testing of all the
modules. Top level critical modules are tested at last, so it may cause a defect. Or we can
say that we will be adding the modules from bottom to the top and check the data
flow in the same order.
In the bottom-up method, we will ensure that the modules we are adding are the
parent of the previous one as we can see in the below image:
Advantages
Disadvantages
o Critical modules are tested last due to which the defects can occur.
o There is no possibility of an early prototype.
Disadvantages:
o Identification of defects is difficult because finding the error where it came from
is a problem, and we don't know the source of the bug.
o Small modules missed easily.
o Time provided for testing is very less.
o We may miss to test some of the interfaces.
System Testing
System Testing includes testing of a fully integrated software system. Generally, a
computer system is made with the integration of software (any software is only a single
element of a computer system). The software is developed in units and then interfaced
with other software and hardware to create a complete computer system.
System testing is a series of different type of tests with the purpose to exercise and
examine the full working of an integrated software computer system against
requirements.
Regression Testing
Regression testing is performed under system testing to confirm and identify that if
there's any defect in the system due to modification in any other part of the system. It
makes sure, any changes done during the development process have not introduced a
new defect and also gives assurance; old defects will not exist on the addition of new
software over the time.
Load Testing
Load testing is performed under system testing to clarify whether the system can work
under real-time loads or not.
Functional Testing
Functional testing of a system is performed to find if there's any missing function in the
system. Tester makes a list of vital functions that should be in the system and can be
added during functional testing and should improve quality of the system.
Migration Testing
Migration testing is performed to ensure that if the system needs to be modified in new
infrastructure so it should be modified without any issue.
Usability Testing
The purpose of this testing to make sure that the system is well familiar with the user
and it meets its objective for what it supposed to do.
Recovery Testing
Recovery testing of a system is performed under system testing to confirm reliability,
trustworthiness, accountability of the system and all are lying on recouping skills of the
system. It should be able to recover from all the possible system crashes successfully.