Software Quality Assurance and Testing For Beginners
Software Quality Assurance and Testing For Beginners
NITIN SHAH
Copyright © 2019 Nitin Shah
All rights reserved.
ISBN: 9781097280445
ABOUT THE AUTHOR
Nitin Shah has more than 35 years of experience in the area of software Development,
Implementation, Training, Software Quality Assurance, Pre Sales, Testing and Project
Management. While working with training, in-house and export oriented multinational
organizations, he acquired extensive knowledge and experience in all stages of SDLC and
STLC phases.
He was a Key Contributor in starting and growing new accounts and building high
performing team in the area of Verification and Validation in general and also setting up
automation and performance testing practice team for a location of the company. He was
also instrumental in conceptualization and mentoring software Test Automation
Framework/ Code generation tool development. As a delivery manager he held
responsibility for all testing projects being executed from that location and have
successfully performed techno-functional, managerial and support roles in various large
accounts.
He successfully managed delivery for an SLA based engagement supporting plenty of
release based testing projects with a team of 170+ Resources and contributed in significant
cost savings on customer side by consolidation of team, high offshore leverage of 82-85%,
continuously increasing productivity, automation, and reusability.
He Presented a white paper at international conference organized by Practical Software
Quality & Testing (PSQT) at Minneapolis in September 2005 and Co-authored a paper
which was published during Step-in summit held in Bangalore in January 2006.
He also has 5 years of full time training experience in a reputed software training institute
in India. Evan today he is associated with educational institutes to deliver expert lectures
and as external faculty for conducting viva. He is also a visiting faculty at a reputed
university in India and contributing in syllabus design and conducting training on Software
Quality Assurance and Testing.
ACKNOWLEDGEMENTS
I would like to thank Mr Mohit Shah for reviewing material as a student and providing
valuable feedback and suggestions that can make the contents even simpler and relevant to
students.
I am very thankful to Dr Satyen Parikh (Executive Dean, Prof. and head AMPICS, DCS,
Ganpat University) for giving an opportunity to design the course and conduct training
sessions on ‗Software Quality Assurance and Testing‘ for their BSC IT and BCA programs
in Ganpart University, Gujarat.
I am also very thankful to my previous employers who provided ample opportunities to
enhance my practical knowledge and experience to practically implement various concepts,
practices on software development and quality assurance.
Last but no he least, I am extremely thankful to family members for all the support given
to make me capable and adjusting to all the inconvenience caused during my work and
book writing.
REVIEW COMMENTS
―I found all the chapters to be really well written and the book covers all the important
topics. Overall the entire book is really good with chapters that are clearly and concisely
written. The examples provided makes each of the topics really easy to understand".
Mohit Shah,
B Tech in CS, CHARUSAT, Changa, Gujarat
Student of MS in CS, University of Southern California, L.A
Every product can have defects due to various reasons and; if not tested properly; can
impact negatively to the customers and customers can move to competitors providing
similar products with good quality. Same is the case with software application.
Following sub sections provide details on why all software applications have defects, how
unresolved defects could negatively impact the customers and why customers can move to
other competitors. The importance of testing can be derived from this understanding.
In 2012 US based Knight Capital Group Inc, mistakenly sent out more than four million
stock orders in less than an hour, costing half a billion dollars to reverse.
The reason was a code change was not deployed to all the servers
October 2017: Digital Payments firm MobiKwik loses over Rs 19 crore due to technical
glitch
This happened because the software erroneously allowed user to use money beyond
their balance amount.
As you can see in the examples above, the mistakes could be very small
o Wrong formula
o Regression effect: Defects are introduced in the working software/product
when the changes are made in the software for any enhancements.
o Retaining unwanted piece of code from previous version
o Incorrect/missing assignment to the variable – and the software assume 0 value
o Missing some specific condition of maximum allowable limit for money
withdrawal.
So, the software is developed for benefits but defects in the software results in loss.
And there are many instances where the loss may be much more than the benefits.
At every stage the miscommunication / misunderstanding can happen and issues may get
introduced.
In fact, in the real life scenarios, the issue starts from Requirement gathering phase itself.
There are gaps between the actual requirements needed by the end-user and what is
understood by Analysts.
Let us take one industry example to understand why every software application is expected
to have defects when built.
Case Study
Requirement: A Software product was to be developed which can be used by any
educational institute providing following high level modules and functionalities
o Learner & Staff setup
o Statutory Attendance and requirements
o Progress Tracking (Assessments & Exams)
o Behaviour Management & Detention
o Site management (Rooms, Equipment etc.)
o Automatic Timetabling/ Scheduling
o Manual Timetable updates
o Portal view for parents, learners, staff etc
Key expectations and measures:
o To be built and delivered in 14 calendar months
o Software product size: 21,000 Function Points (FP) and around 2 million lines
of code (LOC)
o Note: Function Point is a well-known unit to measure size of the software
application. It considers various aspects of the software to come up with
number of function points.
o It had 2000+ database objects
o 55,000+ person days of effort was spent
o At peak it had 175+ team members including Architects, Development &
Quality consultants. More than 60% of the team members were freshers
(without any major industry experience)
o 150,000 test cases were built with an estimation of 18 defect per 1000 lines of
code
For large and complex applications, there are always communication issues/gaps,
where multiple people are involved. There can be Inconsistency between components
developed by different people
Technical / Logical complexities - The system may have to be implemented in
heterogeneous environment (Desk top, Mobile, ATMs or any other such) making it
difficult to maintain quality.
Time Pressure – To meet deadlines, facing more issues than planned or due to any
other uncontrollable reasons.
Limited Knowledge / Experience level of developers. People with low knowledge /
experience level will have understanding gaps and unclear end-users perspectives
Changing Requirements: The requirements can change due to changes in business
rules, government rules or any other reasons. Many times the implications of
requirements are not foreseeable in the initial stage.
Exceptions are ignored: All business processes have some exceptions which are
generally missed out during analysis and design and only come up during
testing/implementation
Typical communication issues.
Missing information (Sender misses to communicate or receiver misses to
listen even if sender communicates)
Untold assumptions – Receiver makes some wrong assumptions even if some
aspects are not communicated to him/her.
Misunderstanding – Sender provides some information, receiver receives the
information but understands differently.
These gaps between Business to Business Analysts, Analyst to designer, Designer to
developer results into issues. So, issues are bound to be there in the software.
Some statistics reveal that 20 to 50 errors are found for every 1000 lines of code and 1 to 4
errors remain even after system testing is done.
There can be no software in the world which does not have any issues.
deficiencies.
While calculating cost of quality, we need to consider following three types of costs
1. Failure Cost: any effort or cost involved in Rework / replacement / Prestige /
business loss. These costs are incurred only because there was a defect. So, it is also
known as cost of poor Quality.
Internal Failure Cost are incurred when the defects were detected before the
application is moved to production environment. It includes direct cost
o To reproduce, analyse and fix the problem
o Retesting to determine that the defect is removed
o Reimplementation of the corrected code
o Costs involved in mitigating the risk of any possible side effects due to rework
done for fixing the problem. Any effort of regression testing to ensure that the
corrections/changes have not impacted other working module. If by chance it
has introduced new defect then additional effort may be required to identify and
remove that also
o Costs related to collection of quality metrics based on which organization can do
assess the modes of failure
External Failure Costs are associated with the defects found after the product has
been shipped to customer. It includes all the above costs and additionally include
o analysis of issue / Complaint resolution
o Product return and replacement
o Help line support
o Labour costs associated with warranty work
o Indirect costs such unsatisfied customers, loss of reputation, and loss of
business
2. Appraisal Cost: Cost of reviews (of all the work products such as Requirements,
Design, Code), testing and debugging (removing defects) and cost associated with data
collection and analysis. In order to reduce failure cost, we need to spend time and
effort for reviews and testing before the application goes into production. This is
known as Appraisal cost.
3. Prevention Cost: Cost involved in Training, Process implementation, planning etc.
So, if the organization spends enough time and effort to train the people, implement
some standards and follow various processes, the overall number of defects
introduced in the application will be less and hence will reduce appraisal cost and
failure cost.
1.1.5 Conclusion
It has been observed that if you increase time and effort for appraisal (testing and reviews),
failure cost will reduce resulting into overall reduction in total cost of quality. It has been
statistically proved and experienced that testing the application at the right time reduces
the overall cost.
Hence, improving quality of the software system by way of testing (finding the defects)
and debugging (removing defects) is very essential.
Every software system hence needs to be tested before it goes in to production for use. In
fact overall project cost could be reducing if you spend time on quality assurance activities
rather than acting on the defects found in the field.
We need to implement Testing process and activities that include planning & control,
choosing test conditions, designing and executing test cases, checking the results,
evaluating exit criteria (customer‘s acceptance criteria), reporting on testing process &
results, and finalizing and completing closure activities after test phase is completed
also needs an aptitude towards identifying problems and work until the problems are
resolved. As a developer we also may have taken wrong assumptions and understanding
which only independent team can find out.
So, Testing can be taken as career as the demand for test professionals is continuously
increasing with increased focus on quality.
It is also important to note that this knowledge is applicable for any software, developed
using any technology. All the types, processes and techniques one learn, can be used for
any application developed in any technology.
Skills acquired/required by the team involved in testing
Apart from conceptual understanding and application of the various processes and
techniques of SW testing, one can acquire following skills
o Analytical ability
o Desire to dive into detail
o Aptitude towards problem identification
o Ability to work with a problem until solved
o Applying testing methodology; testing tools and techniques
o Creative thinking to find maximum defects in minimum time
o Domain and application knowledge.
o Effective communication
o Curiosity / Willingness to ask questions
o Maturity
In addition to the courses being conducted in colleges, there are industry accepted
certifications that help aspirants to build career in testing
1.6 Summary
We discussed that every software applications will have defects due to multiple reasons
such as a) complex business requirements or technology, b) communication issues in the
large teams, c) ambiguous or incomplete requirements provided by customer, d) quality
and experience level of team members involved in the development of software and e)
every human being is prone to make mistakes however good the developer is.
These mistakes results into defects in the software solutions and if not detected and
removed from the software before it goes into production for customer/end-user use, can
lead to failure of the system. The impact can be small or in some cases it can be very
high – loss of life, prestige, money, social loss, time etc. In today‘s world, customer can
move to competitors if they are not satisfied with the quality. We also discussed that cost
of quality can be divided in to 3 categories – Failure Cost (cost of rework, replacement,
business loss etc), Appraisal Cost (cost of reviews & testing), and Prevention cost (cost
of training, process implementation, reusable components etc.). Total cost of quality can
be reduced if we focus more on appraisal and prevention.
Customer expectations are continuously increasing and in highly competitive environment,
customers expect high quality software applications with latest features implemented
quickly and at lower cost.
SW testing requires time and effort. It is hence best to avoid any mistakes so that defects
are prevented. But since defect cannot be prevented completely, they need to be identified
and removed as soon as possible and certainly before it goes into production environment.
SW testing hence is an unavoidable activity for any software developed. The level of
depth with which the testing should be done will depend on the criticality of the
application and potential impact due to defect.
So, testing / reviews are extremely important though all applications may not be tested
with equal importance. It is however practically impossible to test each and every possible
combination of data. We may have to apply some techniques and guidelines to limit our
combinations and hence it is practically impossible to detect all the defects. There are also
some other aspects one need to remember that testing shows presence of defects and not
absence. So, no one can prove that a specific application is completely error free.
So Primary objective of testing techniques and processes is
“To find greatest possible number of errors with a manageable amount of efforts applied over a realistic time
span with a finite number of test cases”.
Lastly we also discussed that, there could be quality issues in testing also. Hence, quality of
testing also needs to be measured. Accordingly we discussed about some metrics such as
coverage metrics (% of requirements / test cases covered), Process Metrics (% of defects
could be found at each level/phase), Productivity metrics (eg. Number of test cases
created, Executed, automated per hour).
Anyone who is aspiring to become a good developer or tester needs to hence understand
and implement testing techniques at different testing levels and processes along with
various soft skills.
1.7 Exercise
Sr. Question
One cannot test a program completely to guarantee that it is error free.
1.
T/F?
2. Why is SW testing important?
If testing is done by independent team, it is possible to say that the SW is error free or
3. not.
T/F?
We should not do much testing because it takes lot of time and effort. True/False?
4.
Why?
5. Why all software applications have defects. Provide reasons.
6. Name 4 important skills required by tester
7. What is the basic purpose of testing?
8. What is the objective of using SW testing Techniques and processes
Name 4 typical types of errors found in SW along with possible reasons for those
9.
defects
10. What are the typical challenges in SW testing (why exhaustive testing is not possible)?
11. If there are good programmers, software may not have any defect (T/F?)
There is a two character code. The 1st character can contain alphabetic values and the
12. 2nd character can contain alphanumeric values. This can result into ______ valid
combination of data inputs.
13. A software defects may result in loss of life also (T/F?)
14. Mistake is same as failure (T/F?)
The word 'bug' is synonymous with which of the following words?
15.
a) Incident b) Defect c) Mistake d) Error
There is no harm if a piece of code remains in the program even if not required in the
16.
updated version (T/F?)
17. No software code can be proved to have no errors (T/F?)
Objective of V&V process is to find the ________________ errors with a
18. manageable amount of ______ applied over a realistic time span with a finite number
of test cases.
19. Explain Cost of quality
20. Briefly explain limitations of Testing?
21. All software applications should be tested with very high and equal importance (T/F?)
22. Testers need to have good logical reasoning skills (T/F?)
Sr. Question
23. Is Exhaustive testing possible? Why?
24. Briefly explain why one can choose software testing as a career
25. Briefly explain why a developer should also have testing knowledge
Testing Types: We test what is required. Testing types depend on requirement types
and there are two major types of requirements
Functional Requirements – Functional Testing.
Functionality and Features: What the system should do or how it should work. So, it
includes Business Processes; rules and constraints, User Interface (Forms, Reports),
Interfaces with other systems. For example, Bus Reservation, Accounting, etc. The
document which describes what the system should provide and how it should provide
is called specification document
The Objective of functional testing is to verify that each functionality and feature of
the software application / system operates in accordance with the functional
requirement specifications. To check that it delivers what is expected. It has only
one of the two possible results –met or not met
Non-Functional Requirements – Non Functional Testing
This comprises of qualitative aspects of the system such as security (not allowing
unauthorized persons to access the system or data), performance (respond very quickly
to customer requests), usability (easy to use with good look & feel) etc. Even if system‘s
functionality and features work perfectly fine but if it gives response for a simple
request after say 30-40 seconds or the unauthorised user is able to get into the system
and disturb some processes or get access to some secured data, user will not like it.
Testing of such non-functional requirements is called non-functional testing.
Non-functional issues are derived based on the experiences encountered while running
the software in an environment similar to production environment. The outcome of
these tests is not just ‗met or not-met‘ but ‗the extent to which the expectation is met‘.
It also includes System management issues such as Installation, Portability, Backup &
Recovery, Start-up and shut-down etc.
There is a separate chapter dedicated to explain testing types and particularly non-
functional testing types in detail.
Work Products: Software development and Software testing is an intensive activity
requiring many phases as discussed in previous section. At the end of each phase some
documents are generated such as Requirement specification document at the end of
Requirement Analysis phase, Function specification document at the end of high level
design, UI design, database design, program specifications etc.at the end of detailed design
phase and actual program code, database etc at the end of development phase.
Similarly, Test plan, test design, detailed test cases etc are documented and delivered at the
end of test design phase. Test reports, defect reports etc are documented and delivered at
the end of test execution phase.
All these documents are termed as work products. These are kind of intermediate
deliverables from different teams and generally used for further project execution.
Testing: Testing; in simple terms; is a process of executing the program or application
with an intention to find errors. However we had seen in section ‗1.1.4 Cost of Quality‘,
and as we will discuss in detail in subsequent chapters, we can‘t wait for the application to
be fully ready for testing. We need to focus on each and every stage to identify all possible
issues which could result into defects/bugs in the application. Technically speaking Testing
has a limited scope but it is also normally used as a term that covers all the aspects.
So, Testing is the process consisting of all lifecycle activities, concerned with planning,
preparation and evaluation of software products and related work products to a) determine
that they satisfy specified requirements, b) demonstrate that they are fit for purpose and c)
detect defects
Hence, Testing is a process not only done on code but on all software work products
across all life cycle activities, requiring proper planning, preparation and evaluation.
Activities done to ensure that defects are prevented in the code are also termed as Quality
Assurance activities.
At the end of testing process, we are expected to check that
Software requirements are implemented completely and correctly. Requirements
include, Contractual or legal requirements, Functional, Non-Functional, Operational
and procedural requirements or Industry specific standards
And it performs no unintended functions –system does not do what it is not supposed
to do.
If any of the above does not meet, means there are defects in the software. The most
damaging defects are the ones, which could not be discovered during the testing process
and therefore remain when the system goes live. So, testing does not restrict the execution
of program in a normal manner to see it works but involves some tests with some
abnormal inputs and actions to see that it does not behave in unexpected manner with
those inputs/actions.
In simple terms, Testing is a process of finding errors. It can involve
Positive Testing (Tests-to-Pass): check that the application behaves normally as
expected with normal and legal input data. We can also term these tests as test-to-pass
testing
Negative Testing (Tests-to-fail): Check that the system does not do things that it is
not supposed to do when invalid or illegal data provided. And also check that system
responds with required error messages for such abnormal or illegal data inputs. It has
been observed that most errors are found here. We can term these tests as Test-to-fail
testing. Tester has to be destructive who can make the system fail.
Example Password textbox should accept Password textbox should not accept
Scenario
6 character length 5 character length
20 character length 21 character length
With 10 character length 10 characters with no special
character
Including at-least one
special character (as per
rule)
Priority: Test-to-Pass test cases could get higher priority with an assumption that
application must provide required functionalities correctly. Test-to-Fail test cases
could take lower priority.
A test condition is simply something that we could test. Tests or test conditions are
derived from requirements, a technical specification, from the code or from business
process. For example, Password must contain between 6 to 20 characters and must have at
least one special character. These source documents are often known as test basis.
Sometimes tests can be based on an experienced user's knowledge of the system, which
may not have been documented.
Test case: A set of input values, execution preconditions, execution steps, expected
results and execution post conditions developed for a particular objective or test condition,
such as to exercise a particular program path or to verify compliance with a specific
requirement. [After IEEE 610]
For every test you need to prepare and document a test case covering
o What is the purpose of the test – Eg. Ensure the validity of password as per rule
o Precondition: In which state the application should be before we carry out the
test. Eg, application is already invoked, and login page is displayed.
o Which input details to be provided – Eg. ‗abcde‘
o What is the expected output/response from the application – Eg. The system
should display error message saying password must contain at least 6 characters.
You may have multiple test cases for a given test condition (requirement). For example,
to test that number of passenger field inputs only numeric value, we will prepare a test
case as given below.
Purpose: To Ensure that field number of tickets do not accept any character other than
number
Precondition: Application is successfully logged in and ticket booking form is already
opened
Inputs and expectations
Input Expectations
4 System accepts the input
Blank System Displays Error message
Test cases could be documented in Excel or using any other tool. Please also note that
test cases may include many other details apart from what is described above. Those
details are explained in Test design section of chapter 6 – Testing execution process.
Test cases need to be developed, reviewed and managed (keep updating as required) on
an on-going basis.
Testing
Techniques
Static Dynamic
Testing Testing
In order to meet objective of finding maximum defect in minimum time and effort, we
have to select a subset of all possible tests (combinations) and still, it has to have a high
probability of finding most of the defects in a system. It should also avoid any
redundant test case that can find same defect which could be found by other test case.
The test design techniques provides guidelines through which we can focus on all
potential errors and restricts number test cases to essentially required for testing. They
help us to optimize the testing – Not too much and not too less testing.
Note that every application can be viewed from developer‘s angle and from business
angle.
Developers View – the way developers look at the system focusing on how the
requirements are implemented in terms of modules, programs/functions/classes,
constructs and statements used.
Business View – the way the end users look at the system for the usage. They see
Application home page, links menu options, forms and reports etc. They do not see
what is behind and how the content of the pages, forms and reports are done.
The items which are to be tested hence depends on both these views
Please note that test design techniques showed at level one are generally used during
Unit and Integration testing and shown at level 2 are generally used during Validation,
System and Acceptance Testing. We will discuss all these techniques in details when we
discuss testing levels - Unit, Integration, system and acceptance testing.
Test level: A group of test activities that are organized and managed together. A test
level is linked to the responsibilities in a project.
Unit Testing, Integration Testing, Validation and System Testing and Acceptance
Testing are called levels because they describe level at which the testing is done. You
start with Unit Testing which is lowest level and keep moving at higher levels to
integration, Validation and system testing and finally Acceptance Testing.
To reduce cost of testing, it is suggested that as soon as any component is developed,
unit testing for that component should be done. As soon as some integration of two
or more than two components take place, integration testing should be done and
system testing should be done when entire system is ready. Users should carry our
User Acceptance Testing only after Unit, Integration and System testing are
completed.
Testing at each level helps to identify and fix as many defects as early as possible so
that next level gets cleaner code and one can focus only on the specific aspects of the
next level when next level testing is done.
All testing activities at each level are organized and managed together and generally
activities of two different levels are not organized together. However, Test levels can be
combined or recognized depending on the nature of the project or system architecture.
For example, for the integration of a commercial off-the-shelf (COTS) software
product into a system, the purchaser may perform integration testing at the system level
(integration to infrastructure, and other systems or system deployment) and acceptance
testing (functional or non-functional and user and / or operational testing)
Refer to the design phase of SDLC where it is depicted how business functions are
realized using technical components. Also refer to Developer‘s view and Business View
depicted above. Keeping that in mind the testing is suggested to be done in following
sequence.
1) Technical testing – This is generally done using White box testing techniques
a. Technical Unit Testing – Testing of each procedure, class, methods or any
such unit
b. Technical Integration Testing – Testing of interfaces between various
technical components
2) Business functionality Testing – This is generally done using Black-Box Testing
techniques
a. Business Unit / Function Testing – Testing of each business functional unit
such as view flights, book ticket, cancel ticket etc.
Field level testing (testing of each element on the input screen) – Testing
of each field / element on the page/screen/form
Business Function / Form Level testing – Testing that a specific form
is successfully saved, can be edited, can be cancelled/deleted successfully.
For example a ticket can be booked, can be viewed, edited and or cancelled
successfully as per the process and rules defined.
b. Validation & System Testing: testing an integrated system to verify that it
meets specified requirements. This is done after all the components/units are
developed and tested. When individual business functions are tested, we do not
worry for any of the upstream components or downstream components as they
may or may not be ready. However when we do system testing, all the units are
available and hence possible to carry out testing.
teams may not have enough time to complete all the testing. In such case, functionalities
and tests are prioritized based on various risks associated with those functionalities in to a)
Must test b) should test c) could test and d) won‘t test.
Complete testing for functionalities, which must be tested, and then focus on other
functionalities as per priority if time permits.
Software Testing Life Cycle
Testing is an immense activities and like there are Software Development life cycle (SDLC)
phases, there are SW Testing Life Cycle (STLC) phases that covers
Test Strategy development: Considering scope and expectations of the application under
test, strategy is prepared that answers questions such as - which type of requirements will
be covered, what level of testing to be done, the rigor at which the testing to be done,
which testing techniques to be applied, which tools to be used, whether to use automated
testing and risk based testing or not etc.
Test Planning involves, people, schedule, roles and responsibilities, communication
process etc.
Requirement Analysis and Ambiguity Reviews: Analyze the requirements, itemize
them into individual testable requirements and identify if there are ambiguities in
requirements.
Test Design: Identify and list down all test scenarios for each test type and test level
Test Construction/Test Case development: Derive and document detailed test cases
describing the state in which the system should be for a specific test, various steps to be
followed and various inputs to be provided at each step and the result expected at the end
of each step or the entire test case. Develop Automation scripts if automation to be done
and carry out risk analysis and prioritize tests, if in case risk based testing required.
Test Execution and Defect management: Run the application and execute each test
case to actually check whether the actual result is as per expectation or not and if not
report defect. Continue the process till all known defects are fixed, retested and closed.
Debugging means removing errors from your programs. Before we debug the program,
we need to find errors and that is testing. So, Testing is different from Debugging.
Functionality
Secure
Compatibility
This example shows that, even for a very well-known product, that we use from our
childhood, we are not able to come up with all the aspects to be covered for testing.
You will also see that many aspects are related to specific component of the pen and may
not require the entire pen to be assembled before we do testing of those aspects
Unit Testing: Checking / Testing of individual component of the product or application
Integration Testing
Conclusion:
SW is no different than pen or any such product. You need to do all types of testing for
software as mentioned for pen
o Requirement Coverage is key for any product. You need to get clarification if
was not provided by your relative
o There could be some explicit requirements and some implicit requirements
(which will not be conveyed by customer)
o There are functional (able to perform it‘s basic task properly) and non-functional
requirements (qualitative aspects)
o One need not wait till the final product is out for testing - Intermediate
components should be tested before it goes into final product
Look at the following diagram that shows how reservation functionality is decomposed
into various business functions and technical functions (boxes which are highlighted).
You can notice that many technical components are reused for different business
functions. These are just sample business functions. There could be even more
business functions such as register boarding of a passenger can call many of the
components. Since each component needs to satisfy requirement of calling function, it
could receive some parameters from the calling function to actually work as required.
So detailed design will also include how different components are integrated with each
other (Through parameter passing or back-end data storage and retrieval or direct calls)
to complete one specific task.
There could be integration with other modules also. For example, Ticket reservation
module will internally call accounting module for the payment made by the user. It can
also be integrated to Agent module if the booking is done by an agent on behalf of the
passenger so that commission processing can be done accordingly.
Program Specification: Once detailed design is completed, program specifications
are prepared for each program or a technical component we discussed above with the
use of details described in detail design. It provides foundation for the programming
methodology to the developer and gives details of what the computer program is
expected to do. It covers user interface, what inputs to be taken, what processing to be
done, what is to be stored in internal/external storage, interfacing details, what output
to be generated and presented. For example, Program Specification for login page will
provide
o UI screen design for Login page covering User ID, Password, Submit button,
change Password button
o Rules for password, changing password etc
o Where to check (which database table) correctness of password
o What to do if details are not valid and which page to be displayed when details
are valid
Development / Coding: Actual coding of various programs done using a specific
programming language. Here as a developer you use syntax of the language and various
programming constructs such as If… Then … Else, Loops (While, Do ..Until, For), in a
specific sequence.
Also note that whole application cannot be developed at a shot. Application is
collection of different components integrated together for a specific purpose. As part
of development process, first individual small components/programs/routines (called
units) are developed. Integration of these components happens as more and more
components get developed and when all components are developed and integrated, we
get a full system.
Testing: The software is tested for it‘s correctness and completeness from requirement
perspective during this phase.
SW Testing requires effort and hence cost. The amount of money we spend on testing
should not be more than the benefit (or the cost we avoid due to faulty software) we
receive. It is hence important to see that the cost of testing is as low as possible.
So instead of waiting for coding to be completed for entire application, Unit /
component testing should be done as soon as specific unit or component/program is
developed. Integration testing should be completed when two or more units are
developed and individually tested. And System testing should be done once the
development is completed for entire system. Finally, User Acceptance testing should be
done by users or user
representatives.
a frequent flyer (and hence was given a card members get 5% discount and gets
gold card) should have got 10% discount additional 5% discount if they book more
but he actually got only 5% discount than 3 passengers in single ticket. The
program was not coded properly to
implement this rule correctly.
9. The airline once realized that information Their registration process was weak and
of their passengers including their contact someone could inject a full query (to
details etc were leaked to competitor. access passenger details) through UI of
the registration form.
In general, some typical defects we notice in many applications are as given below
Defects related to input
o Allowing characters for fields accepting numeric values
o Allowing more number of characters to be entered than system actually allows
o System assumes some value when user do not input
o Some inputs which are mandatory are not taken resulting in wrong process
Defects related to Processing
o Processing logic or formula not correct (Eg. Loan processing, Balance
processing, Seat allocation process etc.)
o Business rules are not correctly taken care of (Eg senior citizens should be given
discount but not given)
o Application not properly interfaced with other application correctly (Eg.
Payment interface)
Defects related to Output
o Required information not printed completely or correctly
o Details not organized properly or in consistent manner
As you can notice from above examples, defects may be related to Functional or Non-
Functional requirement (eg. Speed, Security etc). Defect could be due to incorrect
understanding and implementation of business processes and rules or due to incorrect
coding – logical issues
Errors could also be due to environmental conditions, use of the system by hackers.
Defects are introduced in every phase of phase of SDLC. As per ‗Defect Amplification
Model‘ described by Pressman, errors get amplified by some factor if that error is not
removed in that phase only. In fact the cost of removing error will keep increasing if the
gap between introduction of error and removal of error increases.
Also note that some bugs are just the tip of the iceberg. So, if you find one bug and when
you really do root cause analysis, you may find many more bugs.
Cost of fixing the defect increases when it is found later as root cause analysis and
correction may be required at all previous phases. For example, if it was discussed during
It is also important to consider that a relatively minor error left early in the process can be
amplifies into a major set of errors later. Study following diagram showing increase in cost
based on data collected by Bohm and Basil [Boe01b] and illustrated by Cigital [Cig07]. The
cost is an industry average cost
While the actual cost may vary from project to project, it is important to know that cost of
testing (finding and fixing defect) later is much higher (some time exponentially higher)
than cost of testing and finding defects early. There is tremendous intangible loss if
customer faces defects. We may lose customers to competitors
The cost of testing itself should be lower than potential loss of not finding the same. So,
Testing must end when the economic returns cease to make it worthwhile i.e. the costs of
testing process significantly outweigh the returns.
It is hence important to reduce cost of testing by discovering and removing defects early in
the life cycle and also reduce overall cost by taking measures to prevent the defects getting
introduced.
2.4.1 V Model
The diagram given below which depicts SDLC phases on the left side, Testing levels on
the right side and relationship between them through.
Wishes
/ Idea
Development Activities Testing Activities
1
1 9
User Requirement Validates
Acceptance Testing
Specifications
2 Software Requirement 8
Validation, System 8
Function Specifications Testing
Verifies
3 7
Architectural Design Integration Testing
Verifies
4 6
Detailed Design / Unit Testing
Program Specs Verifies
5
Coding
We will discuss Verification and Validation, Testing levels and testing techniques used at
each level in next two sections keeping this diagram in mind.
As you can see in the above diagram there are four main SDLC phases. After each phase
you carry out low level checking or verification to ensure that the phase is completed
accurately in accordance with previous phase and as per the defined processes. For
examples, once all the user requirements are collected and documented, a review takes
place to ensure completeness, clarity and correctness of the requirements. This is known as
verification for requirements. Users will be accepting the final application based on these
requirements and hence, Requirement Specification documents become input to
Acceptance Testing which is the last phase/level from testing perspective.
After requirement analysis is completed and documented, function design or Software
Requirement specification is done for the application being developed. Again detailed
review takes place to ensure that design is being developed in a right manner as expected,
taking Requirement Specification Document as input. The system once fully developed
will be tested based on this functional design. Hence, Functional Specification document
becomes base for Validation testing.
Similarly Architectural design phase delivers high level design document which becomes
input to program specifications for development and input to Integration testing phase for
testing.
Program specifications or detailed design are prepared based on architectural high level
design and are referred for unit testing.
In general, you start from upper left SDLC phase on top and move down to next phase
below and once coding is completed based on program specifications, all testing levels
starts from Unit Testing and then moves up on the right side to Integration testing,
Validation & System testing and finally Acceptance testing.
As you can see, this forms V shape and hence this model is popularly known as V model.
The V proceeds from left to right – top to bottom, depicting the basic sequence of
development and then once coding is completed it proceeds from left to right – bottom to
top, depicting basic sequence of software testing levels and their dependence on SDLC
phases
You can notice several characteristics of good testing in the V model.
For every development activity there is a corresponding testing activity
Each test level has test objectives specific to that level
The analysis and Design of tests for a given test level can begin during or immediately
after the corresponding development activity
Testers can be involved in reviewing documents as soon as drafts are available in the
development life cycle.
Is a set of activities to ensure that the work product correctly reflects the expectations
specified
Examines the work product of each development activity to ensure that it meets the pre-
defined set of requirements and standards. So, at each stage, the team needs to ensure
that whatever they do is in conformation to previous stage – Design should conform to
requirements, Program specifications should conform to design and Code should
conform to program specification. Integrated components should conform to
architectural design.
In general review/analysis of all the phases shown on the left side of the V model and
even unit and integration testing shown on the right side can be termed as verification.
Refer section 2.4.1.
Related activities are considered to be lower level of test activities as they are done before
the code construction is completed.
It primarily uses static testing methods such desk-checking, inspection, walk-through and
does not involve execution of code. Some amount of execution do take place during unit
and integration testing.
It is also called a Quality Assurance/improvement process as the issues are identified
and resolved before the development/coding completes, preventing defects getting into
the fully developed code.
Activities are normally conducted by development team – generally by expert, lead or any
other senior person
Is an approach for ensuring that we are doing things rightly through the process and it
answers the question – ―Are we building the product, Right?” – Is our construction
process correct?
Validation (Have we built the right product?) – This refers to the processes involved to
ensure that the product already developed meets customer requirements. Even if the current
product developed, does not have any issues (as all issues were resolved based on
verification process implemented) may not meet the exact/all customer requirements.
Validation testing starts once the development activity is completed.
So Validation
is a Dynamic process (by executing the code) of validating/testing the actual product
developed against customer requirements
targets actual product developed – generally the entire system depending on the test
conditions
is known as Quality Control process, as the defects were already there in the code
developed but are found and removed before the application goes into production.
is aimed to ensure that the software is traceable to customer requirements by testing
under actual or simulated user conditions. It confirms that the product will fulfil its
intended use and answers the question – ―Have we built the right Product?‖
These tests are generally conducted by independent test team and users also get involved.
It can catch errors that verification process cannot
• Mindset Change – To prove that SW does not work and not to prove that it works –
Aptitude towards identifying problems and work until resolved
• Technical Independence.
– Business/user perspective
– Unbiased review
– Budget set aside for QA is not cut just because AD eats up more budget
2.6 Summary
In order to ensure that quality is getting built from the beginning of the software
development, we need to align softer testing activities to Software Development Activities.
All the software development models (Waterfall, Incremental, RAD...) include some
standard phases of software development executed in specific order as specified by the
model. These phases include – Requirement Analysis, Design (Functional
Specification, Architectural detail design, Program Specifications),
Development/Coding, Testing and Implementation. Most applications are
decomposed in to module and components (business or technical) (Procedures / functions
/ objects / APIs / Web Services…).
Similarly Testing is again divided into different testing levels – Unit Testing, Integration
Testing, validation & System Testing and Acceptance Testing.
Software testing is very similar to testing of any other product such as pen.
We then covered various standard terminologies used – Software, System, Business
Function/transaction, Defect. Etc.
In simple terms testing is a process of finding errors so that we get confidence that the
software has implemented all the required functions correctly and completely and does not
give unexpected output.
Testing can involve positive testing (application should behave as expected when valid data
provided) and Negative Testing (application should not do things when it is not supposed
to do when invalid data provided).
We also discussed some important terms in little more details such as
Testing Types: It indicates what (Which aspects) do we test. There are two primary types
Functional: To check that all the functions (business functions) are working
correctly as expected
Non-Functional: To check qualitative aspect – How good these functions are
implemented. So it covers Security, Performance, Usability, compatibility etc.
As part of the testing process, we need to develop test cases based on test conditions. Test
condition is something that we could test and test case covers a set of input values,
execution preconditions, execution steps, Expected results and execution post conditions.
Testing Techniques: Testing can be done without executing the program (by reviewing
the document/code) which is known as Static Testing and by executing the program
which is known as Dynamic testing.
Test Design Techniques: Testing is an immense activity and requires lot of time and
effort. Primary objective is to find defect and if hence it is important to ensure that we
cover all possible scenarios that can result in defect and avoid unnecessary tests which
do not have potential to find new /different defects. There are various techniques
(guidelines) developed keeping in mind two different angles of the software. The internal
view and the external view. Techniques based on internal view (focusing on actual system
architecture and code) are known as White-Box test design techniques and the techniques
developed for the external / business view are known as Black-box test design techniques.
In order to find defects early testing should start as early as possible. Testing Levels:
Unit testing is done as soon as specific program or unit of the application is ready,
Integration testing is done when more than one unit-tested programs are integrated for
their interface related requirements and validation and System testing is done when the
entire system is ready for ensuring that various business functions are correctly
implemented through more than one interfaced programs. Lastly Users do Acceptance
Testing. Unit and Integration testing is again done from technical perspective and from
business perspective.
We also briefly introduced Regression Testing which is done to ensure that any
changes/enhancements done in the application does not introduce new defect and because
of that any functionality which was working earlier does not work now as expected.
Even after applying various techniques, we may not get enough time and effort to cover all
the test cases in our testing. We need to hence either automate some tests which are
expected to be run more frequently with every release or we may have to do Risk based
testing, whereby we prioritize the tests in order of importance so that we can skip non-
important tests if time is not available.
Like Quality of development is important, Quality of testing is equally or even more
important. Process oriented organization collects various product and process related data
to generate some quantitative measures known as metrics to check the quality of
testing. This includes coverage metrics, Process Metrics and productivity metrics.
Since entire testing process needs to cover all types, all levels, apply various techniques, it
become a huge project and needs proper planning and monitoring of various activities.
Validation and System testing particularly requires various SW Testing life Cycle phases
to be followed in a planned manner. These phases include - Requirement Analysis and
Ambiguity Reviews, Test Design, Test Construction, Test Execution with defect
management and closure activities.
While planning and implementing all these activities we will keep the seven principles in
mind.
In order to ensure that the system is being built correctly, we do various verification
activities at the end of each phase or testing level (Are we building the product right?) and
once the full system is developed, we do Validation against customer requirements (Are
we building the right product?). Verification covers reviews / inspection of all the
deliverables of each SDLC phases. Validation is a post development testing activity to
ensure that whatever we develop is as expected by the user. Each SDLC phase on the left
side of V model is linked to the testing level depicted on the right side.
There are seven generic principles one need to keep in mind for any type of project
1) Testing shows presence of defects, 2) Exhaustive testing is impossible, 3) Early
Testing, 4) Defect Clustering, 5): Pesticide Paradox, 6) Testing is context dependent, 7)
Absence of errors fallacy
2.7 Exercise
Sr. Question
1. Give at least 4 difference between positive and negative testing
2. Testing which checks what system should not do is known as ___________ testing.
What is the difference between Functional and non-functional requirements? Explain
3.
with examples
4. Cost of testing later is _______ than cost of testing early.
It is not necessary to check that the software does not do what it is not supposed to do
5.
(T/F?)
6. There are two testing techniques _________ and _____________
In a quick testing you have done, if you find more defects in one specific module, you
7. can conclude that further testing will reveal more defects in other module.
True/False?
8. What is the difference between testing and debugging?
Testing is in a way a destructive process.
9.
True/false
The probability of the existence of more errors in a section of a program is proportional
10. to the number of errors already found in that section.
True/False
11. Unit testing is done based on program specifications. T/F?
12. Verification is other name of Validation
13. Discuss Verification vs Validation with suitable example
14. ___________ means to check Are we building the right product?
15. Draw V Model diagram and explain what arrows going to Validation Testing indicate?
16. Functional specification/design is input to system testing. True or False?
In the overall system development life cycle, which team are involved in which type or
17.
level of testing, why?
18. Considering V Model, explain what are the basis (Inputs) for each testing phase
What are the testing levels? How do they relate to development phases in waterfall
19.
model?
Communication issues – There are three basic communication issues that can result
into incomplete / wrong understanding of the requirements
o Omissions – Generally, system under development has many users and
requirements are to be gathered from many of them. Many requirements either
are missed out, because some of the users do not have enough time or simply
forget.
Requirements not commonly used are generally missed out.
Focus is generally given on what happens and what is not supposed to
happen is missed out.
Omissions occur on the receiver side also. No human being can grasp 100%
requirements.
o Untold assumptions –The provider of the requirements and the receiver of the
requirements both take some assumptions. These assumptions if not right, may
result into bugs.
o Misunderstanding – Everyone has different level of knowledge and
background and likely to misunderstand what is provided. Misunderstanding
also happens if the requirements are ambiguous.
Criticality, Priority not provided – Most projects get into quality and timeline issues.
Clear understanding of criticality or priority of the requirement help in such situations.
However this information is not generally available.
Let us take one small example to understand these issues
User: I want a small vehicle to travel in the city
Developer: assumes a bicycle would best suit and conveys that it will be ready in a
month‘s time and starts building bicycle
After 2 weeks, User says – ‗By the way, it should be able to transport 4-5 people even
in the rains‘ – (He assumes a kind of a car)
Developer has already started building a bicycle so he just modifies the designs to
extend the middle rod to accommodate 4 seats between two wheels.
The example does not appear to be realistic but in software industry, something similar is
very likely to happen.
discuss various ambiguities in the above requirements after understanding different types
of ambiguities.
Following are various reasons because of which ambiguities arise. We may also refer them
as different ambiguity types.
Sloppiness: absence of due or proper care or attention
Example: Following paragraph is written in an airline safety booklet (found in the seat
pocket)
―If you are sitting in an exit row and you cannot read this card or cannot see well
enough to follow these instructions, please tell a crew member―.
If this is the only mode of communication to the passengers then there is an issue
because if the passenger cannot read properly, then he/she cannot read the instructions
provided in the booklet. So how can he/she tell crew member? Such instruction hence
should be provided verbally.
Linguistic Ambiguity
One half of two and four = ??
One may consider the answer to be 3 if you assume One half of (two and four) or
One may consider the answer to be 5 if you assume it to be (one half of two) and
four.
The answer can be even different if meaning of ‗and‟ is assumed to be multiplication
instead of addition.
Dangling Else
The requirements which uses any of MUST BE, WILL BE, IS ONE OF,
SHOULD BE, COULD BE, CAN BE, SHALL will result in ambiguity as there is
no clarity what should be done if this is not true (Else part is not clear)
Example:
―The loan type should be first or second.‖
Question: What should be done if the loan type is different? Should an error message
be displayed and allow for correction or the processing should be stopped? The
requirement is incomplete if this question is not answered.
Ambiguity of Reference
Many times some statements are used which refer to some details provided earlier in
the document. If the reference is not explicit, the understanding can be wrong.
Example: ―Add Amount to Account-Balance. This number must be positive.‖
Question: Which number must be positive? Amount or Account-Balance or both?
Example:
―Transaction 1 displays the customer‘s name and address.
Transaction 2 displays the customer‘s account numbers.
Transaction 3 displays the customer‘s account balances.
Such transactions require the security code.‖
Question: Which transactions require security code - only transaction 3 or all the
above transactions?
Omissions
Applications generally produces some output (effects) based on some type of inputs
(causes). However it is likely that one of the causes or effects may be missing.
Causes without effects: Sometimes requirements are described such that effect is
given for some causes but not for all. In other words, impact of certain inputs are not
provided
Example. ―Code could be 1,2,3,4 or 5. Codes 1 through 4 produce the message.‖
Question: Should the message be produce when code = 5 or not? If not, what
should be done?
Effects without causes: Sometime effects are given but which cause is resulting into
the effect is not provided
Example. ―This message sometimes appears.‖ –
Question What exactly you mean by sometimes – 10%/50%/80% times? And
under which specific situation the message should appear?
Example ―It is sometimes necessary for the operator to re-initialize the field.‖
Question: It is given that operator should re-initialize but not clear when exactly it
should be done
Complete omissions
Example: A Blank Line/Para/Page
Certain paragraphs may be missing or the page is completely blank
Question: Are there any details really missing or the page is intentionally kept
blank?
Missing causes: Sometimes real cause is missing
Example - ―If you drive through a red light you may get a ticket.‖
Missing - you must be caught doing it to get a ticket
Example- ―If the number is 1, 3, 5, 7, 11, 13, 19, 23, or 29 it is a prime number.‖
Missing - 2, 17. They are also prime numbers.
Missing effects: A cause can have multiple effects. Not all are provided.
Example - ―If the account is overdrawn reject the check.‖
Missing - notify the customer.
Ambiguous Logical Operators
What people write “A and B produce C.” :This is confusing and may be interpreted
as
A and B each produce C -> If (A or B) then C
Or ―A and B together are required to produce C ->If (A and B) then C.
Confusing Compound operators
―If A or B and C produce D.‖
This is also confusing. If [A or B] and C produce D? OR If A or [B and C] produce D?
Ambiguous Statements
Ambiguous verbs: Calculate, update, produce, modify:
Example: ―If it is month end calculate the interest earned.‖
Question: What is the exact formula to calculate or what exactly to be updated?
Ambiguous variables:
Example: ―If the interest amount is greater than $100, send notice to the customer.‖
Question: Which Interest - Interest accrued? Or Interest earned? Or Interest paid?
Or Interest anticipated?
Ambiguous adjectives:
Example: ―It is against the law to ride down the street on an ugly horse.‖ Law in
Wilbur, Washington
Question: How to decide which horse is ugly? What is the actual meaning of ugly.
Ambiguous adverbs:
Example: ―The delete transaction must be processed quickly.‖
Question: What is meaning of quickly? 5 seconds/ 5 minutes/ one hour?
Example: ―Field A is usually positive.‖
Question: What is meaning of usually?
So, there are multiple reasons and challenges because of which requirements may be
interpreted differently than expected and such ambiguities should be immediately clarified.
This process is called Ambiguity Review process. Many organizations consider this as a
very critical process and all ambiguities are sometimes termed as defects in requirements
and reported similar to defects.
Ambiguity review enables Timely feedback - early in development life cycle and hence
leads to defect avoidance
If you are expected to write requirements after gathering verbal requirements, then it is
suggested to use some tips as provided below
o Be sensitive to the language issue and use simple, straightforward words.
o Eliminate instances of careless writing so that requirements are not
ambiguous
o Ask non-domain experts to do ambiguity reviews so that you eliminate assumed
functional knowledge.
o Avoid Jargons or define various terminologies in the glossary.
o Define Acronyms in the data dictionary.
After having detailed understanding of how requirements could remain incomplete or can
be misunderstood, let us revisit the problem statement defined earlier in the section and
find out ambiguities
--------------------------------------------------------------------------------------------------------
The application allows user/members to book travel ticket online. The home page will
have a provision to either create a new account or to login with existing account. All valid
members (registered users) should be able to view various options for booking the tickets.
However even if you are not a member, you can see schedule between two locations.
There are three membership categories Silver, Gold and Platinum. Such card members do
not have to pay any reservation fees.
Any adult can create a new account by providing user ID and Password. Registration
form should input personal information – Name, Gender, Marital status, Birth date and
Contact details such as full address, phone number, and mobile number. Once registered,
user can book ticket online. The eTicket will be emailed to user. Gold card members get
sms in addition to email.
If booking is done for return journey or number of seats booked are four or more and
gold card member, you get 10% discount.
Company should have travel service from the locations specified. System should propose
and passenger can book tickets to nearby locations if there is no travel service between the
specified locations
Application/system should be user friendly and have a provision to provide help wherever
you feel important.
---------------------------------------------------------------------------------------------------------
Following are the ambiguities in the above requirement document
There are three membership categories Silver, Gold and Platinum. Such card members
do not have to pay any reservation fees. – Question: Which card members do not have
to pay reservation fees – Platinum or all the three?
Any adult can create a new account – Question: Which age to be considered for
considering adult? Note that different countries may have different rules. There could be
difference for Male and Female.
Registration form should input personal information – Name…… Question: What if
some information not provided? Which are mandatory and which are not mandatory?
Gold card members get sms in addition to email. Question1: Why only Gold Card
members? Why not Platinum? From our general understanding platinum category is
higher than gold category. So, if some benefit is given to gold card members at least
that much benefit should be given to platinum card members also. Question2: eMail is
sent to all types of members or only Gold Card members? Question3: Email ID is not
taken as input- Should it be added?
for return journey or number of seats booked are four or more and gold card member,
you get 10% discount.
Question: Which of the following to be considered?
(return journey or number of seats booked are four or more) and gold card member
OR
(Return journey) or (number of seats booked are four or more and gold card member)?
Passenger can book tickets to nearby locations. Question: How much distance is
considered as nearby?
You may also need to clarify some missing processing rules as provided below.
What is the process of becoming member? What are the criteria for each membership
type?
What is the cancelation process? Modification process?
…..
…..
You will now understand that some requirements which look almost fully understood may
have many ambiguities and if not clarified in the initial stage itself, can result in to incorrect
functionality.
We will discuss two important design aspects – Database Design and User Interface
design.
Relational database design such as table, Primary key, foreign key, relationship between
tables etc. It is suggested to quickly refresh your concepts if you do not have it.
Data Quality can be classified in to
Data consistency: ensuring that data is represented ―semantically the same way‖
within and across tables in a database system.
Data completeness: Ensuring that there is no missing or inaccessible data because of
inadvertently storing nulls, blanks and there are no partial data due to truncations.
Data correctness: Ensuring that corrupt or wrong data not stored; as well as, dirty
data not being shown to the user.
Let discuss each of them in details
Data consistency Issues
Loss Tables that are joined over Manish Patel works in the Mumbai
Projection non-key attributes will office in the Accounting department.
produce non-existent data that When a report is generated, it shows
is shown to the user. him working in Marketing and
Accounting.
Incorrect Data that is misspelled or 100 ft ananad Nagar Rd is recorded
Data inaccurately recorded. with 1) a spelling mistake Anand
Values spelled as Ananad and 2) feet and
road is abbreviated as ft and rd.
Disabled Null, non-unique, or out of The primary key constraint is
Integrity range data may be stored disabled during an import function.
Constraints when the integrity constraints Data is entered into the existing data
are disabled. with null unique identifiers or wrong
values
Misuse of Check, not null, or foreign key Check constraint only allows
Integrity constraints are inappropriate hardcoded values of ―Economy‖,
Constraints or too restrictive. ―First‖ But a new code ―Business‖
cannot be entered even though valid.
causes level, many other defects are prevented and hence it gives some kind of
assurance for the quality of the final product.
It reduces overall effort: Since defects and issues are identified early in the life cycle,
the rework cost is reduced.
It lays strict emphasis on conforming to specifications and standards.
Application readability and maintainability, quick customization and enhancements are
some of the key requirements of today‘s applications. So, application code should not
only meet the functional and non-functional requirements but the design and the code
logic should meet required standards established. These standards can be checked
during static testing.
It enables multiple perspectives from different people. Code Walk through and
Inspection techniques are group activities. Multiple people brings multiple perspective
at the same time improving the quality further
It saves computer resources – Since static testing is done without executing software,
there is no need to have complete environment (Hardware, OS, Database, Application
server etc.) set for testing.
It is Part of Formal Process models such as ISO 9001 and CMMI (Capability
Maturity Model Integrated). In order to provide assurance of quality to customers,
many software vendors implement established processes as defined under CMMI /
ISO models. Static testing is part of these processes as it provides confidence of good
quality from the beginning.
Exchange of information between the participants happens when the evaluation is
done by a team. Static testing is also educational/informational or communicational
as participants learn about the software work products which can help in understanding
their role and future plan of activities.
Reviews vary from very informal to formal (i.e. well-structured and regulated). Initially
informal reviews take place. In later stages these reviews become more formal often
involving more people and a meeting.
Note that in contrast to dynamic testing, static testing finds defects rather than failures.
Self-Review
Review is done by the person who is the author or who is responsible for a particular
program code
The author or responsible person is assumed to have better understanding of the code
and hence it is easy for him/her to review. It helps in eliminating some basic issues and
saves time of others during other testing
However self-review cannot find some errors, if the understanding itself is wrong
Self-review is an informal process and can be done while the development work is still
going on or immediately after developing the code
Independent Review
Review is done by the person other than the author of the program – may be colleague
or senior programmer or a lead.
It helps detecting human errors that can be missed during self-review.
Since independent perspective is brought, independent review is also viewed as a one
person inspection or walkthrough
Informal review is perhaps the most common type of review in practice.
Since it does not require large number of people it is often done on the desk and hence
sometimes also called Desk Checking
As part of this process a person reads a program or a document and checks it with respect
to standard error list and/or walks test data through it to find any errors. Corrections if
required can be made, there itself. There is no need to maintain any log for the issues
found. Since this is an individual activity, there is no need to prepare any schedule or
arrange for logistics. Since this is person dependent, it is less effective as it depends on the
experience of the single person involved in review.
The simulation also shows how different pieces of the system interact and can expose
awkwardness, redundancy and many missed details.
Participants are not expected to do detailed study of the document in advance
Due to involvement of expert review team members, the walkthrough process helps
not only in finding omissions of requirements, style or concepts issues, but also helps
providing approach to solution of the issues.
Sometimes, a new team member is also involved in the meeting. The walkthrough
process helps him/her getting relevant information of the requirement, design and
solution. Walkthroughs also helps understanding the product in absence of the
documentation. This knowledge can be useful to the new resources for enhancements
and maintenance or extract some approaches that could be useful in his/her own
development.
3.5.2.2 Inspection
Inspection is considered to be one of the most documented and formal review techniques.
Inspection is also a group activity.
The document under inspection is prepared and checked thoroughly by the reviewers
before the meeting, comparing the work product with its sources and other referenced
documents, and using rules and checklists. In the inspection meeting the defects found are
logged and any discussion is postponed until the discussion phase.
It is usually led by a trained moderator (certainly not by the author). It uses defined roles
during the process. It involves peers to examine the product. Rules and checklists are used
during the preparation phase. A separate preparation is carried out during which the
product is examined and the defects are found. The defects found are documented in a
logging list or issue log. A formal follow-up is carried out by the moderator applying exit
criteria. Optionally, a causal analysis step is introduced to address process improvement
issues and learn from the defects found. Metrics are gathered and analysed to optimize the
process.
The generally accepted goals of inspection are to:
o help the author to improve the quality of the document under inspection;
o remove defects efficiently, as early as possible;
o improve product quality, by producing documents with a higher level of quality;
o create a common understanding by exchanging information among the
inspection participants;
o learn from defects found and improve processes in order to prevent recurrence
of similar defects;
o Sample a few pages or sections from a larger document in order to measure the
typical quality of the document, leading to improved work by individuals in the
future, and to process improvements.
Note that the objective of this process is primarily to find errors but not to provide
solutions to the errors. It helps in ensuring that the standards and specifications are
followed, requirements are correctly transformed to the product and there are no side
effects apart from finding some other defects.
3.5.3 Comparison:
Following table provides comparison of the techniques
3.6 Summary
In this chapter we discussed verification activities for all the deliverables of the
development phases in detail starting from Requirement Analysis to coding.
Requirement Reviews.
Requirement Analysis and Ambiguity review is very critical / important as the output is
certainly going to be wrong if the requirements are not correctly and completely
understood. Unfortunately there are multiple challenges in receiving requirements and
hence there are lot of chances that requirements are either incomplete or ambiguous.
We saw various ambiguity types such as Sloppiness, Linguistic ambiguities, Dangling
Else, Ambiguity of Reference, Omissions (cause without effects or effects without
cause or completely omitted), Ambiguity of Logical Operators or Confusing
Compound Operators or even ambiguous variables, adjectives, adverbs etc.
In almost every project you will find many ambiguous requirements which are to be
thoroughly reviewed and removed (clarified). The process of using a checklist, writing
itemized requirements (small & simple) in our own language and verifying our
understanding of those requirements from the user is extremely critical.
Design Reviews
As part of this, we should do database design reviews for consistency, completeness
and correctness, User Interface design reviews for readability, easy navigation,
aesthetics, and appearance.
Code Reviews
We discussed various types of common mistakes we make during coding such as data
declaration errors, Data Reference Errors, Computation errors, Comparison errors,
Control Flow errors, Interface errors, Input / Output Errors and Errors related to
standards. Many of these errors would be difficult to find just by executing the code.
So, we need to do code review to identify such errors.
Process:
Subsequently we discussed that Static Testing technique are used which involves
Informal Reviews and Formal Reviews. Desk checking by self or independent
person or Walk-Through in a team or Inspection by experts/auditors are the
important approaches used as part of static testing. Desk checking is totally informal,
whereas walk-throughs are partially formal and Inspections are fully formal approaches
where a defined process is followed by team playing different roles of moderator,
author/presenter, recorder, auditors, manager etc. The process includes planning,
distribution, preparation, review meeting, recording feedback, rework and follow-up.
There are many advantages of static testing before any further testing is done such as
ability to discover many problems at once, find root causes at an early stage, prevent
further failures, meet the standards and hence reduce effort, time and cost of finding
defects at a later stage.
3.7 Exercise
Sr. Question
1. Understanding of requirement correctly and completely is much more
important than writing code very efficient manner (T/F?)
2. Why should testing be done at an early stage?
3. Provide main difference between Static vs Dynamic testing techniques
4. Name static testing techniques
5. For which kind of errors, Static testing is better?
6. Name 5 important aspects to be covered in Code review checklist
7. Who all could participate in code walk through?
8. Briefly describe code inspection process
9. Standard violation can be found using __________ Testing
10. Differentiate between Desk checking, walk through and inspection (at least 4
differences)
11. Provide at least five advantages of static testing techniques
12. Static testing is quality assurance oriented (T/F)? Why?
13. _______________and _____________ are the two types of informal reviews
14. Using static testing, you can discover many problems at once (T/F)?
15. What are the disadvantages of Desk checking?
16. Two third of 6 and 6 = ______ Options: a) 8, b) 10, c) Other, d) Cant' say
17. Describe how ambiguities occur and what care as a developer/tester we should
take?
18. Splitting complex requirement into smaller requirements to understand the
system is known as _________________ Options: a) Requirement Analyses,
b) Ambiguity Review, c) Test Design, d)Requirement Itemization
19. What do you mean by ambiguities? Explain any 4 different types of ambiguities
with examples
20. List four different types of challenges in requirements and explain briefly
21. Requirement says "There are three types of members- 1. Silver 2. Gold and 3.
Platinum. Silver card members get 3% discount. Platinum card members get
Sr. Question
6% discount". Is there any ambiguity/omission in the requirement? If yes,
what?
22. Study the following requirement
A student will be allowed to appear for the final exam if student has appeared
in all the internal tests or his/her attendance is >= 70% and has submitted all
the assignments
Is this requirement Ambiguous? Why?
23. Q.3 A file contains student‘s examination result for every test for every
subject. There could be more than one tests conducted for each subject.
Following routine reads each record of the file that contains student code,
subject code, Test Code, and Test Marks. Then, it calculates and displays
average marks for each subject of each student. Find out logical errors in the
routine and rewrite the correct code.
Sr. Question
There are three types of members for a club -Silver, Gold and Platinum. All
Gold card members are informed through email for any event that takes place
in the club
You can notice that some components (boxes to which there are two or more arrows) are
reused in more than one functionalities. These individual components are developed first
and hence each component should be tested as soon as it is developed to ensure that it
accurately servers its purpose for which it is developed. Once other related components
are developed and unit tested, they can be integrated as per architecture design and
integration testing takes place to check that they work together also correctly by ensuring
that the interface between them is proper. Once that is done, the full functionality such as
New Ticket booking or cancelling existing reservation are tested to ensure that they are
Nitin Shah Software Quality Assurance and Testing
Unit and Integration Testing with Structural based Test design Page:79
working as expected.
So, these are four levels of software testing. Unit Testing, Integration Testing, Validation
and System Testing and Acceptance Testing. In practice, there may be more, fewer or
different levels of development and testing, depending on the project and the software
product. For example, there may be component integration testing after component
testing and system integration testing after system testing. However the levels we will
discuss here are most general.
Unit and Integration testing is primarily done by development team themselves. We will
discuss details of both these levels of testing along with various test design techniques used
to carry out these testing levels in this chapter.
We had already discussed code review in section 3.4 which is done using static testing
technique. We will now discuss testing using Dynamic Testing technique (by executing
the program or a component)
4.2 Unit Testing
Unit testing / Component Testing: The testing of individual software components
(smallest testable part of an application) to demonstrate that their smallest pieces of executable
code function suitably
It is the most 'micro' scale of testing generally done by Developer himself.
From technical perspective a unit can be at a level of program, subprogram, subroutine,
procedures, function or code modules, a class, or a stored procedure. Unit constitute of
various statements, loops, IF-THEN-ELSE control structures, functions / procedure calls,
assignments and related data – records, variables, constants etc
From a business perspective a unit can be at a level of specific menu option – Input form,
viewing details etc. We will call them functional components.
Unit testing focuses on
Local data structures: Data useful to the program logic are stored in variables
which are then used at some places (on the right side of expression) or changed at
some places (used on the left side of expressions) and removed at some places of
code. For example, a variable will be used to store reservation amount. It will initially
contain 0 and subsequently will contain calculated amount based on price fetched
from the system, multiply with number of passengers. It will then be modified by
reducing discount if any and then increased by taxes as applicable.
Local data structures related issues include Improper or inconsistent data types,
incorrect variable names, overflow, underflow and exceptions.
For example,
a) The values of enumerated data types used without indexing an array (may
cause errors).
All independent paths: Every program will have some control structures such as
If…Then…Else or Multi decision structures like Switch/Case or Loops such as For,
While, Do Until. Execution of various statements would be done or not done or
would be repeated based on control structures used. So as part of unit testing all
independent paths through the control structure are checked to ensure that each
statement is executed at least once during testing.
The paths may not be executed correctly due to various issues as listed below.
a) Usage of wrong condition or logical operators in IF or SWITCH statements
due to which flow of control in program may not happen as expected.
b) SWITCH statement with no default case (can result in unpredictable result).
c) Mistaken statement termination or unintentional termination of loop.
Computation, comparison and Control flows are checked for correctness and
appropriateness. The issues could be
a) Loss of bits/bytes due to truncation.
b) Use of arithmetic exception such as divide by zero or floating point
exceptions (can result into issue).
Boundary conditions: Errors are more likely at the boundaries. For example error
may occur at the nth element of an n dimensional array or when the maximum or
minimum allowable value is encountered. So, testing should be done to exercise data
structure, control flow and data values just below at and just above the maxima and
minima to ensure that component operate properly at the boundaries to limit or
restrict processing.
Error handling paths: The system should handle situations such as invalid data
input by user or not system not able to insert data in table due to constraint imposed
and display proper error messages to the user. So, as part of unit testing, it should
ensure that error handling paths are executed when error is encountered to reroute
or terminate the processing. It also needs to ensure that error condition is correctly
processed; error messages are easy to understand and provide enough information to
assists the user to understand reasons for error and what steps to be taken.
The program actually is expected to validate that the inputs provided by the user are
valid and acceptable as per design and as per business rules. Some typical implicit
expectations as per design would be as given below
o Input Type Validation: For example, user enters characters by mistake when
only numbers are expected (such as in number of tickets or phone number
etc.)
o Input Length Validation: For example system expects only 30 characters for
passenger name but user enters 40 characters
o Value Limit Validation: For example, in a single booking you cannot book
ticket for more than 6 passengers but user enters 10
o Dependent Field Validation: For example your return journey date cannot
be prior to your travel date.
Any of the above and many other such issues can lead to wrong/unexpected
output/result.
We can find these errors only if all the statements of the program unit under all the paths
are tested at least once. So, we need to check
o Independent paths (Loops, Control flow): Execution of all branch statements,
Single Entry &single exit loops, embedded statements in blocks. Initialization
and termination of loops.
o Calculations
o Logic for the required process
Benefits: Unit testing helps us to find and locate smaller issues/defects due to which
debugging task becomes easy. Simultaneous testing can be done by different team
members on different units at a time. It improves quality of code before integrated in the
entire system. It reduces the time and effort as bugs are found and resolved early.
4.3 Integration Testing
We discussed that modular design allows one function/process to access the services
provided by the other function/components with a mechanism for passing control and
data between modules.
Each component should either receive or pass control/ data to and from calling / called
function properly as expected. If a component is used by multiple calling functions, it
needs to ensure that it services all the calling functions in an accurate manner.
Even though components individually work as desired, integrated modules may give many
issues as given below
o Data can be lost across the interface.
o One component can have in advertent, adverse effect on the other,
o Sub functions may not produce desired result as expected by major function,
o Individually accepted imprecision may be magnified to unacceptable levels,
o Global data structure can present problems.
o …
The interface of the software with the database may also be incorrect.
to test database and then forget to change before moving to live database. The live
application will connect to test database and not the live database.
Incorrect parameter passing: wrong parameter type, wrong parameter order, or
wrong number of parameters passed. For example, ticket booking process in an airline
reservation system uses one form for basic travel information. Once basic information
is given the system will pass control to Passenger information screen. If number of
tickets entered in the first screen not passed to the passenger information screen and it
assumes single ticket, it will input passenger details for only one passenger.
Inadequate Functionality / wrong location of functionality: Such issues are caused
by implicit wrong assumptions by one part of the system (developed by one
programmer) that the other part (developed by other programmer) will provide certain
functionality but it actually does not.
For example, Active ticket view screen displays all active tickets and allows the user to
cancel ticket. On clicking the ‗Cancel‘ button for a specific ticket, control is passed to
cancel ticket program. Cancel Ticket program assumes the required validation for
eligibility of cancellation is done by calling program where as it was actually to be done
by the Cancel ticket program.
For example the term-exam module is expected to pass whether the student has passed
in the term exam or not but term exam module assumes it will be checked in the main
module.
Misunderstanding of Interface: For example, for search functionality, a module calls
a component to search and return the index of an element in an array of integers. The
called module uses binary search with wrong assumption that the calling module gives a
sorted array but the actually calling module assumes sorting will be done by called
module. 2. A module passes a temperature value in Celsius to a module which
interprets the value in Fahrenheit.
Data Structure limitation:
Sometimes, the field‘s width is different in table and what is assumed in the other tables
or in the UI/Report, resulting into truncation of the value. For example Passenger
information screen allows 40 characters for the passenger names but the database table
column for storing passenger name has only 35 characters, the ticket will print only 35
characters for the passenger name. Truncation will take place.
If the data structure is defined for 100 records, it will fail, if records grow beyond 100.
Inadequate Error Processing: the calling module may fail to handle the error
properly even if the called module may return an error code to the calling module.
Inadequate Post processing: These errors are caused by a general failure to release
resources (eg. Memory) no longer required (failure to de-allocate memory)
As you can see, the above sample test cases aim to ensure
o Required page is displayed on clicking a button or a link
o The displayed details should be based on the inputs provided in the previous
page
o Specific validation should have been implemented in either calling page or called
page
o There is no truncation of data
Methodology
One may need to deploy different methodologies for different types of interfaces.
For example, one may need to trap messages and copy them to log file for real time
systems.
It may also be useful to use debugging tools and set break points at interfaces. When
control or data flow traverses an interface where a break point is set, control is passed
to the debugger, enabling inspection and logging of the flow.
Black-box integration tests may be used to fully exercise the functions specified in
design document. They are also used to verify that data exchanged across an interface
comply with the data structure specification
Approach for Integration Testing
Integration testing can be done once all the components of the entire software product
are integrated. This approach, commonly known as Big bang approach can create a
chaotic situation not only for testing but also because isolation of root causes may not
be easy and hence fixing also may not be easy.
So, generally an incremental approach is used so that the integration testing between
two components are carried out as soon as they are integrated. The main advantage is
that the testing can be started early (no need to wait for the whole system to be ready).
This approach has some disadvantage of requiring additional effort for developing
dummy code called stub/driver in absence of actual code and once again testing needs
to be done when actual code is available. Let us understand incremental approach in
little more detail. Integration can be either top-down or bottom-up as described below.
Top down Approach: An incremental approach for integration testing where the
component at the top of the component hierarchy is tested first, with lower level
components being simulated by stubs.
Under this approach development of modules and integration of modules happen from
top (main control module) to bottom.
So P1 and P2 are integrated first and then when P3 is ready, it replaces stub and
integration testing is done between P1 and P3. The process continues till last module
P7 is ready and integrated with P4. As you can see in the diagram, stubs may be used
initially when actual module is not ready.
Note that, Integration approach can be done Depth-first or Breadth-first depending
on the development approach.
Depth-First: First component at all levels are developed and integrated first and then
2nd component of all levels are completed. So here P3-P4. P4--P6 are done first and
then P3-P5 is done and then P4-P6 is done.
Breadth-First: All components of 2nd level are completed first and integrated, then 3rd
level components are completed and integrated and the process is completed till last
level components are completed. So, here P3-P4, P3-P5, P4-6, P4-P7 done.
B
Nitin Shah Software Quality Assurance and Testing
Unit and Integration Testing with Structural based Test design Page:89
Below are the possible steps followed depending on the readiness of the modules. Box
in Green indicates a Driver which is temporarily used to do integration testing with the
lower level modules and is replaced with the actual module once ready.
Typically as a student you will try this program with Visitor_type = ―Student‖ and
Booking_amount == 600 (or any such amount) and see the result. Having found the result
OK, you will conclude that the program is correct. However that is not true. If you try
with Visitor_type other than ―Student‖ you will find that the discount calculated as 0 as
against 5% as per requirement.
This is because the else statement is associated with the inner if and hence there is no
alternate path given for the first If. So, no discount will be calculated if the visitor is not a
student. The program hence is not correct
It is not easy to find such errors particularly with static testing techniques and also with
just one data set. You may test the program with some other data sets but if that data set is
also resulting in ‗True‘ for both the conditions, it will give correct result. This means unless
you test the program by providing values such that the first condition is falls, you will not
be able find error in the program. So, for the given program, you need to take at least 4
test cases (data sets) as given below. Notice that apart from the input values for
Visitor_type and Booking_amount, the table also shows two additional rows, one for
expected result for the given data set and other is the actual result you get when you run
the program with the given data set. If your expected result matches with the actual result,
the test case is considered to be passed and otherwise the test case is considered to be
failed and hence the program has an error.
In this case, the else is associated with the outer if condition. So, if the visitor is student
but booking amount is less than 500, no discount will be calculated.
This and some such similar aspects have resulted in to some rules/guidelines which are
known as test design techniques.
Concept:
Every program uses sequential statements, control statements (If-then-else or
Switch) and loop structures. Various business actions are performed or calculations
are done or data variables and objects, changes their values based on these control
structures.
Typically control statements breaks the normal sequence of the statement
execution as even simple if-then-else statement will result into two possible paths, one
with true value and other with false value. In general we need to ensure during testing
that actions taken or data input by the user force the execution of different paths based
on the control statements. Each input action or input data set is considered a test case.
So, the primary objective of white box testing technique is to ensure that all the
statements of the code, all the paths of the decision statement and all the results (true &
false) of each condition used are covered at least once during testing. This is in general
known as coverage testing.
The coverage goal is to ensure that
Every statement is executed at least once.
All independent paths/decisions within a module are traversed at least once
All logical conditions are exercised on their true and false sides
All loops at their boundaries and within operational bounds are executed
Coverage is a measure of the degree to which the test cases exercise or cover the logic
(source code) of the program - % of code covered
Please note that we are not designing test cases based on business rules but based on
Control statements – such as If statement and are not just considering one aspect (eg
discount calculation as discussed in the example) but for checking effect on various aspects
due to control flow.
There are many tools available in the market that can automatically analyse and track
coverage by executing the code. However explanation of such tools and their operations
are out of current scope
The example we are discussing is a very simple portion of code but in real life the code
portions may be much bigger and complex. Also, programs may actually perform multiple
actions, calculation in each path.
Let us see how a typical program can look with the help of one pseudo code as shown
below. This pseudo code is for updating batch wise item stock for each transaction based
on transaction type under different conditions / situations as per business requirement.
-------------
Read records from table
While (you get a fetched record)
{
Statements
if (a variable's value is 'PD' or 'IR' or 'AD')
{
if (tax >0)
{
calculate price inclusive of tax
}
statements
Update stock and price in the stock table
}
else
Software Quality Assurance and Testing Nitin Shah
Page:94 Unit and Integration Testing with Structural based Test design
{
Statements..
calculate revised balance
set flag to 'Y' ,set counter to 0 , set baseflag to 'N'
while(revised balance is -ve and flag is 'Y')
{
{
Set revised stock to 0
if (counter == 0)
{
Update transaction with revised quantity
Set baseflag = 'Y';
else
{
Insert transaction into transaction table
}
Update stock table
}
if (pending quantity > 0)
{
Read record with stock > pending quantity.
if (record avialable)
{
store record details in temporary variables
increment counter by 1
}
else
{
Read record with stock > 0
if (record available )
{
store record details in temporary variables
increment counter by 1
}
else
{
set flag = 'N'
}
}
}
if (flag == 'Y' && baseflag == 'N')
{
Delete the transaction with original batch
}
}
if (flag == 'Y')
{
statements
if (counter > 0)
{
Insert transaction in transaction table with new batch
}
else
{
Update the transaction in transaction table with new price
}
Update stock with new batch
} // end of Flag = Y check
} // End of trn Type
} // end while
}
------------------
Note that the actual program (with actual syntax and various other statements) is much
longer.
So, for larger programs, it may be difficult to analyse the code from top to bottom and
identifying various paths and derive test cases. Hence it is suggested to use flow graph
depicting the control of the program or portion of the program. Let us understand flow
graph in detail.
Now let us understand each of the above technique in detail.
A multiplex theatre has come up with a discounting scheme: 10% discount is given to
students if the booking amount if >= Rs 500. 5% discount is given if the visitors are
other than ‗FR‘ category or it is a morning show. This could be an additional discount
for students
The portion of the main code is as given below
1. { If (vtype==‗S‘&& amt>=500)
2. {discount=amt*.10; }
3. If (vtype!=‗FR‘ || show==‗M‘)
4. { discount2=amt*.05; }
5. }
As you can see there are 5 statements in the code.
For testing this function, you need to provide values
of vtype, amount and show. Each combination of values vtype, amount and show can
be considered as one test case. Let us use different test cases to understand how the
code is covered
Test Case 1: vtype=‗S‘, amt=600, show=‗M‘.
With these values, all the 5 statements will be executed at least once as both the If
statements will result in to 'TRUE'. So, in this case we can say that statement coverage
is 100%.
So, with this test case that covers path ACE, we will be able to cover all the statements.
There may be some siuations where we may require one or more additional paths to
cover all the statements, However if we stop at this stage, we may miss out some bugs
as we are not testing whether function works properly when the If condition is not
true. It may be easy to understand this using a flow chart
Please note that there is a single statement in the two process blocks provided in the
example for calculating discount depending on the compound condition specified in
decision box. In some other example there may be multiple statements in the process
blocks and some statements may set or change value of the variable used in the next
decision box.
Let us assume that branch B and Branch C has some process blocks and both the process
blocks have some statement that can change value of variable used in the next decision
box. In that case we need to consider both the paths resulting in 4 end to end paths. ABD,
ABE, ACD, ACE.
It is likely that the execution may not take intended path because of some mistake in
constructing the structure. So the basis is to select test paths by studying the structure of
the program and provide appropriate inputs so that every statement in every branch is
executed at least once. The thoroughness of testing can be measured by checking how
many such paths are executed successfully.
Area outside the graph is also considered one region and hence there are four regions.
Paths can be either represented using sequence of nodes or using sequence of links as
given below. Length of the path is is measured by number of links in that path
Complete Paths
Note:
a) Create separate node, if compound condition is used in IF statement
b) Above 6 paths constitute basis set of the flow graph. So, if test cases are
designed to cover all the paths, every statement in the program will be executed
at least once and every condition will have been executed on its true and false
sides.
c) Some Branches are covered multiple times
d) All process blocks need to be covered at least once
e) If node has ‗n‘ entry points then, same node should be covered n times (may
have different impact)
f) If concatenated decision points, there could be duplicate paths. (eg. nodes 7 & 8
considered 4 times – last 4 paths). Last 2 paths could be ignored
g) Single entry single exit paths should be considered only once
h) Similarly combination of two paths also should not be considered
Reduce Redundancy: You will notice that some branches are covered multiple times. We
need to keep following aspects in mind that all process blocks (or edges represented using
arrow) should be covered at least once and hence if there is a decision node with two exit
points, both exit points should be covered. Now if the node has two entry points then
same node should be covered two times as different entry points may impact differently.
However if you have concatenated decision points such as decision node 8 follows
decision node 7. The entry point 7-8 is hence considered 4 times. Refer paths c) d) e) and
f). This is duplication and last two paths e) and f) can be removed. Single entry single exit
paths should be considered only once for reducing redundancy and unnecessary effort
Cyclomatic Complexity (CC):
As you can notice, the complexity increases as the number of independent paths in the
program are increasing. Number of independent paths in the program is known as
Cyclomatic Complexity. It can be computed with following formula
CC (Independent Paths) = Numer of edges (Arrows) – Number of Nodes (Circles) +
2.
In the example above we have
Number of edges = 14, Number of nodes =12
So Cycomatic Complexity or Independent paths are = 14 – 12 + 2 = 4. And we have 4
independent paths as mentioned above.
Or CC = Number of regions = 4.
Cyclomatic complexity provides quantitative measure of logical complexity of the
program. It also tells number of independent paths in the basis set and hence represents
number of tests to be conducted to ensure coverage of all statements, paths and
conditions.
Ideally a program should not have more than 10 independent paths. Otherwise it will
become very complex to understand, maintain and test. The programs with higher than
Cyclomatic Complexity of more than 10 are advised to be restructured make is simpler.
In order to execute all paths identified for testing, one has to see that the variables used in
the condition determining paths should be accordingly assigned before the control enters
the decision node.
Also note that it takes more time to test a path if the length of the path is longer.
If there are maximum n number of allowable passes through the loop then following tests
should be considered for testing
Try to skip the entire loop (0 iteration). If it is successful then there can be a bug or zero
may not be the initial value
Assign –ve value to the loop control variable and look at the result.
only one pass through the loop
make 2 passes through loop
m passes through loop where m<n
n-1, n, n+1 passes through the loop
Example:
#!/usr/local/bin/perl -w
Open(DB, "filename");
$to_work_with = <DB>;
while (!eof(DB)) {
print "$to_work_with";
$to_work_with = <DB>;
}
close DB;
The program opens a certain file, reads it line by line, and processes this input. The
problem is that the last line read is never used.
Example: Display Percentage obtained by students. Total marks for each subject is 100.
Number of students and Number of subjects can be different for different course and
hence take input
Subtotal = 0;
Input StudentCount
Input SubjectCount
While (I <StudentCount)
{
For (j=1; j< SubjectCount; j++)
{Input Marks
Subtotal = Subtotal + marks
}
Percent = Subtotal/j;
Display Percent;
Subtotal = 0;
I = I+1;
}
Find out the error in the above program.
Is the program correct? It may be difficult to find errors unless you follow the
instructions of testing inner loop first and checking what is the outcome when loop is
executed 0 times, 1 time, 2 times, n-1 time, n time and n+1 time. Also the data should
be taken such that the at least for one case the subject marks are < 40.
Input
Subject 0 1 2 5 6
Count
Subject Marks NA 30 50,60 40, 50,43, 65,86 45, 50,43, 65,86, 50
You will notice that if the SubjectCount = 0 it will still print the percent.
In Many programs you may not have only simple loops, but you may have nested
loops, concatenated loop or Spaghetti loops. Let us understand what process we should
follow for testing each of those types of loops
As per above discussions, you can notice that as the type of statement progresses from a
simple sequential statement to if-then-else to Case/Switch to loops, the number of test
cases required to achieve the statement coverage increases.
So, even if black-box testing has found some errors because of issues in the control flow,
this technique helps in locating where exactly the problem is.
A limitation of white-box testing is its inability to show missing logic
Considering the approach, white box test design techniques and testing is best suited for
unit testing and done by developers as it requires knowledge of programming and internal
structure of the program.
4.5 Summary
In this chapter we primarily discussed what comes as part of Unit and Integration testing
from technical perspective and also covered how the white-box test design techniques
are used to do these.
We understood that various business functions could be realised by usage of one or more
components. A component can be used by many other components. So, if there is any
issue in the component, all the business functions using that component may give wrong
result. Hence it is important to first test all the components.
Unit (a program / function / stored procedure / class) testing or component testing is a
micro level testing done as soon as the unit is developed. It helps to identify some errors
related to statement termination, wrong condition or logical operator usage, inappropriate
/ no initialization, null referencing or similar other such defects. These defects, if not
found may surely result in some functionality error at a later stage.
In most cases these components / units are integrated to each other generally through
function/procedure calls or direct inclusions with some parameter passing or using global
variables. Typical integration errors include – inappropriate inclusion of header or other
files, Misuse of interface, Inadequate/wrong functionality (both calling and called unit
assume that other unit covers specific logic), misunderstanding of interface (by calling unit
about the called unit), Inadequate error processing / post processing or initialization errors
(Eg. Not releasing the memory allocated by other unit). Integration testing is done to
identify such errors.
For both Unit and Integration testing, both white-box and black-box test design
techniques are used but primarily white-box techniques are used.
There are two main approaches for Integration testing. In a big-bang approach in which
integration testing is done after all the units/components are ready and in incremental
approach where integration testing between two units/components done as soon as the
components are developed and unit tested. Incremental integration testing may again be
done top-down or bottom-up depending on corresponding development approach.
Incremental approach may be difficult for some units if all the other units integrated to it
are not ready and sometime dummy code may have to developed till the time actual unit
code is developed. In top-down approach such dummy code is known as Stub and in
bottom-up approach, it is known as Driver.
We then discussed White-box test design techniques in detail which is based on
internal structure of the program and hence also known as Structure based technique.
The objective is to ensure that our testing coverage is maximum (if possible 100% even if
practically it may be difficult). Testing the program once would be good enough if the
program is just a series of statements written in sequence. However the control
statements such as if-then-else, Swith / Case and Loop structure change the sequence or
skips some code or repeats some code. So, coverage need to consider those aspects.
Accordingly we discussed about statement coverage -> path/decision coverage –>
Condition coverage (where compound conditions are used for a decision) and Loop
testing.
So the objective would be to cover all the possible paths in testing with all possible
conditions used in the control statement. We also discussed some approach to optimize
our tests.
We discussed two approaches for white-box testing. 1) using diagnostic code (eg print
statements) in between the code to display some messages or variable values and 2) run the
program under IDE and use their debugging tools to interrupt the execution in between
and check the values
White-box testing is best suited for unit and integration testing and requires knowledge of
the code structure and hence done by developers. White box testing however cannot show
missing logic.
4.6 Exercise
Sr. Question
1. Testing a module / Application to check if the components are integrated
properly is example of _________ testing
2. Explain Unit Testing with example
3. _______________ and ______________ are the two approaches of
Incremental Integration Testing
4. Explain in short Top-Down incremental Integration Testing
5. Initialization, Loops, Control flows etc are tested in __________ testing phase
6. Under which situation you need to develop stub? Why?
7. Describe approaches of integration testing
8. One needs to create __________ for Top Down incremental integration
testing
9. One needs to create __________ for Bottom-Up incremental integration
testing
10. ______ is logic driven testing and permits Test Engineer to examine the
internal structure of the program
11. Explain Integration Testing with example
12. White box testing is a static testing. (T/F)?
13. Describe decision coverage in detail
14. Name the type of testing to be done for testing a loop
15. How should one test nested loops?
16. It is possible easily to cover 75% of code coverage
True/False?
17. In white box testing, you do not need to execute the program (T/F)?
18. Glass-box testing is same as _____________ testing
19. Draw flow chart for a program which determines whether the number is even
or odd.
Determine the paths which can be used for White Box testing
20. Discuss limitations of structural testing
21. What do you mean by Big Bang Integration strategy?
22. What are Drivers and Stubs? Why are they required?
23. Draw a flowchart for the following requirement and provide all possible paths
to be covered as part of decision coverage
Sr. Question
Study the following code and answer questions after the code
If (Visitor_type == 'Student')
If (Booking_amount >= 500)
Discount = Booking_amount*.10;
Else
Discount = Booking_amount*.05;
Booking_amount = Booking_amount – Discount
Q1. Which of the white-box technique you will use to test the code?
Q2. Minimum how many test cases (different test data sets) should be used to
test this code?
Q3. Why?
26. Explain White box testing techniques with suitable example
27. A vending machine dispenses either hot drinks (Tea or Coffee) or cold drinks.
If you choose a hot drink, it asks if you want milk (and adds milk if required),
then it asks if you want sugar (and adds sugar if required), then your drink is
dispensed.
a. Draw a control flow diagram for this example. (Hint: regard the selection of
the type of drink as one statement.)
b. Given the following tests, what is the statement coverage achieved? What is
the decision coverage achieved?
Test 1: Cold drink
Test 2: Hot drink with milk and sugar
Sr. Question
c. What additional tests would be needed to achieve 100% statement coverage?
What additional tests would be needed to achieve 100% decision coverage?
28. Study following flow chart for date validation routine. Assumed that values are
checked for numeric and also assumed that leapyear function is available and
the array Daysofmonth contains days of month for each month
If mm <1 ||
True False If (mm == 2)
mm >12
False
True
Invalid Date
If
True (Leapyear(yyyy) false
)
If (dd<Daysofmonth [mm]
True False
|| dd>Daysofmonth [mm])
Invalid Date
Valid Date
It allows you to select Business Class even if flight does not have
It accepts value of a location from where there are no flights.
The Amount calculated is not correct.
For example, you should have got 10% discount if you are a gold card member and
booking more than 3 tickets in single order but you don‘t get
These issues or any other issues will make any customer furious and will probably move to
competitor. We as a developer/tester need to ensure that we test the application properly
to find all of above-mentioned issues so that they can be resolved before the application is
moved to production.
In general, we do testing by entering some values for various fields as we feel appropriate
for testing and check whether output is as expected or not.
For example, we may enter couple of different travel dates (one week from now and one
month from now) and book tickets. We may miss out entering past date and checking that
system should not accept it or we may miss out testing with date that is 3 months later
than today‘s date when booking beyond 3 months not allowed. If we have to do
exhaustive testing by checking each and every date, say for past one month and next 4
months, it would be very time consuming.
Similar will be the case for all the other fields and for all the other business rules. We need
to hence see how we can do efficient and effective testing with optimum number of
possible dates and still be able to find potential defects. So, we need to select a small subset
from all the possible dates and yet it has to have a high probability of finding most of the
defects. Test Design Techniques provide guidelines/ideas that guide our selection of
inputs. Each individual technique is good at finding particular types of defect and relatively
poor at finding other types. So, we may need to apply all of the techniques.
First important aspect of testing to ensure that wrong data is not allowed to be entered in
the system. If the inputs themselves are not correct, the output is surely going to be
incorrect.
1) Input Field validations
The Objective is to ensure that data is valid before attempting to process it, thereby
avoiding the generation of a run time error or invalid results. Almost every field on the
screen requires some type of input validation else it may give some errors while storing in
the database or may give wrong/unexpected results
Field level validation should happen and an error message should be displayed when
o the user attempts to leave the field.
o the content of the field changes for any reason.
Additionally one need to ensure that duplicate entry of the same transaction is restricted.
One may make use of decision table for testing above requirements where we consider
Edit/Modify as cause and list down various effects. However Use case based technique is
considered more relevant for transaction testing which we will discuss in the next section.
End-to-End Testing (many times this is referred to be same as system testing but I
consider it as an approach for system testing). This covers actual flow through a system in
an end-user scenario. It is an approach used to test whether the flow of an application is
performed as designed from start to finish and to identify system dependencies or
interface issues and to ensure that the right information is passed between various system
functions and systems. It also includes Integration with external interfaces.
For example, we test ticket booking process from start to end with following steps with an
assumption that individual functionalities are tested separately.
Login to the application
View Flight options
Book a ticket – Select a flight, select date of travel, Provide passenger information,
make payment etc
Print a ticket
Check the availability for updates
Check the account for updates
Check Passenger list for the flight
Check Agent Commission details
Note that each of the above steps is an independent business function and we would
have tested each of them as part of Business Function/Business Unit testing. So, the
focus here is on how they are communicating with the other business functions,
interfaces, database, network, and other applications and ensure that the transition
from one business function to other business function happens properly.
Note that there could be multiple end-to-end scenarios involving different business
functions / different sequence in which the business functions are used. Let us see
some examples
Login->View Booked Ticket->Reprint specific ticket
Login->View Booked Tickets->Update details-> Print updated ticket
Login->View booked Tickets->Cancel one ticket
……
…….
In order to find out real interface issues, we need to consider each possible
combination at least once.
Life Cycle Testing – This refers to the testing all functions required under different
situation or at different point of time for the life of a specific entity or a transaction – from
birth (initiation) to death (completion/deactivation).
For example, an entity ‗Ticket‘ comes into existence by booking and cease to die
(become inactive) once the passenger has travelled on the ticket or cancelled it. There
can be multiple functions in between for a given ticket such as Update, Print, Email,
Upgrade, Check-in and so on.
In a way, this could be an extension to cover business functions and processes which
may also happen at a different point of time on the same entity. For example ticket
booking and printing would happen at a given point of time, update at a different point
of time, check-in at a different point of time and closure (travel completion) at a
different point of time. So, the objective is to cover full life of the entity involving all
the possible functions to ensure that all the processes happen as expected.
For both the testing explained above, we would primarily use Use-case based testing with
normal and alternate scenarios. There could be multiple alternate scenarios as given below
Booking, Check-In, Travel
Booking, Update, Travel
Booking, Update, Cancel
Booking, Upgrade, Check-in, Travel
There could be some negative scenarios (which system should not allow). For
example
Booking, Cancel, Check-in
Booking, Check-in on different date
Booking, Cancel after travel date has passed
We will discuss Use Case based testing in details in the next section.
Note that non-functional testing is also done as part of System Testing as this is the
final testing from IT/service provider, and hence should be very thoroughly done. We
will discuss non-functional testing in chapter 8.
If we derive test cases based on ‗Single Fault assumption theory, we consider it Weak and
if we derive test cases based on Multi fault Assumption Theory, We consider strong.
Similarly if we consider only valid input values, we consider Normal and if we consider
Invalid input values also, we consider Robust.
There are four types of equivalence partition testing
1) Weak Normal Equivalence Class Testing
2) Weak Robust Equivalence Class Testing
3) Strong Normal Equivalence Class Testing
4) Strong Robust Equivalence Class Testing
As part of our discussion, we will focus on most commonly used type – Weak Robust
Equivalence class Testing – Which means single fault assumption and both valid and
invalid classes of input values because in most cases we will apply this technique on
variables which are independent and we would need to assure that application throws
proper error messages when invalid inputs are entered.
Since the objective is to test what application is supposed to do (positive testing) and test
what it is not supposed to do (negative testing), it is important that at least one value from
each positive class / Partition (valid values) and one value from each negative class (invalid
value set) is used as inputs for testing.
You may test the application with more than one value from same class but the expected
result will be same or equivalent for all those values. However if you have some doubts on
the classes identified or the system is modified which results in to change in the classes,
you may decide to test with multiple values from the same class.
Please note that there can be multiple valid classes and multiple invalid classes.
Example 1: Travel Date condition: Travel date could be next day till one month from next
day (Ticket can be booked only upto one month in advance)
Assume that today (System Date) is 15-Nov-18 and booking can be done for upto one
month.
- Valid class: {16-Nov-18, 17-Nov-18……….. 15-Dec-18} –System allows booking
- Invalid classes: {…….. 14-Dec-18, 15-Nov-18}, {16-Dec-18, 17-Dec-18,……..}
System should not allow booking and display error message.
If the today‘s date is 15-Nov-18 and we test application with 20-Nov-18, 25-Nov-18 or
30-Nov-18, expected outcome is same – to allow booking. So, it may not be necessary
to test with all or many values from the same class. Rather, it would be better to test
with date: 10-Nov-18 (from invalid class of date prior to system date) and 20-Dec-18
(from invalid class after one month) for which the system is expected to display an
error message and say 25-Nov (from valid class) for which system should not display
any error message and allow booking.
Considering the assumption we have taken, there is no need to waste time in testing
with other values until the bug is fixed. You can notice that we will require only three
tests (two from two invalid classes and one from valid class) and we will still have
probability of identifying defect. In contrast you may test for 5 different dates but all
from one class, you may miss a potential bug.
Example 2. The travel class must be either ‗Economy‘, ‗First‘ or ‗Business‘. So
Valid class/partition: {Economy, First, Business}
Invalid Class: (Elite, Employee,…., anything else}
Since radio buttons are used in the current application for the travel class, the user will
be able to select only one of the valid values. However in this case, travel class is hard
coded. For system to be flexible, drop-down may be provided but in some application,
if input is expected from user, then this needs to be tested properly.
It is also possible that the application allows the three valid values in general but
specific airline does not have flights with Business class. The valid class for that specific
airline will be different.
Example 3: The Club membership applicant must be a person.
- Valid class: {person}
- Invalid class :{ corporation, ...anything else...}
As you can see the classes mentioned above are discrete classes or classes with discrete
values. It may be practically required to take more input values from each of the class
depending on how important it is for other processing
Example 4: Passenger name can accept only characters. Note that checking of field type
can be done using this technique. For example, Passenger name can have following classes
- Valid class: All alphabets {A, B, C ……. Z. a. b. c…… z}
- Invalid classes: All numbers {0,1,……9},
All special characters {@,#,z,......}
Example 5: The input variable is an applicant‘s income. The valid range is Rs. 1000 to Rs.
75,000
- Valid class: {1000 > = income < = 75,000}
- Invalid classes: {income < 1000}, {income > 75,000}
Equivalence classes are not only based on input domain (valid and invalid) but could also
be based on output domain.
Example 7: In an examination result processing, Student‘s grade depends on %marks
obtained as given below
<40% Fail
40% to 50% Pass Class
50% to 60% Second Class
60% to 70% First Class
>=70% Distinction
As you can see, there are
two invalid classes {……-1%}, {101%,102%.....} and
valid class {0%,1%,……99%,100%}
However the output is different for different valid percentages and hence we have to
have multiple valid classes
Valid Class 1: {0%, 1%......39%}
Valid Class 2: {40%,41%....49%}
Valid Class 3: {50%,51%....59%}
Valid Class 4: {60%,61%....69%}
Valid Class 5: {70%,71%....100%}
We will hence have totally 7 equivalence partitions and testing should be done with at
least one value from each partition.
Note:
1) When you are analysing the test basis (e.g. a requirements specification), equivalence
partitioning can help to identify where a drop-down list would be appropriate
2) Deriving correct partitions is very important for any requirement and sometimes
derived based on assumptions. In such case, it is better to try several values in a
partition. If this results in different behaviour where you expected it to be the same,
then there may be two (or more) partitions where you initially thought there was only
one
It may be a good idea to verify the partitions with the customers
We can apply equivalence partitioning to
a. Numeric value: If an input condition specifies a specific value then one
valid class (with only one value) and two invalid classes defined
b. Boolean condition: If input condition specifies Boolean condition then one
valid class with only True value and one invalid class with only false value
c. Set of related values: If input condition specifies member of a set then one
valid class of all valid values and one invalid class for all the other values not
in the set.
For all the tests to be performed should be documented in advance so that
o Important tests are not missed out
o It is easy to plan and track actual testing activities
o Evidences can be provided after testing
So let us see some sample unit test cases based on Equivalence Partitioning technique
Name of Unit/Program: Ticket Booking
Values 999 and 75001 should not be accepted by application and through an error
message
Many theories propose this two-value approach also.
There are also theories which consider only valid inputs on the boundary as part of the
basic BVA technique and when we consider invalid value also that is min- and max+
then it is called Robustness BVA Technique. We propose to use Robustness
technique with two value approach in most cases unless strongly typed languages result
into run-time errors aborting the execution of the program for any invalid inputs.
Let us see how the sample test cases discussed earlier are refined using BVA technique.
You should derive similar test cases for all the individual fields where user is going to enter
some inputs.
So, let us refine our test cases
Note that for Name field validation first two test cases are same. Mandatory means 0
character length not allowed and hence one of them can be removed.
We are also assuming that date control is used for date field and hence type of the input
will always be correct.
Note:
We can apply equivalence partitioning and boundary value analysis more than once to the
same specification item. Let us understand this with an example.
Example: An internal telephone system for a company with 200 telephones has 3-digit
extension numbers from 101 to 500,
We can identify the following partitions and boundaries:
• Input type
Valid Partition: {digits 0 to 9}. Invalid partition: non-digits {a,b,….., Z, .,;…..}
• Input length - number of digits,
Valid partition {3}. invalid partition length {0, 1, 2, 4, 5,…}
• range of extension numbers, 101 to 500
Valid Partition: {101,102…….,499,500}, Invalid Partitions: {1,2,….99},
{501,502….}
One test case could test more than one of these partitions/boundaries. For example,
Extension 409 would test all three valid partitions: digits, the number of digits, the valid
range.
EP and BVA techniques are generally used for Unit testing. However they can also be
used for integration testing where system receive data from other sources such as other
system/modules via some interface as value of an interface parameter may also fall into
Valid and Invalid equivalence partitions. For example, if there is a separate component for
providing grade based on marks / %marks passed as parameter from different calling
programs such as Assignment grading, semester exam grading etc, we can apply these
techniques during integration testing for result.
b) Identify all the combinations of true and false for these conditions and write as
rules
Rules:- 1 2 3 4
C1: Tickets booked 20 days in advance F F T T
C2: Number of Passengers > 3 F T F T
As you can see that there are two conditions. Each condition can have two possible
values ‗True‘ or ‗False‘ (we shortly consider ‗T‘ or ‗F‘). As a next step, we will have to
write down each unique combination of values for these two conditions. These
combinations are also known as rules. Each combination / rule may result in different
effect. So we then write effect for each combination/rule.
Please note that the number of rules depends on number of conditions. If there are 2
conditions, you have 2^2 = 2 x 2 = 4 combinations. If there are 3 conditions then you
have 2^3 = 2 x 2 x 2 = 8 rules.
3) Identify the correct outcome for each combination (rule) and write
Rules:- 1 2 3 4
C1: Tickets booked 20 days in advance F F T T
C2: Number of Passengers > 3 F T F T
You may write each effect separately based on specification and then write the final
outcome which may be combination of the all the above effects.
4) Combine the rules if the alternatives does not make any difference or remove any
rules which are not going to be possible.
Notes:
1) Decision table in which all conditions are binary (takes only one of the two values T
or F) is called Limited entry decision Table.
For Limited entry decision tables if there are n conditions then there will be 2n rules.
So, if there are 3 conditions, there will 23 = 2*2*2 = 8 rules.
2) Decision table with conditions allowing more than two values are called Extended
Entry Decision Table. We will see example
For Extended entry decision tables, number of rules will be multiplication of
number of values for each condition. So, if there are 3 conditions, 1st condition can
take 2 value, 2nd condition can take 3 values and 3rd condition can take 3 values then
total number of rule will be 2*3*3 = 18.
3) Rules in the entry section will be converted to test cases. So number of rules will be
same as number of test cases.
4) The completeness and consistency of the decision table can be checked by ensuring
that
a) Number of rules cannot be more than number of rules calculated. Some rules
can be removed due to redundancy or not possible cases or mutually exclusive
situations. We will see example of the same later.
b) Number of Yes‘s and No‘s in each row should be equal for limited entry table.
Example 2: For a movie ticket booking If (booking is done 5 days in advance or number
of seats booked are four or more) and registered member, you get 10% discount.
Rules: - 1 2 3 4 5 6 7 8
C1: Registered Member F F F F T T T T
C2: Tickets booked 5
F F T T F F T T
days in advance
C3: Number of seats
F T F T F T F T
booked >=4
Rules: - 1-4 2 3 4 5
C1: Registered Member F T T T T
The
C2: Tickets booked 5 days in advance - F F T T ―-―
C3: Number of seats booked >=4 - F T F T
This process allows us to reduce number of rules and hence number of test cases.
However, if there is any risk identified for a specific functionality, one may decide to
actually consider all the 8 rules.
So, for testing this functionality, you should be providing inputs in such a manner that
these combinations are covered and final discount displayed by the application should
match with corresponding expected discount % provided
Note: Simplification of the decision table can be done by evaluating / analysing effects. If
the effects for the two or more rules in a decision table are identical, there could be a
condition that allows the rules to be combined with hyphen (Don‘t care entry).
Example 3: Discounting Policy for club members
Consider reservation function for an event that gives 10% discount to all but person with
gold card membership gets additional 10% and with silver card membership gets 5%
additional. However if the members have not paid membership renewal fees fully then
only 3% discount is given
Rules: 1 2 3 4 5 6 7 8
The test cases derived based on the above 6 rules can be documented as given below
Rules: 1 2 3 4 5 6
C1: Female? F F F T T T
As you can notice, effects E1 to E3 can also be combined into single line as per last
row in the table. Also notice that when there were more than 3 defaults, the
membership is cancelled and hence there is no question of increasing any fee (so it is
mentioned as NA in the last row). Note that Rule 2 and 5 indicated number of defaults
could be between 1 and 3. You can hence apply BVA technique also so the rule should
be ideally tested with boundary values 1 and 3 both. Which means it can result into
additional test cases and not just 6. Number of defaults 0 and > 3 are already covered.
Exercise: Write test cases in excel test case format for above rules.
In addition to identifying optimum test cases, this technique is also able to point out
incompleteness and ambiguities in specifications
Example 5: Examination result rule for giving grade is as below
<40% ‗fail‘
>=40% but <50% ‗Pass‘
>=50% but <60% ‗Second Class‘
>=60% but <70% ‗First Class
>=70% ‗Distinction‘
However if the student‘s attendance is <60%, his grade is reduced to ‗Pass‘ even if his
percentage of marks obtained is >= 50%.
There are two variables 1) % of marks which could take any of the 5 ranges and 2) %
of Attendance which could take any of the two ranges
Rules: - 1 2 3 4 5 6 7 8 9 10
C1: % of 0- 50- 70- 40- 70-
40-49 60-69 0-39 50-59 60-69
Marks 39 59 100 49 100
C2: % of
Attendance F F F F F T T T T T
>=60%
First Disti
Secon
E1: Grade Fail Pass Pass Pass Pass Fail Pass nctio
d
n
Once again, you can apply BVA also for checking each rule and hence you may
consider both the boundaries for each range resulting into actually 20 test cases and not
just 10 test cases as shown above.
For example with attendance >=60% you should test with 0% - fail, 39% - Fail, 40%-
Pass, 49%-Pass, 50%-Second Class, 59%-Second Class, 60%-First Class, 69%-First
Class, 70%-Distinction, 100% - Distinction, 101% . We assume that separate test cases
had already been prepared for invalid inputs such as -1% or 101%. Or if the
percentages are calculated by the software based on marks obtained, we assume that %
calculation logic is separately tested and it will be between 0% to 100% only. However
if the % calculation is done by the system then our test cases should include marks for
each test case so that a specific rule become true and testing is done as per each rule of
the decision table.
One may also think that rules 4 and 5 may not be applicable and can be ignored since
the outcome is same for all the 3 conditions as the business rule says if % of marks >
50 will also get ‗Pass‘ class if the attendance is <60%. Whether to consider those rules
or not may depend on various other risk factors. So, it is advisable to consider those
rules unless there time/effort crunch.
Decision Table can also be used to design test cases for validating inputs which are based
on more than one variable.
Example 6: A loan application where the user can enter one of the two things a) monthly
repayment amount or b) loan period (number of years in which the amount will be repaid).
If you enter both, the system will have to make compromise between the two if there is a
conflict.
Rules:- 1 2 3 4
C1: Term of Loan is entered F F T T
C2: Repayment amount is entered F T F T
While preparing decision table, you may realize that we hadn‘t thought what should be
done if user doesn‘t enter any of the two fields and assume that the system should
display an error message. This is how this technique also helps in identifying any
ambiguities in the specification. Ideally, all assumptions should be verified with the
customer and if you discuss with customer, he mentions that the user should not be
allowed to enter both the details. In that case the effect for rule 4 will change and ‗Y‘
will need to be removed from E1 and E2 and to be written for E3 (Display error
message).
Benefits:
Decision tables provide a systematic way of stating complex business rules, which is
useful for developers as well as for testers in exploring various possible effects of
combinations of different inputs and can be useful in finding ambiguities in
specifications also.
In absence of this technique, one may use some random combination of inputs for
testing resulting in some misses (of important combination) due to which you may not
be able to identify some possible defects. OR you may end up testing same
combinations with multiple data sets which could be waste of time.
Use Case Model: The use case model involves various actors and various business
actions that can be performed by those actors (users).
Each use case has two types of scenarios – a) Primary and b) Alternate
1) Primary / Basic Scenario
It is the most common way for a use case to happen; as if everything goes as per
normal process.
It represents normal functionality described by the use case.
For example, online reservation by passenger with all valid details using normal
payment mode
2) Alternate Scenario
This is a scenario where the precondition steps, actions or sequence of actions are
different from the one described in the primary scenario. This includes special cases or
exceptional conditions or even error conditions.
For example, User enters all the details, but later on changes mind and modifies details
before confirmation. User Cancel‘s in between or Flight gets full for a given date/slot
or Invalid card is used.
Identifying alternate/error scenarios:
An alternate scenario can occur if
Any other action can also be taken at this time
Eg. Anytime before customer clicks ‗Book‘, customer may click ‗Cancel‘. Post
Condition: Customer still logged in. Pages initialized
Any other event can happen that can cause the system to behave differently
Eg. Accounting system can notify that the credit card has been declined. Post
Condition: Allow to correct information
Anything that can go wrong (by the system, by user or by other actor)?
Eg. System crashes before system displays confirmation message. Post condition:
system saves partially entered data, such as Ticket entry is done but actual reservation
does not happen (seat allocation does not happen)
Developing Negative (Destructive) test cases based on Scenarios
There are two sources for deriving negative test cases
Test Cases based on alternate scenarios with invalid data
Test cases that violate items in pre-condition
Example
Cancel reservation that does not exist
Cancel reservation where flight time is < 24 hours
Cancel reservation for which boarding pass was already issued
Components of Scenario
Pre-Conditions
Anything that must happen before the scenario can start
It describes the state in which the system must be before the scenario start
Steps
All interactions between the system and actors that is necessary to complete the
scenario
Post-Conditions
Anything that must be true after the scenario is completed
What state the system acquires after the scenario has been completed successfully
The system test cases for various transactions are derived based on these use cases as per
the process described below.
1) Passenger has valid credit card for booking 2) Round Trip is available between
two cities – Ahmedabad and Mumbai. 3) A user is successfully logged in with User
ID: passenger1 and Password: passenger1 and Home page is displayed which
contains a button ‗Reserve Ticket‘.
Note:
1) You will notice that steps are at high level as compared to Unit testing because it is
assumed that unit testing was already done and individual field level rules are
assumed to be working fine.
2) If system is not in pre-condition state then we need to first take some steps to bring
it in pre-condition state.
3) One need to Identify inputs in the pre-conditions and in steps and provide exact
data to be used.
4) Output described in each step and post-conditions are expected results and to be
verified. They are all to be considered as separate test cases and in some cases may
have to be documented separately.
5) Each variant in the pre-condition or steps becomes separate test case. For example,
user has valid debit card instead of credit card or does not confirm the details after
entering details and changes the data in between or enters age such that passenger
becomes a senior citizen
Example 2 of Scenario: Agent Cancels Reservation
Reservation Exists
Enter Reservation no. Reservation will
Not cancelled before
System Displays have been marked
Payment Made Reservation details cancelled
Credit card is still Click ‗Cancel‘ Seat is made
valid available
System asks for
Flight time is at least confirmation Credit transaction
24 hours before has been generated
cancellation time User provides and confirmation
(business rule) confirmation number is displayed
A boarding pass has System sends credit
not been issued transaction to
accounting system
Confirmation is
displayed
Exercise:
a) Prepare test cases for above scenario.
b) Prepare alternate scenarios and negative scenarios
As you can notice, we have to test each of the above 7 situations and ensure that the
system takes us to new state correctly. Some actions do not change the state but some
other actions change the state. It is also possible, same action may result in state change
under one situation and may not result into state change in some other situation. So, if we
have two active travel tickets – If we cancel one ticket, state may not change but if we
cancel 2nd (last) ticket, the state will change.
So, State transition technique can also be considered as technique to find more scenarios
under use case based testing.
The test can be formally documented in standard format based on the State transition table
S1 S2 S3 S4
Empty Shopping Summary Payment
Below are the tests covering all the transitions. In this example end state is not
mentioned for each action as it is the start of the next event. This is with an assumption
that all the tests will be executed in the same set
S1 Add Item
S2 Add Item
S2 Remove Item
S2 Check out
S3 Not OK
S2 Check Out
S3 OK
S4
Since we are limiting our scope to only shopping cart functionality, we are currently not
interested in what happens from state 4 even though there will be some events and
actions after payment is done. That can be treated as a separate functionality and hence
part of other state diagram. (eg. Deduct the amount, send email etc.). Note that we
have removed last column depicting expected end state because the start state of the
next action represents the end state of the previous action. So, we can simplify our
table with only two columns. However this could be possible only if you execute the
tests in the same sequence. Each step to be treated as a test case.
We can also prepare a state table as given below
State-> S1 Empty S2 S3 S4
Actions Shopping Summary Payment
Add Item S2 S2 - -
Remove Item - S2 - -
Remove Last - S1 - -
Item
Check Out - S3 - -
Not OK - - S2 -
OK - - S4 -
Note that Top row represents starting state and first column represents action and the
interaction represents, the ending state if you take the action mentioned on the left side
when the application is in the state mentioned on the top. So, if you are in S1 state and
if you add Item, you should move to S2 state. If you are in S2 state and if you add item,
you still remain in S2 state. You can interpret all the intersections in this manner and
derive test case for each intersection.
Some intersections may not be possible or could be treated as invalid. All of the boxes
that contain ‗-‗ are invalid transitions in this example. This table can help us identify
some negative tests such as
a. Attempt to add an item from summary state (S3)
b. Try to remove an item from empty state (S1)
c. Try to enter ‗OK‘ while in shopping state.
System should not display buttons or provide any other options to take above invalid
actions or display corresponding error messages if user takes any of these actions.
Other Examples
Microsoft Word: Let us say you have a word document opened. If you try to close
the document without any changes it will close without prompting to save. But if
you make some changes in the document and then try to close, the application
displays a message asking whether you want to save changes or not.
Reducing number of Test cases (transitions)
The examples we discussed are relatively small and simple. In reality many applications
and their functionalities will have large number of states, events and transitions making
testing very complex and time consuming. Like we did for other techniques, we need to
try to reduce the effort and time by reducing various state transition rules to optimum
level. We need to follow guidelines provided below
Visit each state at least once.
Test the most common state to state transition
Test the least common paths between states (as these paths could have been
ignored and more likely to find defect)
Test all the error states and returning from the error states. Improper error
handling is also a common issue and more likely to get bugs. Error messages
should be proper/relevant and software should recover properly once the error is
fixed
Test Random test transition. After following above steps, you can pick up some
states and transitions randomly and test them. If you find errors, test more.
5.6 Summary
In this chapter we discussed in detail, Business Functionality testing (normally known as
functional testing). Each business function or transaction can be termed as business
unit and can be tested at two levels – Field level testing and Form level testing. Once
individual business functions are tested, System testing is carried out which will cover
End-to End Testing (where related business functions are executed one after other) and
in some cases Entity Life Cycle Testing is also carried out to test all the business
functions from start (birth of the entity or transaction) to end (death of the entity or
transaction).
Business function testing is done using Black-box test design techniques where test cases
are derived using function specifications irrespective of the language or the internal code
structure.
The first and most important part of testing would be to ensure that user can input only
valid data otherwise the results are bound to be wrong. Every input field can have set of
possible valid values and set of possible invalid values. As part of standard field validation,
we cover Null allowed or not (Mandatory), maximum length allowed, Type of characters
allowed, a range of values allowed (particularly for numeric fields) or there are some set of
possible valid values as per business rules.
We accordingly discussed three Black-box test design testing primarily used for Input
validations
Equivalence Partitioning: Test cases are designed to execute at least one representative
from each equivalence class/partition. There could be multiple classes with valid and in
valid values. Each class may contain one or more possible values. Since the system is
assumed to handle all the values of the class equivalently, if we test the system with one
value from each class and find that it works fine, we can assume that system will work fine
for other values of the class also. Similarly if the system is not working fine for one value,
then there is no point in testing with other values of the same partition as we are likely to
get similar error.
We discussed how requirements, such as mandatory field, maximum length or field type
kind of requirements can also be tested using this technique. It is important to note that,
deriving classes is very important. We can apply this technique to numeric value, Boolean
condition, or discrete set of related values.
Boundary Value Analysis: This technique is an extension to Equivalence partitioning
and suggests that instead of taking any value from the class, if we take values on the
boundary/edge, our chances of finding errors increases. So, test cases are designed based
on boundary values minimum, minimum -1 , maximum, maximum + 1. So, for
example for the input field salary, if the specification says that salary amount between
10,000 to 75,000 allowed, testing should be done for salary 9,999, 10,000, 75,000, 75,001.
For salary input 9,999 and 75,001 the system should not accept the salary and display error
message but for salary input 10,000 and 75,000, system should accept and proceed further.
EP and BVA techniques are generally used to validate whether the application is accepting
only valid values or not. But sometimes, they are also used to check if there are business
rules generating different output for different valid inputs (eg Examination result) based
on single variable.
We can apply equivalence partitioning and boundary value analysis more than once to the
same specification item – for example type of input, not null and specific input range all
can be combined into single test.
Decision Table: Many business rules do not depend only on one variable but may
depend on two or more than two variables. For example, discount may depend on total
number of passengers, and in how much advance the booking is done. In such case,
Decision table techniques is used in which table is prepared with a) conditions related to
dependent variables, b) combinations of True, False for those conditions and c)
corresponding outcome for each combination. Each combination is considered a rule
based on which test cases are designed.
We studied Limited Entry Decision table where all conditions are binary (takes only one
of the two values Y(T) or N(F)). The decision tables where conditions are allowed to take
value other than binary or more than 2 values in general, then the decision table is known
as Extended Entry Decision Table. In case of Limited Entry decision table, total number
of rules would be 2n where n represents number of conditions. For Extended entry
decision tables, number of rules will be multiplication of number of possible values for
each condition
We also discussed various guidelines using which we can reduce number of rules (eg.
Removing rules which are not going to be possible or combining rules which are very
similar or which are going to give same result). We also discussed that while using the data
that can satisfy each rule, we can apply BVA technique to increase the probability of
finding errors.
Decision tables provide systematic way of stating complex business rules and hence can be
useful to developers as well as testers in exploring various possible effects of combinations
of different inputs and can be useful in finding ambiguities in specifications also.
Use Case Based Test Design: Once Input field level validations are done using EP and
BVA techniques and derived results are checked for multiple input combinations using
Decision Table test design technique, one should move forward to do testing at a business
function level or transaction level. Use Case is description of a particular use of the system
by an actor (a user or a system) detailing interaction of an actor with the system in order to
achieve specific task. So, Test cases are designed based on use cases to check whether
business functions are really working as expected by use case.
As part of this testing we consider two types of scenarios, a) Primary scenario – which is
most common way / approach used assuming everything goes well and b) alternate
scenario – covering sequence of actions that are different from the one described in
Primary scenario and also includes error conditions.
Customer making reservation, Agent cancelling reservation etc are example of use cases.
Each scenario includes Pre-conditions, Steps and Post-conditions. Once the scenario is
prepared, test cases are derived.
State Transition Technique:
Many times the application is expected to appear / behave slightly differently depending
on the state in which the application is for a given user or a given transaction. For
example, some buttons need to disabled under some situation or menu options / links
need to appear or disappear or some actions allowed / not allowed based on some
situation. Testing for this behaviour of the application is known as State Transition
Testing.
Four things to be remembered, 1) Application can occupy various states 2) Application
can move to only specific states from current state, 3) Only specific transaction or events
are allowed in the particular state, 4) Only specific events results into a transition to other
state and 5) the effect that result from transition.
State Transition table or Graph can be prepared to demonstrate the states, possible actions
in the state and new states due to the actions taken. Test cases are then documented for
each row of the state transition table.
Error Guessing Technique: In addition to various techniques which are based on some
concepts, Experience and Intuition of person can also find many errors including some,
which cannot be found by other techniques. This technique is known as Error Guessing.
Exploratory Testing: It involves testing while exploring the application functionality. So,
you try to understand functionality and features of the application and at the same time
identify what works and what does not work. This technique best used when there are no
or minimum specifications and also for the off-the-shelf software products.
Gray-Box Testing: Towards the end we discussed gray-box testing which can be applied
where information about internal structures and algorithm is not fully available. It provides
benefits of both white-box and black-box testing.
5.7 Exercise
Sr Question
1. Explain Field Level testing covering independent fields and dependent Fields
2. Provide meaning of End-to-End System testing with example
3. Alpha testing is generally done at ______________ site
4. Beta testing is done at _______________ site
5. Differentiate between Alpha and Beta Testing
6. _____________ testing is also known as Factory Acceptance Testing
7. Provide assumptions of Equivalence Partitioning Technique.
8. Black box tester must study and understand the code well for testing using
black box testing techniques
9. __________________ Testing demonstrates that the system works end-to-end
in a production-like environment
10. ______________ testing is about exploring, finding out about the software,
what it does, what it doesn't do, what works and what doesn't work
(simultaneous learning about application and testing)
11. What is single fault assumption theory?
12. Explain EP technique
13. What is the general definition of equivalence class partitioning? Where is it
used?
14. What is the general definition of boundary value analysis?
15. Closed box testing is same as ___________ testing
16. In a specific club there is a rule that only people of age 18 to 60 years can
become member. What technique you will use to validate proper
implementation of this rule. What kind of data you will use?
17. Post office has decided their rates as given below. 25p up to l0g, 35p up to 50g
plus an extra l0p for each additional 25g up to l00g.
Which test inputs (in grams) would be selected using equivalence partitioning?
a. 8,42,82,102
b. 4,15, 65, 92,159
c. 10,50,75,100
d. d. 5, 20, 40, 60, 80
18. Consider reservation function for one event that gives 10% discount to all but
Sr Question
person with gold card membership gets additional 10% and silver card
membership gets 5% additional. However if the members have not paid
membership renewal fees fully then only 3% discount is given
Prepare a state transition diagram OR State Transition Table that depicts the
above rules.
31. What are the key components of State Transition Technique, based on which
Sr Question
the test cases are prepared using
32. There is a program to find largest number from a given set of n numbers.
Design test cases for this program
33. Salesmen in an organisation are evaluated on their performance based on
points they earned during their probation period. There is a program that
displays action to be taken by management as per below rules
0-20 Thank You
21-40 Extend Probation
41-60 Confirmation
61-80 Promotion
81-100 Promotion with letter of recommendation
(a). What technique you will use to validate the input field ‗AGE‘? Why?
(b). Which data you will use to test?
41. State Transition Technique is generally used during ______________ Testing
Options: (a) Unit (b) Integration (c) System (d) Static
So if there are 150 regression test cases and all of them are planned to be automated
but at a given point in time say 40 test cases are automated then automation
coverage would be (40 * 100) / 150 = 27%.
Practically not all regression test cases are automated as it requires additional effort
and cost. However higher automation helps in higher regression testing coverage
and cost saving in long run.
700*10 = 7000 minutes = 7000/60 = 117 hours (approximately) for creating test cases and
700*12=8400 minutes = 140 hours for execution. The actual productivity may not be
same for the next project or module but it certainly helps to estimate approximate how
much effort will be required and planning can be done accordingly. Over a period of time
the estimation accuracy would increase.
Business Requirements are the key inputs for both Development and Testing teams. Based
on Business requirements, functional requirements or function specification documents
are prepared generally by development team. These requirement documents become input
to both development team and testing team and they proceed with their respective phases.
Development team on one side will develop the code and carryout unit and integration
testing. Testing team on the other side will analyse requirements and construct test cases.
At this point of time both the teams work together for Validation and system test
execution phase during which testing team would execute the test cases and development
team would fix the defect reported by testing team.
Objectives and detailed process for each of the STLC phase are described in subsequent
sections.
There are two ways in which the requirements are documented for categories.
Option 1: Single sheet with Category as column
Useful when requirements are for smaller projects
Requirements can be filtered category wise for creating test cases
Only one sheet needs to be maintained
Option 2: Multiple sheets – each for one category
Used for larger project requirements
Benefits of requirement itemization: This process
o Simplifies the requirements and improves understanding
o Helps in identifying different Test Scenarios / Test Conditions
o Helps in identifying testable items for the application
o Helps in Identification of expected and unexpected error conditions
o Helps in identifying any ambiguities in the requirements
4) Identify testable and non-testable requirements
It is also important to check whether all the requirements are testable or not and
communicate to client.
Testable requirements: Any requirement is considered to be testable if it is possible
to design and execute the test under the given test environment so that one can
determine whether the requirement has been met.
Most Requirements are testable such as data validation, form validation, field
validation, & so on
Non-Testable Requirements: There could be some requirements which cannot be
tested because of various reasons
a. Requirements which changes dynamically on web applications. For
example if the session variable for the URL in web application is stored in some
HTTP file and it is changing dynamically.
b. Some implicit requirements where query needs to be raised may be non-
testable in the initial stage, but they may be testable items when the query is
resolved.
For example: If it is not stated who are the users for the application and what
are the access rights for those users in the requirements document then such
items could not be tested unless the query is resolved. Once the query is
resolved these non-testable items will be converted into testable items.
c. Testing requires availability of specific Environment – For example
performance related requirements needing specific HW/SW is not available and
hence out of scope. For online shopping application, the payment module can
be tested only if there is connectivity to application of the bank (for payment
through net-banking). Such connectivity may not be available during testing.
d. „No Limit‟ expectations – For example a requirement says that user should
be able to enter any number of characters in ‗Remark‘ field. Whatever number
of characters with which you try to test, there is need to check whether it can
accept even more characters. Hence, we cannot conclude that there is no limit
to the field.
5) Identify Ambiguities in the requirements and gather clarifications from
customer
We have discussed Ambiguity Reviews in greater detail in section on Verification.
Review all the requirements against possible ambiguity and clarify from users.
If (booking is done for return journey or number of seats booked are four or more)
and gold Platinum card member, you get 10% discount.
Company should have travel service from the locations specified. Passenger can book
tickets to nearby (Distance less than distance between Source and Destination
Specified) locations if there is no travel service between the specified locations
Application should be user friendly and have a provision to provide help wherever you
feel important.
Based on this simple requirement, we can derive Test Conditions as given below.
i. Check that Application displays error if login details entered are not valid
ii. Check that Application displays home page after user logs in successfully
Since this is a very simple requirement, we have not itemized requirements and directly
wrote test conditions. However it is advisable to document itemized requirements and test
conditions for more complex requirements.
The table provided below lists all the itemised requirements (as per previous section) for
Registration Process along with test conditions for each requirement
RF-09 Should have provision to accept Ensure that system displays error if
valid password which is of password does not meet the criteria.
between 6 to 10 characters
RF-10 Confirmation message should be Ensure that when user presses
displayed after successful submit button system
registration process but displays - validates all fields and displays error
error message if any details message when not valid or
entered are not valid
- Displays confirmation message and
inserts registration details in the
database if details entered are valid
As you must have observed, Test Conditions are written to specify what exactly the
condition to be checked in a computerized application. It is based on the specific itemized
requirement
Note that as in case of requirement RF-04, we can come up with some questions / doubts
which we may want to clarify before moving further.
It is not necessary to write test condition just aside the requirement and can be listed
separately. However, it should be possible to link Test conditions back to their sources in
the test basis (requirements here), so that it is possible to ensure that requirements are not
missed out.
Different organizations / teams may use different template for documenting requirements
and test conditions. The format, tool, content and level of detail etc could depend on
project requirement and process standards used in an organization.
Test conditions can also be prioritised, and if required, low priority (not important) test
conditions may be ignored for further detailing in test cases.
Test conditions can be rather vague (not very specific), covering quite a large range of
possibilities.
Detailed test cases then developed based on test conditions which are very specific. We
have already discussed various test design techniques in chapter 5 using which we can
derive test cases.
One may also think of using Decision Table assuming that the outcome depends on
combination of two fields User ID and Password.
Similar will be the case for Null password. Checking of password is important only if
User ID is valid. There is no need to check password if UserID itself is not valid.
Please note that to check this functionality you will have to have some valid users in the
system. This cannot be possible until the system is ready and some registrations are
done. However it would be too late to design test cases if we wait till the registration
form is developed and some registrations are done. In practice, test cases need to be
prepared before the system is ready and hence generally test cases may have to be
prepared and documented without actual data assigned. Such test cases are known as
High Level Test Cases.
High level test case: A test case without concrete (implementation level) values for input
data and expected results. Logical operators are used; instances of the actual values are not
yet defined and/or available.
Once the software development is completed, the test cases with specific input values are
written for the test cases either in advance or at the time of execution.
Low level test case: A test case with concrete (implementation level) values for input data
and expected results. Logical operators from high level test cases are replaced by actual
values that correspond to the objectives of the logical operators
Traceability: The ability to identify related items in documentation and software, such as
requirements with associated tests. Traceability helps assuring that no requirements are
missed out.
Test cases can now be prioritized so that the most important test cases are executed first,
and low priority test cases are executed later, or even not executed at all
Test case Documentation
In order to be able to read, review update and use effectively during actual testing (test
execution) test cases are documented in much proper way, generally in tabular format
as given below. Many organizations also use some tools in which requirements and or
test cases are entered and maintained.
Test Pass
Test Precondition Input /Test Expected /
Condition Test Steps
Case ID s (If any) Data Result Fail
/ Scenario
..
Test Case ID: Each test case is given a unique identifier. There could be thousands of test
cases for a given system under test. Giving unique identification to each test case helps in
tracking the test cases.
Pre-Condition: Environmental and state which must be fulfilled before the
component/unit can be executed with a particular input value. Before you execute a
specific test, the system should be in the state mentioned here. Test Preconditions can also
include availability of required test data in the database. For example in case of Login
functionality there must be some valid users available in the system so that we can test
whether system works fine (displays home page) if valid user ID and Password entered. If
the precondition is same for all the test cases, precondition can also be described only
once.
Test Steps: A detailed description of steps to execute the test. One may also include Step
Number for each step.
Test Data/Input: Inputs & its combinations / variables used
Expected Result: include information displayed on a screen in response to an input, and
also include changes to data and/or states, and any other action triggered (e.g. email to be
sent etc)
Expected output and actual output are compared to determine Pass / Fail –
If the program works as given in the specification, it is said to pass otherwise Fail.
Additional columns: In addition to above columns, each test case may also include many
other information such as
Test Condition ID, Requirement ID (for tracing back to Test condition or
Requirement)
Step Number: Showing the sequence in which the steps are executed.
Actual Result: Indicating what was the actual outcome by the system. This may
particularly help if the test case has failed.
Also note that one test scenario or condition may result into multiple test cases and can be
based on any of the techniques learnt.
Test Procedure (Test Script):
Please observe that there are three test cases written in the same table in a specific
sequence. As such all three test cases are independent of each other and can be
executed in any sequence but if you execute test case 3 (TC-03) first and if the
application worked properly then a home page will be displayed. Now in order to
execute TC-01 and TC-02 you will have to first log out otherwise you will not see
option to log in if you are already logged in. Similarly all test cases will have pre
conditions. So, it is always advantageous to document and execute the test cases in
such a way that after executing the current test case you are brought to the pre-
condition of the next test case.
Note that whenever we do testing, we are providing some inputs, submit and then
system will provide some output which we compare with expected result.
Some processing can be done immediately when you provide some input in one single
field. For example basic validations are done immediately. So if you enter say some
character in field for number of tickets, system may immediately respond with an error
message or if you enter / select flight number, fight name, airline name time etc could
be immediately displayed without waiting for ‗Submit‘ button.
In some other case you have to provide inputs to all the fields and submit the form
then only some processing will happen. For example, actual reservation happens only
when all the details are provided and submitted. Sometimes validations are also done
after submission of form.
It depends on implementation of the functionality.
So, the test cases are generally organized in a specific sequence for the entire
form till submission step is executed.
This does not apply to only field level test cases but also applied and important for
functionality level testing. So, if you execute the test cases for Registration functionality
first, then Login functionality, then booking functionality, you will be able to save time
as execution of previous functionality can put you to precondition of next functionality.
The execution of previous functionality may also include inserting some data in the
database which would be used for testing the next functionality.
If the test cases for different functionalities are documented separately then Test
Procedure Specification document will specify sequence.
So, as part of the test procedure document, test cases are grouped in a sensible way
along with sequence in which they are to be executed during execution phase.
So, test procedure specification is a document specifying a sequence of actions for
the execution of a test. It is also known as test script or manual test script. [After IEEE
829]
Separating Input data to reduce / avoid redundancy
As you can notice the steps for all the above test cases will be same and under current
format all the steps should be repeated. However a simplified format can be used where
you write steps only once and data to be used are separately written in different table.
While executing the test case, tester will need to follow same steps for all the data sets
given in different table.
Pass
Test Precondition Test Condition / Input /Test Expected
Test Steps /
Case ID s (If any) Scenario Data Result
Fail
….
Using Test Design Techniques to derive test conditions and test cases.
Please note that the test cases written above are not enough. We have to use all the test
design techniques we discussed earlier for designing test case.
Equivalence Partitioning (EP) and Boundary Value Analysis (BVA) for all individual
field level testing
Decision Table for all business rules dependent on more than one fields
State Transition Technique to check transition from one state to other and
corresponding valid/invalid functions or actions
Use Cases for all variations of business functions and transactions.
Experience for any other important aspects not covered by any technique but based
on past experience and intuition of the tester.
I am reproducing some of the test cases we had discussed as part of Test Design
Techniques.
Test Condition: Travel Date validation. Ticket booking is allowed for next one year.
Assume that today‘s date is 18-Sep-19
Test Condition: Name can contain only characters. Class is Mandatory and can contain
only one of the three possible values
Test Conditions: Number of tickets need to be entered and should be between 1 and 10.
Technique: EP and BVA
Requirement: Unregistered user can view flight details but cannot book ticket. Once
registration is done, application displays login page.
Technique: State Transition
b) Users are created as per the user roles played by the testing team members and
required access given to all the users (testers). Access is also given to other
required resources if required
3) Test Data Setup: This is important so that different conditions can be checked
with these data
a) All masters are setup with some test data. For example, Flight details between
some locations are made ready
b) Charge master is set for all travel classes as per business requirements
c) If testing is done only for some specific transactions such as cancellation of
ticket, then some data for base transaction may also have to be kept ready
d) If the testing is to be done for enhancement or changes in the functionality,
production data can also be copied to test environment so that time can be
saved.
4) Smoke Test:
Here very high level testing is done just to ensure that user is able to move from one
step to other and there are no show-stoppers. The objective is to check if the build
received for testing is testable or not. For example various menu options work, clicks
on buttons are possible. Business rules or expected results are not checked but we only
ensure that detailed testing will be possible. Many times if environment set-up or data
setup is not done properly then we face some issues and we may unnecessarily waste
time during testing. This is also known as testability checking
5) Actual execution of test cycles and Defect Management:
Only after we ensure that proper setup is done, we start execution of actual test cases.
We use the test cases as designed in the test design phase.
For each test, we bring the application state to pre-condition, follow the steps
mentioned, input the actual data as specified and observe the system response. If we
find that the actual result we get while running the application is different than
expected result, we conclude that there is a defect in the system and the step is marked
as ‗Failed‘. The root cause could be wrong configuration, failure of test environment,
corrupted data or even wrong test case itself. However if the root cause is really an
issue in the software, it is known as a defect. Such defects are reported by testing team,
fixed by the development team and closed by testing team after retesting. While
reporting the defect we provide all the details such as steps followed, data entered etc.
In some cases we may also attach screen shots showing result. This process may be
repeated many number of times till all or most of the defects are fixed.
The defect is also known as incident, problem, issue or bug.
It is practically possible that during the process of this testing phase some requirements
may change or some new defects get introduced. It is hence advisable to run more than
one test cycles. How many cycles are required will depend on criticality of application,
defects found and any other criteria decided. Many organization plan for 3 cycles for
business applications.
6) Check the Exit criteria and do test closure activity – prepare test summary
report:
It is practically impossible or very difficult to come to a stage where there are absolutely
no defects in the application. At some point of time, we have to stop testing keeping in
mind budget, time and quality level. So, organizations will come up with some criteria
and team can decide to stop execution cycles and move application to production if
those criteria are met. The criteria could depend on various factors such as criticality or
the functionality, timeline available, market situation and potential impact.
For example criteria could be
a. There are no known critical defects (High severity) pending to be fixed
b. Not more than known 10 medium critical defects available
c. There could be 30 known low critical or only suggestion for improvement type
of defect pending
Functional, Regression and non-functional testing if required are done during this
phase and continues till defined criteria are met for the project.
Please also note that test execution could be manual and/or automated.
Test Cases for Login Page
Let us revisit the test case we have written for testing login page.
Test
TC Preconditions Expecte Actual
Condition / Test Steps Input /Test Data
ID (If any) d Result Result
Scenario
Enter User User
The Name Name=InputVar1
To validate the
application is
TC_ login page Enter Password=
invoked and
01 with null password Inputvar2
login page is
password
displayed Press LOGIN Result
Button Var1
keep it blank this will assign bug to module owner or Manger will assign bug to developer.
Reported By – Name of the tester who is reporting the defect. This help if developer
needs some clarification about the defect from the tester.
Attachments – One can attach some files with the defect to give some more information
or screen shots if any.
Name and the contact information of the tester
Tentative fix date – the date by which the defect should get fixed. This would mostly be
set by development team
Resolution details – Details of the action taken to correct the bug
Status – It indicates what is the current state of the defect. When you are writing the
defect in the defect report or entering it in any tool then by default the status is ‗New‘.
Later on bug goes through various stages like Fixed, Verified, and Reopen etc as explained
in next section.
o Application module wise, severity wise defect summary of open and closed
defects
o Category wise severity wise open and closed defects
o Expected dates for fixing and closing of high severity defects
New – When a Defect is logged and yet to be assigned to a developer. Generally for
smaller team, tester may know which developer should be assigned the defect but for
larger team, Project Manager or Development Lead will decide.
Assigned – indicates that the developer who would fix the defect has been identified
and has started analysing and working on the defect fix.
Duplicate – Manager or Developer will update the status of a defect as ―Duplicate‖ if
this defect was already reported earlier.
Cancelled– This status indicates that the developer is not considering the defect as
valid due to any of the following reasons
a) Not able to reproduce
b) Not a valid defect and the expected result is as per requirement
Benefits of Tools
Different tools may have different features but following primary feature are provided
by almost all the tools.
a. Built in validation checks
b. Reduced Turnaround Time and other communication issues
c. Available - 24x7
d. Maintenance of history
e. Generation of summarized information, metrics
f. Ability to quickly search on specified criteria
g. Multiple attachments
h. Online/ real-time status through queries/reports
Many additional features may be provided by some of the popular tools
i. Proactive notification when no action taken for a defect on due date
j. Involvement of translator for translation when needed
k. Understand number of items on which actions to be taken
l. Change Request approval process
Software Quality Assurance and Testing Nitin Shah
Page:204 SW Testing Project Execution Process
As mentioned above, one can derive many benefits with the help of tools. It will not only
reduce effort but with real-time generation of report, it can help management to have
improved project control.
6.3 Test Plan
As you can see, testing project itself is a very intense activity involving multiple stake
holders, resources, tools and of course considerable amount of time. This is a full-fledged
project by itself and hence need to plan properly. So, the testing project manager would
prepare and document a detailed plan that would cover at least following sections.
Scope: Describes what is in scope and what is out of scope. So, it will include list of
applications, Modules, Functionalities, Testing Objectives and types within the scope
and outside the scope.
Strategy: Describes how testing will be done. Will it be only manual or automated also?
Which techniques to be used and at what level the testing should be done?
Milestones: Describes start and end dates of various phases / tasks (Refer STLC
phases)
Quality Gates: Describes how quality of testing activities will be ensured through
various reviews. At what stage a detailed status review should take place based on
which some decisions may have to be taken for the continuation of the project.
Entry/Exit Criteria: Describes what are the preconditions to enter into a specific
STLC phase and what should be completed to go to the next phase. For example, on
what basis one would say that requirement analysis phase or test design phase is
completed?
Resource Requirements: Provides details of what hardware, software and human
resources required. Number of testers required would depend on total size of the
project (eg. Number of test cases), Expected defect density and productivity.
Roles and Responsibilities: Describes who will be playing various roles and what
they are responsible for.
Communication: Describes how communication will happen between various teams
and how status of the project will be reported
Defect Tracking and Resolution Process: This section describes process to be
followed for Defect tracking and resolution.
Risk Management: Describes all potential risks which can impact quality or timeline
of the project and what steps to be taken to mitigate the same
Assumptions: Describes all the assumptions taken while planning
Let us understand some of the important sections in detail with example.
• Will Risk based testing Approach be taken? If yes, what are the considerations?
• Can automation be done? If yes, then which part and how much?
Hardware
Software
Tools: / Quality
Center
Tools: MS Project
Automation
Test Environments
• Progress reports – This provides details of the progress of various activities being
carried out against the planned progress.
• Automation Report – It provides progress of the automation creation and
execution activity.
• Defect Reports – This provides list of all the defects at a given point of time along
with status
• Defect Aging Reports – It provides number and list of open defects as per their
age. Age is calculated based on defect open date and current date.
• Release Metrics Reports – It provides metrics and related analysis for various
metrics calculated (coverage, Productivity, Quality etc.)
Frequency
The above mentioned reports may be generated every day or every week and some
reports may be generated every month.
Project Health Indicator
Depending on status of the report, health indicator is decided and provided as per
guidelines below.
6.3.10 Assumptions
This section provides all the assumptions taken to carry out the project. It can include
dependency on various external factors or any requirement of taking deviation from
standards due to various reasons.
Examples
• Testing team will start regression testing along with functional testing in order to
meet timelines
• Test environment will be set-up by Development team with all necessary changes
• Development team will help in preparing Test Data required for functional and
Regression testing
• It is assumed that Development teams will be doing proper unit and integration
testing to assure required code quality before system testing starts
• Not more than xxx defects are expected in code.
• All Queries will be resolved within two working days
6.4 Summary
We discussed in earlier chapters that Tesing is important and we need to do testing at
different levels of development phases applying various techniques. Quality of testing
process and activities is very important and hence a well-defined process needs to be
followed. We also need to quantitatively measure some testing and process related
parameters which are known as Metrics. We discussed Coverage Metrics (Design
6.5 Exercise
Sr Question
1. Explain meaning and purpose of metric using example
2. Explain any four metrics with examples
3. A metric that determines % of Test cases executed is known as ___________
Options: (a) Test Design Coverage (b) Test Execution Coverage (c) Automation
Coverage (d) Test Case Creation Productivity
4. Explain Defect Removal Efficiency metric in brief
5. Explain Requirement analysis phase from testing perspective
Any requirement which cannot be tested at a given point of time is known as
6.
_______________ requirement
7. Give any two examples of non-testable requirements
8. What are the differences between Ambiguity & Defect (any two)?
9. One requirement can have multiple test conditions / test cases.
True / False?
10. One test case may have multiple test steps.
True / False?
11. A set of input values, execution preconditions, expected results and execution
post conditions, developed for a particular objective or test condition is called
_________________
12. Describe what is generally written as pre-condition in a test case
13. Explain test case template with suitable example
14. While preparing the test design, what should be done to establish traceability
15. There is a program that takes two inputs Product code and quantity, takes price
of the product from the database and displays cost of the product and discount,
and final cost after discount. 10% discount is given if the quantity is 10 or more.
Prepare test case in the test case format with all the detailed step
16. What is the entry criteria for test execution (What should be completed before
test execution for system testing starts)?
17. Explain Smoke testing in brief.
18. Explain what are the statuses that a Defect can occupy?
19. If Development team is not able to reproduce the defect, they will change the
status of the defect to ______________
20. If testing team finds that the defect is actually not fixed or reoccurred even if
development team mentioned that it is closed, testing team will change the status
of the defect as _________
21. State when the defect will be considered as Differed?
22. State any 5 features provided by Defect management tool
23. State any 3 advantages of using defect management tool
24. What are the key expectations of Development/Maintenance Engineer from the
defect report?
25. State at least 6 important attributes of the defect report (Provide at least 6
different details provided by testing team while reporting defect)
26. Testing team cannot change the status of the defect to 'Fixed'.
True or False?
27. Development team can change the status to 'Closed'.
True or false?
28. What are the phases of SW testing life cycle?
29. A login form takes user name and password data as input in two text boxes and
Checks for valid user name and password. Enters home page if user name and
password is valid Else it displays error message
Write Test Cases for above requirement in a standard test case format (Test Case
ID, Precondition, Test Condition, Test Steps, Input/test data, Expected Result)
30. One of the entry criteria for Functional testing is: - Code is delivered and
successfully promoted to the Functional/System Test Environment as described
in Master Test plan.
True or False?
31. This is not one of the entry criteria for Functional testing: - Functional/System
test planning is detailed, reviewed and approved within the Master test plan.
True or False?
32. Explain how to design and execute test cases with suitable example
Definition: Test automation is the use of special software (separate from the software
being tested) to set up test preconditions, control the execution of tests and then
comparison of actual outcomes to predicted outcomes and report
Commonly, test automation involves automating a manual process already in place that
uses a formalized testing process.
Note that our intention is to get high level understanding of test automation meaning,
standard feature provided by various tools and the overall process. So, you may have to
refer other documents/books and manual of corresponding tool you may want to use to
actually automate your tests.
- Enter specific url in the browser to open the application‘s login page.
- identify text box for UserID and enter specific User ID say ‗Admin‘,
- Identify text box for Password and enter specific password say ‗admin12‘,
Similarly you can notice in the 6th statement, the click action to be applied on the
button object.
The 7th statement is to verify that the object with error message ‗User Name or
Password is Incorrect‘ appears because the password entered is actually not correct and
we are expecting application to display a dialogue box with this message.
In order to do such scripting, one has to learn scripting language supported by the tool.
The tool/supported scripting language provides many such commands to take various
actions (very similar to the one taken by human being) and also for verification.
Additionally, tools also provides many features as described below
1. Record and playback features
It allows users to interactively record user actions and replay them back any number of
times. You have to activate recording in the tool by pressing the ‗Record‘ button and
then run the application under test. Whatever action you take on the application are
recorded and a script will be directly generated. For example, take following action on
login page after pressing ‗Record‘ button on the tool.
Open Brower
Enter url for the application
Enter User ID
Enter Password
Click Login button
Once recording is completed, you can stop recording by clicking Stop button. The tool
will automatically generate statements in scripting language for each action you have
taken. You can the save the script for future use.
When you play back the script, same operations are then performed by the tool.
Note that while recording, the objects are automatically identified and saved in the
object library. If you need to identify objects which are not involved in recording
session, then you need to manually identify those objects and save in the object library.
All tools provide mechanism (sometime known as object spy functionality) to do that.
Some tools may support multiple scripting languages.
The automation script can be enhanced to incorporate verification statements that
compare actual results with expected result
2. Programming capabilities
In addition to recording feature, the tools also provide programming feature that allows
you to modify the recorded scripts or create a new script for some or more of the
following aspects
Setting up of test preconditions – eg. Open browser, login and click the menu
option which will open the registration form which you want to test.
Incorporate various programming constructs such as If then else, Loop etc –
There could be situation in which you need to provide some additional details only
if some specific values added in previous fields. For example, while booking the
ticket, if number of passenger traveling are 3, then you need to take passenger
name, age and gender three times. The tool provides this facility to include for loop
which will be executed three times.
Parameterize the inputs and take data from the data source
Instead of hardcoding input values in the script itself, you can use variable whose
value can be read from excel or data based table. The objective is to be able to pick
different values at run time or use. Parameterization can also be done for
checkpoints. It Reduces Time and Effort
Incorporate Verification points. The tool can capture various html elements and
their properties that can be used for comparing with expected outcome.
For example, on entering valid User ID and Password, the application should
display home page and on entering invalid User ID and Password, the application
should display a specific message. So, one can write a command to check whether
specific error message element exists or not. Similarly many verification commands
are available to read and compare text of the label, font colour, font size or
alignment etc and even compare two values.
Report test results without human assistance. When the script is executed, the
tool reads the command and accordingly take various actions on the browser (for
Web application) and prepares a log showing execution of each step. Similarly it
maintains the outcome of each verification and accordingly putting the status
whether the test case has passed or failed.
So, Using various commands one can
test the existence of UI elements based on their HTML tags,
Check for specific content,
Check for broken links, input fields,
selection list options,
submitting forms, and table data
Apart from the basic features provided above, different tools provide many other
features as described below.
Support multiple browsers and platforms.
Minimal Script development effort (excel like input instead of scripting command).
Software Quality Assurance and Testing Nitin Shah
Page:220 SW Test optimization
Supports Data Driven Testing (use different data sheet/Excel or database table to
store data and pick the data while execution). Develop and use data files with set of
variables and corresponding values for data driven testing
Allows Reusable functions (also referred to as keywords). For example, you
want to ensure that all the labels of all the forms should have standard height,
width, font size and font colour, you can create a reusable function to receive the
label object, verify all these parameters and pass on the result back to the calling
script. This can reduce lot of coding to be duplicated in different scripts.
Clubbing of test scripts to make test suits for End-to-End scenario testing. For
example login process may be required for almost all the test cases (particularly
based on various use case scenarios). So, one can have separate scripts for Login,
Book Flight, Make Payment, Print ticket etc and club them in different test
scenarios as per requirement.
Exception handling and reporting. With this feature, you can specify whether you
want to continue further testing or want to stop execution or even perform some
other task if test case fails.
Detailed (Test case wise) and Summary wise HTML reports which can be
customized
Set up global variables which can be used for some standard details.
Based on the above analysis, the test cases are categorized into following four catagories
As an example, we would ideally follow the procedure of testing valid partitions first, then
invalid partitions, then valid boundaries and finally invalid boundaries.
However, test objectives can help us decide what to test. We may do testing for valid
partitions only. If you want to find as many defects as possible as quickly as possible, you
may start with boundary values, both valid and invalid. If you want confidence that the
system will handle bad inputs correctly, you may do mainly invalid partitions and
boundaries. Your previous experience of types of defects found can help you find similar
defects; for example if there are typically a number of boundary defects, then you would
start by testing boundaries.
The risk based testing provides many benefits as listed below
You can give up tests (do not execute) you worry about the least with low impact on
quality so that the time and effort can be reduced but overall quality is not much
impacted
Pick the right tests out of the infinite possible tests reducing effort
Since you prioritize the tests based on risk analysis indicating which are must test, Should
Test, Could Test and won‘t test, the likelihood of discovering high severity defects are
faster to resolve (―find the scary stuff first‖)
Make smart release decisions. With this approach, the analysis and test results can help us
deciding when to release the product - ―release when risk of delay balances risk of
dissatisfaction‖.
Risk-based testing involves both
mitigation - testing to provide opportunities to reduce the likelihood of defects,
especially high-impact defects - and
contingency - testing to identify work-around to make the defects that do get past us
less painful
7.3 Summary
SW testing requires good amount of time and effort. There are many reasons because
of which some functionality which was earlier running properly may stop working
properly due to changes done in the system. So, many test cases which passed earlier
may have to be executed again. This adds up to the overall time and effort required for
testing. Automated testing and Risk based testing helps to reduce both time and effort.
Test Automated testing means carrying out testing using some other tool in the similar
manner as done by human being. Many open source and commercial tools are available
in the market. The tools can identify object and take required action on the object in
the same manner as we do. For example, I can open browser, it can input some text in
the text box, click a button or link. It can also verify availability of objects on the screen
and compare values. Most tools provide record-play feature in which all the actions
taken by human being to test a specific functionality are recorded by the tool and it
then generates Automation Scripts. These automation scripts can be directly replayed
or can be modified as per requirement and then executed. All tools have programing
capabilities through which control statements (such as If..Then, Loops), include
parameters for taking data from external files and can also incorporate verification
points. Scripts generates test results after execution. So, it is possible to quickly create
automation scripts for many regression test cases, Modify the scripts, add checkpoints
and use parameters to read data from external source. Run the tests and analize the
results. Automation is best suited for test cases which are run frequently, or which has
same steps but uses multiple data sets, or test which requires high precision and can
also be used to generate large number of data in the system. Since automation also
require time and effort, it can not be used for exploratory tests, tests which will never
fail, usability tests. Automated testing helps executing large number of tests very fast
and hence it becomes possible to cover large number of regression test cases.
It may still be possible that team do not have time to execute all the test cases (manual
or automated). Under such situation, risk based testing can be applied in which first of
all test cases are categorised into ‗Must be‘, ‗Should be‘, ‗Could be‘ and ‗won‘t be‘
categories and execution is prioritised accordingly. The categorization depends on
assessment of requirements – usage, financial impact, compliance requirement etc or
Technical assessment considering criticality and newness of functionality, Skill level of
developer, code complexity etc and also based on testing related risk assessment
considering history of defect, effort / time available. Risk based testing helps in
optimizing effort where time and effort is reduced without compromising much on
quality.
7.4 Exercise
Sr Question
1. What is test automation
2. Explain benefits/reasons of test automation
3. For which type of testing, test automation is most useful?
4. Automation should not be done for test cases that does not fails. Is it true?
5. Give examples of commercial and open source test automation tools
6. Explain Automation process for software testing optimization
7. Explain Risk based testing with suitable example
8 Testing Types
Software testing types are based on specific requirement type or Objective which includes
1) Testing of a Function (Functionality Testing)
The function of a system or component is ‗What it does‟ or „what it is supposed to
do‟. Functional Testing covers all the functions and features specified in the high-level
design and demonstrate that the system works correctly in a production-like
environment. Functionalities and features specify what the system should do or how it
should work. This includes different transactions being carried out by different users of
the system.
So as part of this testing, we test registration process, Ticket booking process etc and
within that we test various features of the system such as - it allows payment through
credit card, Debit card or Net Banking and so on. We also check that the system does
required validations for all inputs and throws proper error messages for wrong inputs.
We also ensure that system accurately generates various reports helpful to customers
(such as past travel history, Reprint of ticket etc). The result of each test would be
whether it is passed (met the requirement) or failed (did not meet the requirement).
So it is aimed to verify
Business Processes; rules and constraints
Interfaces with other systems including manual system
User Interface (Forms, Reports)
All the test design techniques we learnt (White Box, Black Box and Experience based)
are primarily used for Functional testing. Please refer section 6.2.3
In the current scenario of globalization, many applications are used by users across the
world and / or many application products are developed in generic way so that its
functionality can be used internationally or the product can be customized easily to
meet local functional requirements when implemented in different countries. So, apart
from basic Functional Testing, Functional testing also includes Internationalization
Testing and Localization Testing
2) Testing of Software Product Characteristics (Non-Functional Testing)
It covers quality characteristics of the system. It is ‗How well it does‟ or ‗How fast it
does‟.
This includes Performance (Response time), Usability (How attractive it is and how
easy to use) or Security (How much secure it is). Such issues if available do not
provide good experience to the user even if the system works functionally well
(correctly). The result of the test would not be passed or failed but would be in terms
of the extent to which the system is fast or secured or usable.
It also includes System management issues: Installation, Configuration, Portability
3) Testing Related to Changes
Every system undergoes some or the other changes due to various reasons. Some
functionality hence may need to be tested again and again to ensure that the changes
have not impacted the previously working functionality and defects are fixed properly.
Otherwise something which was working earlier may not work properly after change.
This is also known as Regression Testing.
Testing activities are organized based on the testing type (Objective) at each level.
We will discuss each Testing Type that meets each Requirement Type in greater detail in
subsequent section
8.1 Functional Testing
Functionality: The capability of the software product to provide functions, which meet
stated and implied needs, when the software is used under specified conditions. [ISO
9126]
Function – A function is described as a set of inputs, the behaviour, and outputs.‖.
It refers to actual operation/process such as Registration, Booking, Ticket printing etc
So, Functional testing considers specific behaviour of a function describing a set of
inputs, the behaviour, and outputs as expected from specifications.
There are only two possible outcomes for each test – met or not-met. So, this requires a
very clear expected result. The results generally depend on actual product (or code of the
product) and not on environment.
Functional testing is done in all phases/levels such as unit testing, Integration testing,
system testing and acceptance testing and generally using Specification Based techniques.
Even experience based techniques also used. Some people consider Functional Testing
and Black-Box testing same but it is not true. Functional testing is generally done using
black-box test design techniques, even non-functional testing is also done using black-box.
Warning Message pops up when the mail containing an attachment is closed and
that attachment is still open
When the input value is too big.
Look for misplaced error messages
Insure that the expected error message does occur and provides the user with helpful
information.
Ensure that Error Messages are displayed When software components interact with
other components (hardware or software) that are subject to errors or faults, the calling
software component must handle errors and recover properly
E.g.
Remote connections being dropped
security denials
Performance problems
No such messages should appear: "Error 949 - Unknown Error"
Check for a shared database content that is unexpected. As other systems begin to
interface and update the shared database, initial data purity assumptions may be
violated.
Check for the Disk being full
Note: The sample report shown above is not from Aireline reservation system. However it
can demonstrate how the layout etc are considered while generating report.
Elements important for testing reports
Content - Data printed on the report should match the expectation. It should
not happen that you want to print list of passengers registered today but it
displays list of passengers travelled today.
Right data printed in the report? The content should be correct. For each
column
Report for the right selection – period, category. If the period selected is one
day, all the data of only that date should be displayed. If it is a period, then all
the data only from hat period should be displayed.
Data reported up to date (data source's status)? Many reports display details as
per status of the entities. For example, if we need to display all passengers who
registered till yesterday then passengers registered today should not come.
Summations and calculated data derived from databases
Accuracy of Totals – Group total, pager total, report total
Schema – The structure of the report should be as expected
Format & layout
Report formats are the columns, headers and footers on a page.
Report Width / number of characters per page
Lines per page, Spaces between columns
Top/Bottom/Left/Right Margins
Page Numbers
Date and Time stamp
Summary page
Position of various objects/graphs/pictures etc
Record formats are the fields within a record.
Aesthetics – Look and feel – Consider layout, colour, typeface and related
characteristics
Display characteristics - optimal use of screen size and resolution.
Time sensitivity – Ability to use, acquire important features, functions and content
Consistency – the layout characteristics are consistently used in all the programs of the
application. For example, Short keys and menu selections, Terminologies used,
Placements of buttons such as OK and Cancel, and even size, font and colours used
for all controls are consistent.
Flexible: It provides more options and ways to accomplish the same tasks. It provides
ability to skip some steps which are not important for some users. Also there could be
different ways to enter data and see the results (Eg Type the data, Copy Paste from
other place, Import / Export, Voice to text conversion etc).
Error Handling: Consistent and easy to understand error messages for wrong data
inputs
Online Help: Provision to guide the user to understand each data inputs, separately
marking mandatory fields, steps to accomplish a specific task and availability of FAQs
where required. Online help is indexed and searchable. Ideally natural language queries
are best.
Personalization - Web application tailor itself to the specific needs of different user
categories or individual users?
Many of the aspects may be tested along with the functional testing for widely used
applications; Most product development organizations give lot of focus on usability
testing. Proper testing should also be done for static websites for usability.
Sample Test Cases
extreme near or far sightedness, dim vision etc.) Hearing impairment (Partially or
completely deaf people may not be able to hear onscreen videos audible help or system
alerts). Motion Impairments (There may be people who lost motion control of their
hands or arms and hence cannot use keyboards / mouse properly). It is important that
widely used applications have multiple options so that it is easily accessible by these kind
of partially disabled people. Applications should take advantages of operating system
features such as
StickyKeys – Shift, Ctrl and Alt keys stay in effect until next key is pressed.
FilterKeys- prevents Brief, repeated (accidental) keystrokes from being recorded
ToggleKeys – Plays tones when Caps Lock, Control Lock or NumLock modes are
enabled.
SoundKeys-Creates a visual warning whenever the system generates a sound
ShowSound tells the programs to display captions for any sounds or speech they make
HighContrast – set up the screen with colours and fonts designed to be read by the
visually impaired
So, if the application is expected to be used by partially disabled people, testing should be
done to ensure that above features are incorporated in the system as applicable.
example, Higher Secondary board exam registration. One must have noticed that
towards the last few days of the registration completion date, the application response
time is degraded. Similarly when examination results are announced, all the students
tries to connect to the application and many students are not able to access.
So the Objective of Load testing is to ensure that Application handles extreme load
without unacceptable operational degradation.
The Expected load and the specified transactions on the system may vary from
application to application.
Please note that number of simultaneous users may be much less than total number of
registered users. The count of users simultaneously accessing application may also
depend on time of the day, day of the month or a season. All such parameters need to
be considered while carrying out load testing.
If you expect on an average 300 users access the application simultaneously but during
peak time 800 users Simultaneously access the application, and the expected response
time to be within 5 seconds, we need to ensure that response time is within 5 seconds
when the load is up to 300 users and may degrade by 1-2 seconds only when the load is
up to 800 users. However even for the load of 500 users if the performance degrade
below 10 seconds, one must report it as bug. We need to understand load profile of
the application before carrying out load testing
Load profile: A specification of the activity which a component or system being
tested may experience in production.
Example: Around 500 users will login at a given point in time: Start with 5 users and
5 users added every 5 seconds. 50% of the users will be viewing the flight details,
20% will be viewing their ticket status and 20% will be booking tickets, 10% will
generate various reports
A load profile consists of a designated number of virtual users who process a
defined set of transactions in a specified time period and according to a predefined
operational profile.
Stress Testing is a type of performance testing conducted to evaluate a system or
component at or beyond the limits of its anticipated or specified workloads, or with
reduced availability of resources such as access to memory or servers
Stress testing involves subjecting the program to heavy loads or stresses that demands
resources in abnormal quantity, frequency, or volume and analyze the maximum
limit of concurrent users the application can support.
The objective is to see what happens when the system is pushed beyond design limits and
try to break. For example
Generate 5 interrupts when the average rate is 2 or 3
Software Quality Assurance and Testing Nitin Shah
Page:244 Software Testing Types
- they are able to maintain the response time below 5 seconds or not.
- At what point if time the system will start deteriorating drastically
- If the transaction growth increases beyond expectations, upto what level the system
will be able to take the load and will not break.
Performance, Load and Stress testing can help to answer these questions.
Memory Overwrites
Once a block of memory has been allocated, it is important that the program does not
attempt to write any data past the end of the block or write any data just before the
beginning of the block. Even writing a single byte just beyond the end of an allocation
or just before the beginning of an allocation can cause disaster. It is a possible
candidate for turning on overflow buffers.
Memory overwrites occur when too little memory is allocated for an object and when
program attempts to write large data into the memory allocated, some data may be
written past the allocated block which probably used by some other object. This results
into memory corruption and intermittent failures. So program may work correctly some
times and fail at other times. Such issues are difficult to find using black box testing
techniques.
Database tables not Indexed as required.
Most business applications will need to access data from the database with hundreds of
tables and sometimes millions of records within tables. Depending on the conditions
used for accessing data, system will take time. The time required would be less if there
are indexes available on the required table columns. One may need to refer database
material to understand these features.
As part of the design reviews, one should check for such requirements.
Let us assume that the original SQL in Program is SELECT * FROM Passengers
WHERE Passenger_name = ‗InputValue';
Where InputValue = anything' OR 'x'='x;
So the constructed SQL would be: SELECT * FROM Passengers WHERE
Passenger_name = ‗anything‘ OR 'x'='x';
The 'x'='x' clause is guaranteed to be true and will result in returning every item in the
member database. Even entire query can be inserted like this.
So, Special characters from user inputs should be handled / escaped properly. Entering
a single quote (‗) in any textbox should be rejected by the application.
For testing purpose, one can create temporary table and attempt to insert into it or
update or delete some data from that table (it is risky to use any live/active table which
has live data).
If the tester encounters a database error, it means that the user input is inserted in some
query which is then executed by the application. In such a case, the application is
vulnerable to SQL injection
4. XSS (Cross Site Scripting):
When a user can inject code (inserts HTML/ client-side script) in the user
interface of a web application and this insertion is visible to other users, it is called
XSS.
Attacker can use this method
To execute malicious script or URL on victim‘s browser.
To use scripts like JavaScript to steal user cookies and information stored in the
cookies
So, Any HTML e.g. <HTML> or any script e.g. <SCRIPT> should not be accepted by
the application.
5. Spoofing: The creation of hoax (fraud) look-alike websites or emails by creating of
TCP/IP packets using somebody else's IP address. Routers use the "destination IP"
address in order to forward packets through the Internet, but ignore the "source IP"
address. That address is only used by the destination machine when it responds back
to the source
Parameter Description
Page Load Time time taken for all pages to load fully
Accessibility Tabs, Tab Order, Headings, Rollovers, Scroll bars, Table
presentation,
Cookie Handling application behaviour after clearing cache
Data Verification Accurate data is displayed
Data Entry data can be entered into all fields; and application handle
invalid inputs.
Email Links able to send an email on clicking the Email link
Images Images are displayed properly in terms of size and
alignment
Links (Navigation), All the links are Navigating properly including third party
Back Link sites
Compatibility Testing also should take care of Backward and Forward Compatibility, Data
Sharing – Export / Import compatibility. Compatible with standard Word, Excel formats
when allowing some object in to your application. Allowable image formats, Allowable
video formats, voice formats etc
It is assumed that if the changes have affected the specific function, error should come
while testing some sample test cases. It is better to test few test cases from all functions
rather than doing extensive testing only for some functionality and doing no testing for
some other functionality.
Generally detailed impact analysis is done based on the changes and possible impacted
functionalities are identified. Some more test cases are selected from those areas.
Tests for software components that have been changed. Almost all the test cases are
selected from the functionalities which are actually changed. The changes in requirements
would need some new test cases to be added or some test cases to be changed.
Regression testing is also suggested when some aspects of the environment changes. For
example, when a new DMS version is introduced or new version of compiler is used.
Since these test cases are executed multiple number of times in the project life, they are
best suited for automation and are generally automated using relevant automation tool.
It is important that the regression test suit is maintained continuously. New sample tests
should be added from newer functionalities added and the existing tests should be
modified if related functionalities changed. Similarly some tests from the suit can be
eliminated if related functionalities removed from the system or even because tests have
not found a defect for a long time.
8.4 Summary
At a high level, Software testing can be divided into two types – Functional and Non-
functional. Functional testing is done to test functional requirements and we try to ensure
that system is doing what it is supposed to do and it is not doing what it is not supposed
to do. We discussed all the techniques in details which can be applied for functional testing
in previous chapters. Apart from that we covered Testing of error messages, Report
validation and Localization/internationalization testing in this chapter which are also
considered to be part of functional testing.
As part of Error message testing we try to ensure that proper, relevant, and helpful error
message appear at right time at right place. Also the style approach and content provided
in all error messages follow specific guidelines so that they are consistent for all types of
errors that could appear in entire application.
Similarly as part of report testing we try to ensure that right content for right period or
right categories as expected accurately appear in the report and also ensure that the report
format, margins, layouts, spacing, report heading, column headings, calculated numbers,
System date and page number etc are correctly displayed at a right place.
We then discussed Localization and Internationalization testing for the application
that is expected to be used by users across the world. We need to ensure that the system is
designed in such a manner that it can be easily customized without any engineering /
design changes to the system for various countries and cultures. So, we try to ensure that
there are no issues due to language change (Text expansion, usage of Shortcut and Hot
keys, evaluation of string functions, or text used in graphics are taken care of). Apart from
that we also try to ensure data formats are correctly used as per local country requirements
– such as date & time format, currency symbol, comma and decimal separators for
numbers.
Non-functional testing on the other hand focuses on other characteristics of the software
and we try to measure to what extent the system satisfies those characteristics.
As such any characteristics other than functional aspects of the system is covered under
non-functional testing, but we covered some important testing types such as Usability,
Performance, Security and Compatibility testing.
Usability testing is done to ensure that the system can be understood, learned and used
easily, effectively, efficiently with satisfaction not only by normal users but also by people
who are physically impaired. So, we consider various aspects such as interactivity, layout,
readability, aesthetics, display characteristics, consistency, flexibility etc during this testing.
Performance Load and Stress testing is done to ensure that the response time,
throughput and resource utilization is within acceptable limit. Load testing is done to
ensure that performance does not degrade beyond a certain limit even if the load is
increased to highest possible level. Stress testing is done to evaluate the maximum limit
stress the system can support and ensure that system does not crash or does not
compromise on security of sensitive data. Memory leaks, memory fragmentation,
overwrites or not having index even if some conditions are used for fetching database
records are some of the key causes of performance related issue.
Subsequently, we discussed security testing which is done to determine the security of the
software product. As part of this testing we try to act like a hacker and see whether system
can be penetrated with various possible attacks such as Password cracking, URL
manipulation, SQL injection, Cross site scripting or spoofing.
Since many systems are used directly by end users (general public and not just company
employees), they should support all (at least most popular) platforms available in the
market. So, We need to do Compatibility testing to ensure that it support various
operating systems, browsers, databases and devices. Focus is given to some potential issues
such as page load time does not degrade, tabs and tab order works, data displayed
accurately, email links still work properly, images are displayed properly, documents can
uploaded / downloaded and look and feel or screen resolutions are not impacted.
Lastly we discussed about Regression testing we need to do for all functional and non-
functional requirements to ensure that they continue to work as expected even after
making some changes or in the system due to changes in rules or process or even fixing
defects. All the test cases prepared are evaluated (for criticality / potential impact) and set
of important test cases are identified as regression test cases. Most of these test cases
(based on impact analysis of change) for every release due to change either manually or
automated.
8.5 Exercise
Sr Question
1. Provide 2 important aspects to be checked while testing a report
2. Provide 2 important aspects to be checked while testing a Error messages
_________ testing is done to check that if an application response time is 3
seconds when 300 users are accessing the same and may be impacted only little
3. (1-2 seconds) if say 800 or more users access at a given point of time
4. Name any 3 types of possible attacks on the system
5. Provide 4 key aspects to be checked during Usability testing
6. What is regression testing? Why it is important?
_____ testing is subjecting the program to heavy volumes of data
7. for e.g. an operating system's job queue would be filled to full capacity
In _____ testing, a considerable load is generated as quickly as possible in order
8. to analyzed the maximum limit of concurrent users the application can support.
Match the following:
9 References
(1) Software Engineering by Roger Pressman
Foundation of Software Testing – ISTQB Certification by Dorothy Graham, Erik
van Veenendaal, Isabel Evans, Rex Black
(2) Standard glossary of terms used in Software Testing - ISTQB version 2.1
(3) Software Testing Principles and Practices– by Srinivasan Desikan, Gopalswamy
Ramesh
(4) Software Testing Techniques and Applications– by Arun kumar Khannur