STM Unit-1 (A)
STM Unit-1 (A)
INTRODUCTION
1. PURPOSE OF TESTING
1.1. What we do
Once in production, each and every stage is subjected to quality control and testing from
component source inspection to final testing before shipping.
If any defects found at any stage in any part of it will be sent back for rework and correction.
The productivity is measured by the sum of the costs of the resources, the rework and the failed
components and the cost of quality assurance and testing.
By testing we get the quality of software.
If we give the guarantee for the quality of a product then it is called Quality Assurance.
Testing and test design as a parts of quality assurance, should also focus on bug prevention.
To the extent that testing and test design do not prevent bugs, they should be able to discover
symptoms caused by bugs.
The two major goals of testing
1. Bug Prevention
2. Bug Discovery
1. Bug Prevention:
2. Bug discovery:
Which is considered as the secondary goal for testing.
It is performed when the primary goal fails to prevent the bugs.
A single bug can have many reasons for its occurrence.
Just by determining that the program is incorrect doesn’t reveal the discovery of bugs
Each symptom can be revealed only by performing many small detailed tests on each of the
individual components.
P
Phase 1: The purpose of testing is to show that the software works.
There is a difference between testing and debugging.
The probability of showing that ‘the software works’ decreases as testing increases.
A failed test shows software does not work, even if many tests pass.
Phase 2: The purpose of testing is to show that the software doesn’t works.
One failed test proves that- Tests are to be redesigned to test corrected software.
The test reveals a bug, the programmer corrects it, the test designer designs and executes another
test intended to demonstrate another bug. It is never ending sequence.
Phase 3: The purpose of testing is not to prove anything, but to reduce the perceived risk of not
w working to an acceptable value.
Here testing implements the quality control. To the extent that testing catches bugs and to the
extent that those bugs are fixed, testing does improve the product.
If a test is passed, then the product’s quality does not change, but our perception of that quality
does.
We know that the software code must be designed and tested, but many appear to be unaware
that tests themselves must be designed and tested. Tests should be properly designed and tested before
applying it to the actual code.
In test design phase the given system is tested that bugs are present or not. If test design is not
formally designed no one is sure whether there was a bug or not. So, test design is a important one to get
the system without any bugs.
Inspection methods: It includes walkthroughs, desk checking, formal inspection and code reading.
These methods appear to be as effective as testing, but the bugs caught do not completely overload.
Static Analysis Methods: It includes of strong typing and type checking. It eliminates an entire category
of bugs.
Languages: The source language can help reduce certain kinds of bugs. Programmers find new kinds of
bugs in new languages, so the bug rate seems to be independent of the languages used.
Design methodology and Development Environment: Design methodology can prevent many kinds of
bugs. Development process used and the environment in which what methodology is embedded.
1. Pesticide Paradox: Every method you use to prevent or find bugs leaves a residue of subtler bugs
again which those methods are ineffectual.
2. Complexity Barrier: Software complexity grows to the limits of our ability to manage that
complexity.
Application: It is a real-time system that must provide timely responses to user requests for services. It is
an online system connected to remote terminals.
Staff: The programming staff consists of twenty to thirty programmers depends upon the project, but not
too big to manage. Specialists are used for system’s design.
Schedule: The project will take 24 months from the start of design to formal acceptance by the
customer. Acceptance will be followed by a 6-month cutover period
Specification: means requirements. Functionally detailed user requirements are documented here.
Acceptance Test: The system will be accepted only after a formal acceptance test. At first the customer
will intend to design the acceptance test, but later it will become the software design team’s
responsibility.
Personnel (Programmers): The staff is professional and experienced in programming and in the
application. At least half of the staff knows the source language in before. May be one-third are junior
programmers.
Standards: Programming and test standards exist and are usually followed.
Objectives: The system is the first of many similar systems that will be implemented in the future. No
two will be identical, but they will have 75% of the code in common.
Source: One-third of the code is new, one-third extracted from a previous, reliable, but poorly
documented system, and one-third is being rehosted (from other language or computer).
2.2. Overview
The process starts with a program embedded in an environment, such as a computer, an operating
system, or a calling program. This understanding leads us to create three models:
From these models we create a set of tests, which are then executed.
The result of each test is either expected or unexpected.
If unexpected, it may lead us to revise the test, our model or concept of how the program
behaves, our concept of what bugs are possible, or the program itself.
Only rarely would we attempt to modify the environment.
For online systems the environment may include communications lines, other systems, terminals,
and operators. The environment also includes all programs that interact with and are used to create the
program under test, such as operating system, loader, linkage editor, compiler, utility routines.
If testing reveals an unexpected result, we may have to change our beliefs (our model of the
environment) to find out what went wrong. But sometimes the environment could be wrong: the bug
could be in the hardware or firmware after all.
Programs are too complicated to understand in detail. The concept of the program is to be
simplified in order to test it.
If simple model of the program doesn’t explain the unexpected behavior, we may have to
modify that model to include more facts and details. And if that fails, we may have to modify the
program.
2.5. Bugs
Bugs are more insidious (cunning/ harmful) than ever we expect them to be.
An unexpected test result may lead us to change our notion of what a bug is and our model
of bugs.
Some optimistic notions that many programmers or testers have about bugs are usually
unable to test effectively and unable to justify the dirty tests most programs need.
2.6. Tests
The objectives of each kind are different and therefore, we can expect the mix of test methods
used to differ. They are:
A Unit is the smallest testable part of an application called units are individually and
independently tested.
A unit is usually the work of one programmer and it consists of several hundred or fewer, lines
of source code.
The goal of unit testing is to segregate each part of the program and test that the individual parts
are working correctly.
Unit Testing is done before integration.
When our tests reveal such faults, we say that there is a unit bug.
System Testing is a level of the software testing where a complete and integrated software is
tested.
In system testing the behavior of whole system/product is tested as defined by the scope of the
development project or product.
System testing is most often the final test to verify that the system to be delivered meets the
specification and its purpose.
System testing is carried out by specialists testers or developers.
1 It do not occurs after and before of It occurs after Unit Testing and before System
anything. Testing.
2 It is not abbreviated by any name. It is abbreviated as “I&T” that is why
sometimes also called Integration and Testing.
4 It may not catch integration errors, or Integration testing uncovers an error that
other system-wide issues because unit arises when modules are integrated to build
testing only tests the functionality of the the overall system.
units themselves.
5 The goal of unit testing is to isolate each The goal of Integration Testing is to combined
part of the program and show that the modules in the application and tested as a
individual parts are correct. group to see that they are working fine.
6 It does not follow anything. It follows unit testing and precedes system
testing.
7 It obviously starts from the module It obviously starts from the interface
specification. specification.
8 Unit testing always tests the visibility of Integration testing always tests the visibility of
code in details. the integration structure.
9 Unit testing always tests the visibility of Integration testing always tests the visibility of
code in detail the integration structure.
10 It definitely pays attention to the It definitely pays attention to the integration
behavior of single modules. among modules.
11 It is only the kind of White Box Testing. It is both the kind of Black Box and White
Box Testing.
Used for the testing process until system behavior is correct or until the model is insufficient
(for testing).
Unexpected results may force a revision of the model.
Art of testing consists of creating, selecting, exploring and revising models.
The model should be able to express the program.
3. CONSEQUENCES OF BUGS
The importance of bugs depends on metrics like frequency, correction cost, installation cost, and
consequences cost
Frequency:
Correction Cost:
Installation Cost:
Installation cost depends on the number of installations i.e. this cost relies on the different
applications that are used in the system.
As the number of applications increases, the associated cost also increases.
Consequences:
It depends upon the consequences (affects) of bugs.
There are many consequences of bugs which makes the system either from mild to
infectious.
1) Mild
• Appearance of bug such as misspelled output or misaligned print-out.
2) Moderate
• This consequence effects the performance of the system and hence it results in a duplicate
output.
3) Annoying (Irritating)
• Systems behavior is dehumanizing for e.g. names are truncated(shorten, cut
short)/modified arbitrarily(Random choice).
• Because of the presence of bugs in the system the performance of the system degrades.
• For example: The names are shortened or changed.
4) Disturbing
• I t refuses to handle Legitimate (legal/authorized) transactions .
• For e.g. ATM machine refuses to process the withdrawal transaction.
5) Serious
• The information about the transaction gets lost such as
• Losing track of transactions & transaction events.
• Accountability(responsibility) is lost.
• Transaction occurrence.
• When such information is lost the resulting bug is called a serious bug.
6) Very serious
• System does another transaction instead of requested
• For e.g. Deposit transaction is converted into withdrawal transaction
7) Extreme
• The consequence occurs frequently and is not limited to small number of users or
transactions.
8) Intolerable
• Long term, unrecoverable corruption of the Data base (not easily discovered and may lead
to system down).
9) Catastrophic
• System fails and shuts down.
10) Infectious
• Corrupts other systems, even when it may not fail.
Many programmers, testers, and quality assurance workers have an absolutist attitude towards
bugs. “Everybody knows that a program must be perfect if it’s to work: if there’s a bug, it must be
fixed.”
Metrics:
Correction Cost
The cost of correcting a bug has almost nothing to do with symptom severity.
Catastrophic, life-threatening bugs could be ignorable to fix, whereas minor annoyances could
require major rewrites to correct.
1. List all nightmares in terms of the symptoms & reactions of the user to their consequences.
2. Convert the consequences of each nightmare into a cost. There could be rework cost. Order these
from the costliest to the cheapest. Discard those with which you can live with.
3. Based on experience, measured data, insight, and published statistics assume the kind of bugs
causing each symptom. This is called ‘bug design process’. A bug type can cause multiple
symptoms.
4. Order the causative bugs by decreasing probability. Calculate the importance of a bug type as:
Importance of bug type j = ∑ C j k P j k where, all k
6. Design tests & design QA inspection process by using most effective methods against the most
important bugs.
7. If a test is passed or when correction is done for a failed test, some nightmares disappear. As
testing progresses, revise the probabilities & nightmares list as well as the test strategy.
There is no universally correct way to categorize bugs. This taxonomy is not rigid. Bugs are difficult to
categorize. A given bug can be put into one or another category depending on its history and the
programmer’s state of mind.
Depend on the types of data or the representation of data. There are 4 sub categories.
1) General Data Bugs
2) Dynamic Data Vs Static Data
3) Information, Parameter, and Control Bugs
4) Contents, Structure & Attributes related Bugs
1) General Data Bugs:
Due to data object specs., formats, number of objects & their initial values.
Common as much as in code, especially as the code migrates to data.
2) Dynamic Data Vs Static Data:
Dynamic Data:
Dynamic data are transitory (temporary).
Whatever their purpose their lifetime is relatively short (the processing time of a transaction).
A storage object may be used to hold dynamic data of different types, with different formats
and attributes.
Dynamic data bugs are due to leftover garbage in a shared resource.
This can be handled in one of the three ways:
(1) Clean up after the use by the user
(2) Common Cleanup by the resource manager
(3) No Clean up (this is usually we do).
Static Data:
Static Data are fixed in form and content.
They appear in the source code or database directly or indirectly.
Compile time processing will solve the bugs caused by static data.
3) Information, parameter, and control:
Static or dynamic data can serve in one of three roles, or in combination of roles: as a
parameter, for control, or for information.
Information: dynamic, local to a single transaction or task.
Parameter: parameters passed to a call.
Control: data used in a control structure for a decision.
Bugs:
Usually simple bugs and easy to catch.
4) Contents, Structure & Attributes related Bugs:
Data specifications consist of three parts.
Contents: are pure bit patterns.
Structure: Size, shape & alignment of data object in memory. A structure may have substructures.
Attributes: Semantics associated with the contents of data object (e.g. integer, string and
subroutine).
Bugs:
Content bugs are due to misinterpretation or corruption of it.
Structural bugs may be due to wrong declaration
Attribute bugs are due to misinterpretation of data type, probably at an interface
Remedies:
Test Debugging: The first remedy for test bugs is testing and debugging the tests. Test
debugging, when compared to program debugging, is easier because tests, when properly
designed are simpler than programs and don’t have to make concessions to efficiency.
Test Quality Assurance: Programmers have the right to ask how quality in independent testing
is monitored.
Test Execution Automation: Assemblers, loaders, compilers are developed to reduce the
incidence of programming and operation errors. Test execution bugs are virtually eliminated by
various test execution automation tools.
Test Design Automation: Just as much of software development has been automated, much
test design can be and has been automated.
Overview:
At the end of a long study on taxonomy, we could say
Good design controls bugs and is easy to test.
The two factors (Good and Bad design) results in high productivity differences.
Good test works best on good code and good design.
Good test cannot do a magic on badly designed software.
Biggest part of software cost is the cost of bugs: the cost of detecting them, the cost of
correcting them, the cost of designing tests that discover them, and the cost of running tests.
The test techniques you use must be matched to the kind of bugs you have.
5.2. Applications:
1) Application of path testing to New Code:
1.Do Path Tests for C1 + C2 coverage.
2.A path blocked or not achievable could mean a bug.
3.When a bug occurs the path may be blocked.
2) Application of path testing to Maintenance:
1) Path testing is applied first to the modified component.
2) Select paths to achieve C2 over the changed code.
3) Newer and more effective strategies could emerge to provide coverage in maintenance phase.
3) Application of path testing to Rehosting:
1) Path testing with C1 + C2 coverage is a powerful tool for rehosting old software.
2) Software is rehosted as it’s no more cost effective to support the application environment.
Process of path testing during Rehosting
• A translator from the old to the new environment is created & tested. Rehosting process
is to catch bugs in the translator software.
• A complete C1 + C2 coverage path test suite is created for the old software. Tests are run
in the old environment. The outcomes become the specifications for the rehosted
software.
• Another translator may be needed to adapt the tests & outcomes to the new environment.
• The cost of the process is high, but it avoids risks associated with rewriting the code.
• Once it runs on new environment, it can be optimized or enhanced for new functionalities
(which were not possible in the old environment).