Professional Documents
Culture Documents
UNIT IV-OOSE
UNIT IV-OOSE
Testing is the process of evaluating a system or its component(s) with the intent to find whether it satisfies the
specified requirements or not.
Testing is executing a system in order to identify any gaps, errors, or missing requirements in contrary to the
actual requirements.
According to ANSI/IEEE 1059 standard, Testing can be defined as - A process of analyzing a software item to
detect the differences between existing and required conditions (that is defects/errors/bugs) and to evaluate the
features of the software item.
It depends on the process and the associated stakeholders of the project(s). In the IT industry, large companies
have a team with responsibilities to evaluate the developed software in context of the given requirements.
Moreover, developers also conduct testing which is called Unit Testing. In most cases, the following
professionals are involved in testing a system within their respective capacities:
Software Tester
Software Developer
Project Lead/Manager
End User
Different companies have different designations for people who test the software on the basis of their experience
and knowledge such as Software Tester, Software Quality Assurance Engineer, QA Analyst, etc.
Software Testing
Black-Box Testing
The technique of testing without having any knowledge of the interior workings of the application is called black-
box testing. The tester is oblivious to the system architecture and does not have access to the source code.
Typically, while performing a black-box test, a tester will interact with the system's user interface by providing
inputs and examining outputs without knowing how and where the inputs are worked upon.
The following table lists the advantages and disadvantages of black-box testing.
Advantages Disadvantages
Well suited and efficient for large code
segments. Limited coverage, since only a selected number
Code access is not required. of test scenarios is actually performed.
Clearly separates user's perspective from the Inefficient testing, due to the fact that the tester
developer's perspective through visibly defined only has limited knowledge about an
roles. application.
Large numbers of moderately skilled testers Blind coverage, since the tester cannot target
can test the application with no knowledge of specific code segments or error-prone areas.
implementation, programming language, or The test cases are difficult to design.
operating systems.
White-Box Testing
White-box testing is the detailed investigation of internal logic and structure of the code. White-box testing is
also called glass testing or open-box testing. In order to perform white-box testing on an application, a tester
needs to know the internal workings of the code.
The tester needs to have a look inside the source code and find out which unit/chunk of the code is behaving
inappropriately.
The following table lists the advantages and disadvantages of white-box testing.
Advantages Disadvantages
As the tester has knowledge of the source code, Due to the fact that a skilled tester is needed to
it becomes very easy to find out which type of perform white-box testing, the costs are
data can help in testing the application increased.
effectively. Sometimes it is impossible to look into every
It helps in optimizing the code. nook and corner to find out hidden errors that
Extra lines of code can be removed which can may create problems, as many paths will go
bring in hidden defects. untested.
Due to the tester's knowledge about the code, It is difficult to maintain white-box testing, as it
maximum coverage is attained during test requires specialized tools like code analyzers
scenario writing. and debugging tools.
Grey-Box Testing
Grey-box testing is a technique to test the application with having a limited knowledge of the internal workings
of an application. In software testing, the phrase the more you know, the better carries a lot of weight while testing
an application.
Mastering the domain of a system always gives the tester an edge over someone with limited domain knowledge.
Unlike black-box testing, where the tester only tests the application's user interface; in grey-box testing, the tester
has access to design documents and the database. Having this knowledge, a tester can prepare better test data and
test scenarios while making a test plan.
Advantages Disadvantages
Offers combined benefits of black-box and
white-box testing wherever possible. Since the access to source code is not available,
Grey box testers don't rely on the source code; the ability to go over the code and test coverage
instead they rely on interface definition and is limited.
functional specifications. The tests can be redundant if the software
Based on the limited information available, a designer has already run a test case.
grey-box tester can design excellent test Testing every possible input stream is
scenarios especially around communication unrealistic because it would take an
protocols and data type handling. unreasonable amount of time; therefore, many
The test is done from the point of view of the program paths will go untested.
user and not the designer.
Levels of testing include different methodologies that can be used while conducting software testing. The main
levels of software testing are:
Functional Testing
Non-functional Testing
Functional Testing
This is a type of black-box testing that is based on the specifications of the software that is to be tested. The
application is tested by providing input and then the results are examined that need to conform to the functionality
it was intended for. Functional testing of a software is conducted on a complete, integrated system to evaluate the
system's compliance with its specified requirements.
There are five steps that are involved while testing an application for functionality.
1. The determination of the functionality that the intended application is meant to perform.
3. The output based on the test data and the specifications of the application.
5. The comparison of actual and expected results based on the executed test cases.
An effective testing practice will see the above steps applied to the testing policies of every organization and
hence it will make sure that the organization maintains the strictest of standards when it comes to software quality.
This type of testing is performed by developers before the setup is handed over to the testing team to formally
execute the test cases. Unit testing is performed by the respective developers on the individual units of source
code assigned areas. The developers use test data that is different from the test data of the quality assurance team.
The goal of unit testing is to isolate each part of the program and show that individual parts are correct in terms
of requirements and functionality.
Testing cannot catch each and every bug in an application. It is impossible to evaluate every execution path in
every software application. The same is the case with unit testing.
There is a limit to the number of scenarios and test data that a developer can use to verify a source code. After
having exhausted all the options, there is no choice but to stop unit testing and merge the code segment with other
units.
Integration testing is defined as the testing of combined parts of an application to determine if they function
correctly. Integration testing can be done in two ways: Bottom-up integration testing and Top-down integration
testing.
S.N. Integration Testing Method
Bottom-up integration
1
This testing begins with unit testing, followed by tests of progressively higher-level combinations of units
called modules or builds.
Top-down integration
2
In this testing, the highest-level modules are tested first and progressively, lower-level modules are tested
thereafter.
In a comprehensive software development environment, bottom-up testing is usually done first, followed by top-
down testing. The process concludes with multiple tests of the complete application, preferably in scenarios
designed to mimic actual situations.
11.1.3 System Testing
System testing tests the system as a whole. Once all the components are integrated, the application as a whole is
tested rigorously to see that it meets the specified Quality Standards. This type of testing is performed by a
specialized testing team.
System testing is the first step in the Software Development Life Cycle, where the application is tested
as a whole.
The application is tested thoroughly to verify that it meets the functional and technical specifications.
The application is tested in an environment that is very close to the production environment where the
application will be deployed.
System testing enables us to test, verify, and validate both the business requirements as well as the
application architecture.
Whenever a change in a software application is made, it is quite possible that other areas within the application
have been affected by this change. Regression testing is performed to verify that a fixed bug hasn't resulted in
another functionality or business rule violation. The intent of regression testing is to ensure that a change, such as
a bug fix should not result in another fault being uncovered in the application.
Minimize the gaps in testing when an application with changes made has to be tested.
Testing the new changes to verify that the changes made did not affect any other area of the application.
Mitigates risks when regression testing is performed on the application.
Test coverage is increased without compromising timelines.
Increase speed to market the product.
This is arguably the most important type of testing, as it is conducted by the Quality Assurance Team who will
gauge whether the application meets the intended specifications and satisfies the client’s requirement. The QA
team will have a set of pre-written scenarios and test cases that will be used to test the application.
More ideas will be shared about the application and more tests can be performed on it to gauge its accuracy and
the reasons why the project was initiated. Acceptance tests are not only intended to point out simple spelling
mistakes, cosmetic errors, or interface gaps, but also to point out any bugs in the application that will result in
system crashes or major errors in the application.
By performing acceptance tests on an application, the testing team will deduce how the application will perform
in production. There are also legal and contractual requirements for acceptance of the system.
This test is the first stage of testing and will be performed amongst the teams (developer and QA teams). Unit
testing, integration testing and system testing when combined together is known as alpha testing. During this
phase, the following aspects will be tested in the application:
Spelling Mistakes
Broken Links
Cloudy Directions
The Application will be tested on machines with the lowest specification to test loading times and any
latency problems.
This test is performed after alpha testing has been successfully performed. In beta testing, a sample of the intended
audience tests the application. Beta testing is also known as pre-release testing. Beta test versions of software
are ideally distributed to a wide audience on the Web, partly to give the program a "real-world" test and partly to
provide a preview of the next release. In this phase, the audience will be testing the following:
Users will install, run the application and send their feedback to the project team.
Typographical errors, confusing application flow, and even crashes.
Getting the feedback, the project team can fix the problems before releasing the software to the actual
users.
The more issues you fix that solve real user problems, the higher the quality of your application will be.
Having a higher-quality application when you release it to the general public will increase customer
satisfaction.
Verification is the process of checking or verifying the credentials, data or information to confirm their credibility
and accuracy.In the field of software engineering, software verification is defined as the process of evaluating
software product, to ensure that the development phase is being carried out accurately, to build the desired
software product.
It is performed during the ongoing phase of software development, to ensure the detection of defects and faults in
the early stage of the development life cycle and to determine whether it satisfies the requirements of the
customer.
Types of Verification:
Software verifications are of two types, each of which, is focused on verifying various aspects of the software and
ensuring its high quality. Together, these two verification types ensure that the software conforms to and satisfies
specified requirements. The two types of software verification are:
1. Static Verification: Static verification involves inspection of the code before its execution, which ensures
that the software meets its specified requirements and specifications.
o It is an analysis based approach, usually carried out by just making an analysis of static aspects of
the software system, such as the code conventions, software metrics calculation, anti-pattern
detection, etc.
o It does not involve the operation of the system or component.
o Static verification includes both manual as well as automated testing techniques, such as
consistency techniques and measurement techniques.
2. Dynamic Verification: It concerns with the working behavior of the software and is being carried out
along with the execution of software. Also, know by 'Test phase' dynamic verification executes test data on
the software, to assess the behavior of the software.
o Unlike static verification, dynamic verification involves execution of the system or its components.
o The team selects a group of test cases consisting of tests data, which are then used to find out the
output test results.
o There are three subtypes of dynamic verification: functional testing, structural testing, and random
testing.
How to Perform Software Verification?
The process of software verification involves the assessment of the development phase and intermediary software
product, based on the pre-defined specifications and guidelines.
It ensures that the methodology used for software development adheres to the specified specifications, set-up
before the development phase, to build the correct software product.
Thus, this process requires cross-checking of these pre-defined specifications with the partially developed
software product, to satisfy the process of carrying out the development of the product, in a right way.
Approaches:
As stated above, the process of software verification involves reviews, walkthrough, and inspection, which
together helps to evaluate the accuracy of the product and ensure its quality. Therefore, defined below are these
approaches of software verification:
The process of software verification can be performed through following approaches:
1. Reviews: It is an organized way of examining the documents such as design specifications, requirements
specifications, code, etc. by one or more than one person, to explore defects in the software.
2. Walkthroughs: It is, usually an informal way of evaluating the software product, where different teams,
whether associated or non-associated with the software development, goes through the software product
and have discussion on possible errors and other defects, present in the software.
3. Inspection: It is one of the preferred and most common methods of the static testing. Unlike,
walkthroughs, it's a formal way of testing the software, through examination of documents, carried out by
the skilled moderator. This method usually, checklist, rules, entry & exist criteria along with preparation
and sharing of reports, in order to take corrective & necessary actions.
Advantages of Software Verification:
The advantages offered by software verification are numerous. It is among those processes, which makes the
process of software development easy and allows the team to create an end product that conforms to the rules and
regulations, as well as customer’s requirements. Other advantages of this process are:
It helps reduce the number of defects found during the later stages of development.
Verifying the software in its initial development phase allows the team to get a better understanding of the
product.
It helps reduce the chances of system failures and crashes.
Assists the team in developing a software product that conforms to the specified requirements and design
specifications.
Structural Testing
Structural Testing is a type of software testing. This testing is used to test the internal design of the software or the
structure of the coding for the particular software. Structural testing uses white box testing techniques. The
structural testing is concentrated on how the system is doing rather than the functionality of the system.
The testing phase starts after the development phase. The development team is included in the structural
testing. It must be noted that the working of structural testing is different from behavioral testing.
Types of Structural Testing
The following are the types of structural testing:
1. Mutation Testing
2. Data Flow Testing
3. Control flow Testing
4. Slice-based Testing
1. Mutation Testing
Mutation testing is structural testing that is performed to design new software tests and also evaluate the quality of
tests. It is related to the modification of a program in small ways.
It is a structural testing technique, which uses the structure of the code to guide the testing process. Mutation
testing has the following three types:
Value Mutation
Decision Mutation
Statement Mutation
Value Mutation: It is mutation testing that changes the values of constants to detect errors.
Decision Mutation: It is a type of testing that changes the logical or arithmetic operations to detect any errors. Let
us understand this using simple coding snippet.
Statement Mutation: A statement mutation either deletes a statement or replaces the statement to check for errors.
2. Data Flow Testing
Data Flow testing is structural testing it is used to find the test paths of a program according to the values. It is
used to analyze the flow of data in the program. These are mainly concerned with
Statements where variables receive values,
Where these values are being used or referenced.
3. Control Flow Testing
Control flow testing is a type of software testing technique that uses the control flow technique. It is a form of
testing that depicts the execution order of the statements. It is used to develop the test cases of the programs. The
tester selects a test case from a large portion of the program to test. The whole test cases are represented in the
form of a control flow graph with basic blocks as a node, edge, etc. This consists of various nodes such as entry
node, exit node, decision node, junction node. The node holds a statement whereas the edge is used to connect or
determine the flow of nodes.
We use the following steps in the control flow testing:
1. Control Flow Graph Creation: A graph is created from the source code either manually or using the
software.
2. Coverage Test: A coverage test is defined over the graph and elements of the graph such as nodes, edges,
paths, etc.
3. Test Case Creation: A set of test cases are created to cover the coverage target for control flow graphs.
4. Test Case Execution: The test cases are executed after the creation of test cases.
5. Analysis of results: Analysis of results is the phase where we find out if the program consists of any errors
or not.
3. Slice-Based Testing
Slicing or program slicing is a technique used in software testing which takes a slice or a group of program
statements in a program. It consists of two types which are as follows:
Static Slicing: Static slicing is a group of statements that affects the final result of any variable at any point
in time.
Dynamic Slicing: The dynamic slice of a program contains all the statements that actually affect the value
of a variable at any point for a particular execution of the program.
Techniques used in Structural Testing
The following are the techniques used in structural testing:
1. Statement Coverage
2. Branch Coverage
3. Path Coverage
Statement Coverage: Statement Coverage is a white box testing technique, which involves the execution of all
the statements at least once in the source code. It is a metric used to calculate the number of statements that have
been executed. It is also used to check the quality of the code and the flow of different paths.
Statement Coverage can be given by:
Statement Coverage= (No of statements executed/Total no of statements in the source code) * 100
The main drawback of this technique is that we cannot test the false condition to it
Branch Coverage: Branch Coverage is a testing method, it aims to ensure that each one of the possible branches
from each decision point is executed at least once. That is for each branch two conditions true and false are taken.
It helps in validating each and every branch in the program
The branch coverage is calculated as follows:
Branch Testing=(No of decision outcomes tested/ Total no of decision outcomes) * 100%
Structural Testing Tools
Structural testing contains some open-source and commercial tools that have their functionality. The most
common tools are
Cucumber
JBehave
Cfix
JUnit
Let us know about these a little bit.
Cucumber: It is the most widely used structural testing tool, it delivers an easily understandable testing
script. It is used by test engineers to develop test cases for the system
JBehave: It is a framework for BDD (Behaviour-driven Development). It is purely executing in Java. In
this, we can write the user stories. It allows stories to be executed through an Ant task
CFix: CFix is an XUnit testing framework supported by the C/C++ programming language. In this tool,
the unit tests are compiled and linked into a DLL. It supports the development of both user and kernel
mode
JUnit: It is one of the essential tools of structural testing. It is an open-source unit testing framework,
which was in Java language.
Generally, the software goes under four level of testing: Unit Testing, Integration Testing, System Testing, and
Acceptance Testing but sometimes due to time consumption software testers does minimal unit testing but
skipping of unit testing may lead to higher defects during Integration Testing, System Testing, and Acceptance
Testing or even during Beta Testing which takes place after the completion of software application.
Some crucial reasons are listed below:
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.
Mutation Testing
Mutation Testing is a type of Software Testing that is performed to design new software tests and also evaluate
the quality of already existing software tests. Mutation testing is related to modification a program in small ways.
It focuses to help the tester develop effective tests or locate weaknesses in the test data used for the program.
Changed Code:
if(a < b)
c = 10;
else
c = 20;
Changed Code:
if(a > b)
c = 10;
else
c = 20;
3. Statement Mutations:
In statement mutations a statement is deleted or it is replaces by some other statement.
Example:
Initial Code:
if(a < b)
c = 10;
else
c = 20;
Changed Code:
if(a < b)
d = 10;
else
d = 20;
Tools used for Mutation Testing :
Judy
Jester
Jumble
PIT
MuClipse.
Advantages of Mutation Testing:
It brings a good level of error detection in the program.
It discovers ambiguities in the source code.
It finds and solves the issues of loopholes in the program.
It helps the testers to write or automate the better test cases.
It provides more efficient programming source code.
Disadvantages of Mutation Testing:
It is highly costly and time-consuming.
It is not able for Black Box Testing.
Some, mutations are complex and hence it is difficult to implement or run against various test cases.
Here, the team members who are performing the tests should have good programming knowledge.
Selection of correct automation tool is important to test the programs
Levels of Testing
There are 4 levels of testing - unit testing, integration testing, system testing and acceptance testing. These levels
are based on the extent of module testing. Unit testing is done by the developer, whereas integration testing and
system testing are done by the testing team.
Software Maintenance
Software maintenance is a part of the Software Development Life Cycle. Its primary goal is to modify and update
software application after delivery to correct errors and to improve performance. Software is a model of the real
world. When the real world changes, the software require alteration wherever possible.
Software Maintenance is an inclusive activity that includes error corrections, enhancement of capabilities, deletion
of obsolete capabilities, and optimization.
Need for Maintenance
Software Maintenance is needed for:-
o Correct errors
o Change in user requirement with time
o Changing hardware/software requirements
o To improve system efficiency
o To optimize the code to run faster
o To modify the components
o To reduce any unwanted side effects.
Thus the maintenance is required to ensure that the system continues to satisfy user requirements.
Regression Testing
Regression testing is the process of testing the modified parts of the code and the parts that might get affected due
to the modifications to ensure that no new errors have been introduced in the software after the modifications have
been made. Regression means the return of something and in the software field, it refers to the return of a bug.
When to do regression testing?
When a new functionality is added to the system and the code has been modified to absorb and integrate
that functionality with the existing code.
When some defect has been identified in the software and the code is debugged to fix it.
When the code is modified to optimize its working.
Process of Regression testing:
Firstly, whenever we make some changes to the source code for any reason like adding new functionality,
optimization, etc. then our program when executed fails in the previously designed test suite for obvious reasons.
After the failure, the source code is debugged in order to identify the bugs in the program. After identification of
the bugs in the source code, appropriate modifications are made. Then appropriate test cases are selected from the
already existing test suite which covers all the modified and affected parts of the source code. We can add new test
cases if required. In the end, regression testing is performed using the selected test cases.