L27 11-3-2020 Software Testing-Introduction
L27 11-3-2020 Software Testing-Introduction
of software testing
Static Testing Dynamic Testing
Testing done without executing the program Testing done by executing the program
This testing does verification process Dynamic testing does validation process
Static testing is about prevention of defects Dynamic testing is about finding and fixing
the defects
Static testing gives assessment of code and Dynamic testing gives bugs/bottlenecks in
documentation the software system.
Static testing involves checklist and process Dynamic testing involves test cases for
to be followed execution
This testing can be performed before Dynamic testing is performed after
compilation compilation
Static testing covers the structural and Dynamic testing covers the executable file
statement coverage testing of the code
Cost of finding defects and fixing is less Cost of finding and fixing defects is high
Return on investment will be high as this Return on investment will be low as this
process involved at early stage process involves after the development
phase
More reviews comments are highly More defects are highly recommended for
recommended for good quality good quality.
Requires loads of meetings Comparatively requires lesser meetings
Types of software testing (verification & validation)
Verification and Validation are two measures used to check that the
software product meets the requirements specifications. Together
they help improve software quality.
Types of software testing
(verification & validation)
White box tests are named so as the source code is used during
software testing. White box tests are also known as structural tests
as they test small parts (structures) of the software product. Unit
tests and integration tests fall under these tests.
Black box tests are named so as the source code is not used during
software testing. Instead the executable binary machine code is
used. Black box tests are further divided into functional and non
functional tests. Non functional tests are further divided into
performance, security, usability etc. tests.
Regression tests are done for both white box as well as black box
tests.
Verification & validation and associated software testing
types
Verification & Validation
Requirement specification reviews are done after these artifacts get completed.
Software testers or business analysts review the requirement specifications for
completeness, ambiguity and errors. If any errors or incompleteness is found
then it is rectified.
Software design reviews are done to check if the software design is correct as per
requirement specifications. Software design reviews also include reviewing
software component structure. If large classes were with many methods are
designed then it will lead to difficult to understand source code. Similar structural
problems can be found during design reviews. The identified design problems
will need to be rectified
.
Source code reviews are done to check for dead code, wrong implementation of
business logic etc. If any of these defects are found then they are rectified.
Code walkthroughs are also used for source code checking. Here the developer
presents his/her source code in front of other project team members. Team
members review the source code and find any defects are there in the code.
Software developer later rectifies those defects.
Unit testing
Unit testing is done after a class or component is
constructed. Each class implements some business
logic. The source code in the class is checked to verify if
the business logic is implemented properly.
The above class implements a business logic which needs to be tested. The test code can be
as following:
class testAddition {
public method void testAdding () {
boolean x = addition.adding(-3, 5);
}
}
The above test case is a negative test case as the expected result should fail. Using
positive and negative tests, we can find out if the business logic works fine.
For positive and negative testing, this test class can be provided with various values and
these values will be passed to the class under test through parameters.
Unit Test: Example
In the above example, you will also need to find out if the mentioned record has been
deleted from the database.
Database operations work on the principle of first searching
a particular record and then doing database operations.
If a particular record is changed or deleted after a test then
the same test script will not work next time.
Since the particular database record was changed after
execution of test script the first time, next time you may
need to change test script.
There are some other tests which are also done on software products.
If alpha and beta release of a software product are done then alpha
and beta testing is done for the software product.
Smoke testing is done when a piece of source code is integrated with
the source code build.
Planned testing involves writing test cases and then executing them to
find software defects.
Planned testing has a limitation that only limited testing can be done
within the allowed time limits for testing.
Exploratory testing removes this barrier. Instead of spending too much
time in writing test cases, exploratory testing does not use test
cases at all. A software tester will just run various commands to
execute business processes and find out if they are working
correctly. If the tester finds any incorrect behavior then he/she will
file a test defect with the details. Using this technique more testing
of the software product can be done within a short span of time.
coverage based testing
• A coverage based testing strategy is used when it is
known in advance as to which part of the software
product needs to be tested. This strategy is adopted
when it is known that it is not possible to test the entire
software product in the allotted time for software testing
on a software project. A good strategy in such situation
is to prioritize test cases and do testing only for test
cases which are high on priority.
Penetration testing is a usually a form of
black box security testing. In a pen test you are
trying to break into the server as many times as
possible and report back on how they where
able to break in. This is often done multiple
times to make sure that the patches hold water.
This is an important type of security testing
because its as real world as it gets. (Common
tools for web application penetration testing are
Acunetix)
Chapter 9
Software Testing (Verification & Validation)
Test case description
A test case consists of test case description, entry criteria, exit criteria,
expected result, actual result and test execution result (pass/fail). Test case
description contains steps which are needed to be done during execution of
a test case. Entry criteria is the conditions which should be valid before a
test case can be executed. Exit criteria is the conditions which should be
valid after a test case is executed. Expected result is the expected outcome
of computation after execution of a test case. Actual result is the actual
outcome of computation after execution of a test case. If actual result is
same as expected result then the test case passes and it is assumed that
the tested business process has worked as per expected. Thus there is no
software defect. In contrast if the actual result is not the same as expected
result then it is assumed that the tested business process has not worked
as per expected. Thus there is a software defect and it needs to be fixed.
Chapter 9
Software Testing (Verification & Validation)
Test case design
Designing good test cases is important because all testing needs to be
carried out within time limits. If test designs are not good then it may
lead to ineffective testing. Even with limited number of good test
cases it is possible to test a software product effectively.
Using boundary value analysis it is possible to test a business process
with just 3 test cases. In one test case, a test value which is above
the allowed range of valid input can be used for a negative result
and assess if the business logic works correctly. Similarly a value
below the allowed range of valid input can be used for a negative
result and assess if the business logic works correctly. Finally a
value within the allowed range of valid input can be used for a
positive result and assess if the business logic works correctly.
Using decision trees it is possible to test complex business logic where
a matrix of values are needed to test a business process.
Chapter 9
Software Testing (Verification & Validation)
Test environment
A good test environment is important for finding software
defects. If a good test environment is not provided then it
can lead to difficulty in finding defects.
Once a software release needs to be tested then a stable
and isolated test environment is created on a computer.
Exact replica of the software product is installed on this
environment. Test data is also created.
Apart from the test environment, supporting facilities like
defect tracking system, configuration management
system etc. also need to be prepared for a testing cycle.
Chapter 9
Software Testing (Verification & Validation)
Test cycle
Chapter 9
Software Testing (Verification & Validation)
Test cycle is the process which is followed from test planning to test
case writing to test execution to defect logging.
Test planning involves finding out which software features need to be
tested, how testing will be done and for how long testing activities
will be carried out.
Test case design involves finding out what testing techniques
(boundary value analysis, decision trees etc.) will be used and how
much test coverage will be done during test cycle.
Test cases are written by testers after test design is decided. How
many test cases needs to be written will depend on test coverage,
testing techniques used etc.
Test case execution starts when test preparation is done and test
cases have been written. All the failed test cases will result in
pointing to software defects. These software defects are logged so
that they can be fixed.
Chapter 9
Software Testing (Verification & Validation)
Software defect cycle
Chapter 9
Software Testing (Verification & Validation)
When test case execution starts then some of the test
cases will pass while others will fail. The failed test case
point to software defects. These software defects are
logged in a defect tracking system. The software
developer who owns the software product feature which
contains the software defect is notified. The software
developer fixes the software defect and notifies the
software tester who had logged the software defect. The
tester then verifies if the software defect indeed has
been fixed. If the defect is found to be fixed then the
tester will close the software defect in the defect tracking
system.
This is the complete lifecycle of software defect and its
fixing.