Software Testing
INTRODUCTION
1
Intro
► Suppose you are being asked to lead the team to test the software
that controls a new X-ray machine. Would you take that job?
► What if the contract says you’ll be charged with murder in case a
patient dies because of a mal-functioning of the software?
2
State-of-the-Art
► 30-85 errors are made per 1000 lines of source code.
► extensively tested software contains 0.5-3 errors per 1000
lines of source code.
► testing is postponed, as a consequence: the later an error is
discovered, the more it costs to fix it.
► error distribution: 60% design, 40% implementation. 66% of
the design errors are not discovered until the software has
become operational.
3
Software testing
► Check software correctness.
► Testing is the process of evaluating a system or its
component(s) with the intent to find that whether it satisfies
the specified requirements or not.
► Who does testing?
► Software Tester
► Software Developer
► Project Lead/Manager
► End User
4
Error, fault, failure
► An error is a human activity resulting in software containing a
fault
► A fault is the manifestation of an error
► A fault may result in a failure
► Error →Fault → Failure
5
Classification of testing techniques
► Classification based on the criterion to measure the adequacy of a
set of test cases:
► coverage-based testing
► fault-based testing
► error-based testing
► Classification based on the source of information to derive test
cases:
► black-box testing (functional, specification-based)
► white-box testing (structural, program-based)
► Grey-box testing
6
7
nosirapmoC
Level of testing
► Functional ► Non-Functional Testing
Testing ► Performance Testing
(Load and Stress)
► Unit Testing ► Usability Testing (Usability
vs UI testing)
► Integration
► Security Testing
Testing
► Portability Testing
► System Testing
► Regression
Testing
► Acceptance
Testing
8
Functional Testing
► Unit Testing
► This type of testing is performed by the 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 separate 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.
► Integration Testing
► The testing of combined parts of an application to determine if they function correctly together is
Integration testing. There are two methods of doing Integration Testing Bottom-up Integration testing and
Top Down Integration testing.
► Bottom-up integration testing begins with unit testing, followed by tests of progressively higher-level
combinations of units called modules or builds.
► Top-Down integration testing, the highest-level modules are tested first and progressively lower-level
modules are tested after that. In a comprehensive software development environment, bottom-up testing
is usually done first, followed by top-down testing.
► System Testing
► This is the next level in the testing and tests the system as a whole. Once all the
9
components are
integrated, the application as a whole is tested rigorously to see that it meets Quality Standards. This type
Non-Functional Testing
► Performance Testing
► It is mostly used to identify any bottlenecks or performance issues rather than finding the
bugs in software. There are different causes which contribute in lowering the
performance of software:
► Network delay.
► Client side processing.
► Database transaction processing.
► Load balancing between servers.
► Data rendering.
► Performance testing is considered as one of the important and mandatory
testing type in terms of following aspects:
► Speed (i.e. Response Time, data rendering and accessing)
► Capacity
► Stability
► Scalability
► It can be either qualitative or quantitative testing activity and can be divided
into different sub types such as Load testing and Stress testing.
10
Non-Functional Testing
► Load Testing
► A process of testing the behavior of the Software by applying maximum load in terms of Software accessing and
manipulating large input data. It can be done at both normal and peak load conditions. This type of testing identifies the
maximum capacity of Software and its behavior at peak time.
► Most of the time, Load testing is performed with the help of automated tools such as Load Runner, AppLoader, IBM
Rational Performance Tester, Apache JMeter, Silk Performer, Visual Studio Load Test etc.
► Stress Testing
► This testing type includes the testing of Software behavior under abnormal conditions. Taking away the resources,
applying load beyond the actual load limit is Stress testing.
► The main intent is to test the Software by applying the load to the system and taking over the resources used by the
Software to identify the breaking point. This testing can be performed by testing different scenarios such as:
► Shutdown or restart of Network ports randomly.
► Turning the database on or off.
► Running different processes that consume resources such as CPU, Memory, server etc.
11
Unit Testing
� Unit testing is a type of automated testing to
check if the small piece of code is doing what it
is suppose to do.
� Unit testing checks a single component of an
application. The components are methods /
functions
� Thescope of Unit testing is narrow, it covers
the Unit or small piece of code under test.
Therefore while writing a unit test shorter
codes are used that target just a single class.
� Unit
testing comes under White box testing
type.
Example – Math Test
1. Developers prepares some
1. Teacher prearrangements known
prepares the as ,TEST SETUP,
question set 2. For each unit, create a TEST
2. Give each METHOD/CASE. Then, write
question to the TEST STATEMENTS in
students who the method which will call
appear under the the unit under test.
test. 3. The unit under test will
3. Students do the execute and return a result
math and return known as, ACTUAL RESULT.
the calculated 4. The test method have the
result right result known as,
4. The teacher EXPECTED RESULT and
knows the right compares it with the
result and previous actual result,
compares it with 5. The comparison identifies
the student’s whether the unit passed or
calculated result. failed.
5. Mark the student
pass / fail
How to write unit tests
�
� Setup / pre-conditions are usually defined as a
separate property of the test case. Are generally
written under the setup method.
� test steps: instructions / statements written with in the
test method
� a predefined expected result is required for invoking
the unit
� Please watch the next video on writing unit
tests for detailed understanding