Software Technologies
Software Technologies
Unit1
Purpose of Testing.
Purpose of Testing
1. It is done to catch bugs.
Also, testing is to break the s/w and drive to the ultimate. NOTE: should not
be misunderstood.
The biggest part of s/w cost is the cost of bugs and the corresponding rework.
Quality and productivity are almost indistinguishable for s/w.
Testing, as part of QA, should focus on bug prevention. The art of test
design one of the best bug preventors have known. Test design and tests
should provide clear diagnosis so that bugs can be easily corrected. If a bug
is prevented, the corresponding rework is saved. (Rework includes bug
reporting, debugging, corrections, retesting the corrections, re-distributions,
re-installations etc.).
Test-design thinking (writing test specification from the requirement
specifications first and then writing the code) can discover and eliminate bugs
at every stage of the SDLC. To the extent that the testing fails to achieve its
primary goal (bur prevention), testing must reach its secondary goal bug
discovery.
Phase 1: says testing is done to show that the software works. A failed test
shows that s/w does not work in spite of many testing passing ok. The
objective phase 1 is not achievable totally.
Phase 2: says Software product does not work. One failed test satisfies the
phase 2 goal. Tests can be redesigned to test the corrected s/w again.
However, we do not know when to stop testing.
Phase 3: says Testing is for Risk Reduction. Let us accept the principles of
statistical quality control. If a test passes or fails our perception of software
quality changes and more importantly, our perception of risk about the product
reduces. The product is released when the risk is under a predetermined limit.
(Statistics are used here)
Phase 4: says A State of Mind regarding what testing can do and cannot,
and further what makes software testable.
Applying that knowledge reduces amount of testing. Then effort in testing s/w
reduced. Also, the code will have fewer bugs than the code which is hard to
test.
The above goals are cumulative. one leads to the other and are
complementary. Phase2 tests will not show software works. Use the
statistical methods to test the design to achieve good testing (& product) at an
acceptable risk. Most testable software must be debugged, must work and
must be hard to break.
Bug Prevention
a) Pesticide paradox: Every method you use to prevent or find bugs leaves a
residue of subtler bugs against which those methods are ineffectual.
As we progress by enhancements & corrections of bugs, we may say software
gets better; however, it may not be quite that.
1. Testing Vs Debugging
Their roles are confused to be the same. But, there are differences in goals,
methods and psychology applied to these
# Testing Debugging
1 Starts with known conditions. Uses Starts with possibly unknown initial
predefined procedure. Has predictable conditions. End cannot be predicted.
outcomes.
2 Planned, Designed and Scheduled. Procedures & Duration are not
constrained.
3 A demo of an error or apparent A Deductive process.
correctness.
4 Proves programmers success or failure. It is programmers Vindication.
5 Should be predictable, dull, constrained, There are intuitive leaps, conjectures,
rigid & inhuman. experimentation & freedom.
6 Much of testing can be without design Impossible without a detailed design
knowledge. knowledge.
7 Can be done by outsider to the Must be done by an insider
development team. (development team).
8 A theory establishes what testing can do There are only Rudimentary Results
or cannot do. (on how much can be done. Time,
effort, how etc. depends on human
ability).
Functional Testing: Treats a program as a black box. Outputs are verified for
conformance to specifications from users point of view.
Two Examples:
Application2
Malloc()
Link block()
Devices
User
O.S.
r Application1
For a given model of programs, Structural tests may be done first and later
the Functional, Or vice-versa. Choice depends on which seems to be the
natural choice.
Both are useful, have limitations and target different kind of bugs. Functional
tests can detect all bugs in principle, but would take infinite amount of time.
Structural tests are inherently finite, but cannot detect all bugs.
The Art of Testing is how much allocation % for structural vs how much %
for functional.
3. Designer vs Tester
So:
Optimize the size & balance internal & interface complexity to increase
efficiency
Optimize the test design by setting the scopes of tests & group of tests
(modules) to minimize cost of test design, debugging, execution & organizing
without compromising effectiveness.
# Small Big
1 More efficiently done by informal, A large # of programmers & large # of
intuitive means and lack of formality components.
if its done by 1 or 2 persons for
small & intelligent user population.
2 Done for e.g., for oneself, for ones Program size implies non-linear effects (on
office or for the institute. complexity, bugs, effort, rework quality).
3 Complete test coverage is easily Acceptance level could be: Test coverage
done. of 100% for unit tests and for overall tests
80%.
6. Buyer vs Builder
If the Buyer and Builder are the same organization, it clouds accountability in
the software development process. So separate them just enough into groups
to make the accountability clear for the purposes of software development.
Further, the accountability increases motivation for quality.
Let us look at the roles of all parties in the software development and usage
later on.
Buyer: Pays for the system and hopes to get profits from the services to
the User.
Tester: works towards the destruction of the software. The tester tests the
software in the interests of the user & the operator.
Operator: The operator lives with the mistakes of the builder, murky
specs of Buyer, oversights of Tester and the complaints of User.
A MODEL FOR TESTING
First we understand what a project is and then look at the roles of the testing
models in a project.
PROJECT:
4 Personnel: From the personnel of the project team, the technical staff
comprises of: a combination of experienced professionals, junior
programmers (1 3 yrs) and some with no experience with varying degrees of
knowledge of the application.
8 History: Typically:
Developers may quit before his/her components are tested. Excellent but
poorly documented work. Unexpected changes (major & minor) from
customer may come in. Important milestones may slip, but the delivery
date is met. Problems in integration, with some hardware, redoing of some
component etc..
Finally, a model project is a well Run & Successful Project with a combination
of glory and catastrophe.
Expecte
Program Program Tests Outc d
Model ome
2) Environment: includes
All hardware & software (firmware, OS, linkage editor, loader,
compiler, utilities, libraries) required to make the program run.
Usually bugs do not result from the environment. (with
established h/w & s/w)
But arise from our understanding of the environment.
3) Program:
1) Complicated to understand in detail.
2) Deal with a simplified overall view.
3) Focus on control structure ignoring processing & focus on
processing ignoring control structure.
4) If bugs not solved, modify the program model to include
more facts, & if that fails, modify the program.
5) Tests:
1) Formal procedures.
2) Input preparation, outcome prediction and observation,
documentation of test, execution & observation of outcome are
subject to errors.
3) An unexpected test result may lead us to revise the test and test
model.
2) Integration Testing:
Integration is a process of aggregation of components into larger
components.
Verification of consistency of interactions in the combination of
components.
Examples of integration testing are improper call or return
sequences, inconsistent data validation criteria & inconsistent
handling of data objects.
A B D
A B
C
Sequence of Testing:
Unit/Component tests for A, B. Integration tests for A &
B. Component testing for (A,B) component
3) System Testing
-----------------------------------------------
After understanding a Project, Testing Model, now lets see
finally,
Importance of Bugs
1. Frequency
2. Correction Cost
3. Installation Cost
Depends on # of installations.
May dominate all other costs, as we nee to distribute bug fixes across
all installations.
Depends also on application and environment.
4. Consequences (effects)
Measure by the mean size of the awards given to the victims of the
bug.
Depend on the application and environment.
A metric for Importance of Bugs
Mild
Aesthetic bug such as misspelled output or mal-aligned print-
out.
Moderate
Outputs are misleading or redundant impacting performance.
Annoying
Systems behavior is dehumanizing for e.g. names are
truncated/modified arbitrarily, bills for $0.0 are sent.
Till the bugs are fixed operators must use unnatural command
sequences to get proper response.
Disturbing
Legitimate transactions refused.
For e.g. ATM machine may malfunction with ATM card / credit
card.
Serious
Losing track of transactions & transaction events. Hence
accountability is lost.
Very serious
System does another transaction instead of requested e.g.
Credit another account, convert withdrawals to deposits.
Extreme
Frequent & Arbitrary - not sporadic & unusual.
Intolerable
Long term unrecoverable corruption of the Data base.
(not easily discovered and may lead to system down.)
Catastrophic
System fails and shuts down.
Infectious
Corrupts other systems, even when it may not fail.
Assignment of severity
Assign flexible & relative rather than absolute values to the bug (types).
Number of bugs and their severity are factors in determining the quality
quantitatively.
Organizations design & use quantitative, quality metrics based on the
above.
Nightmares
Define the nightmares that could arise from bugs for the context of
the organization and the application.
3. Order these from the costliest to the cheapest. Discard those with
which you can live with.
Why Taxonomy ?
To study the consequences, nightmares, probability, importance, impact and
the methods of prevention
and correction.
Remedies
Short-term Support:
Specification languages formalize requirements & so automatic
test generation is possible. Its cost-effective.
Long-term support:
Even with a great specification language, problem is not
eliminated, but is shifted to a higher level. Simple ambiguities &
contradictions may only be removed, leaving tougher bugs.
Testing Techniques
2. Structural Bugs
Paths left out, unreachable code, spaghetti code, and pachinko code.
Improper nesting of loops, Incorrect loop-termination or look-back, ill-
conceived switches.
Prevention
3. Data Bugs
Depend on the types of data or the representation of data. There are 4 sub
categories.
Due to data object specs., formats, # of objects & their initial values.
Static or dynamic data can serve in any of the three forms. It is a matter of
perspective.
Bugs
Contents: are pure bit pattern & bugs are due to misinterpretation or
corruption of it.
Structure: Size, shape & alignment of data object in memory. A structure
may have substructures.
Attributes: Semantics associated with the contents (e.g. integer, string,
subroutine).
Bugs
Severity & subtlety increases from contents to attributes as they get less
formal.
Structural bugs may be due to wrong declaration or when same contents
are interpreted by multiple structures differently (different mapping).
Good source lang. documentation & coding style (incl. data dictionary).
Data structures be globally administered. Local data migrates to global.
4. Coding Bugs
Coding errors
typographical, misunderstanding of operators or statements or could
be just arbitrary.
Documentation Bugs
Solution:
i. External Interfaces
User
System
component
component
hardware
O. S.
Drivers
Application
software
5. Interface, Integration and Systems Bugs contd..
1) External Interfaces
2) Internal Interfaces
Due to:
The subroutines pass thru unit and integration tests without detection of
these bugs. Depend on the Load, when the system is stressed. These
are the most difficult to find and correct.
Due to:
Remedies:
Test Techniques
Due to:
Ignored timing
Assumption that events occur in a specified sequence.
Starting a process before its prerequisites are met.
Waiting for an impossible combination of prerequisites.
Not recognizing when prerequisites are met.
Specifying wrong priority, Program state or processing level.
Missing, wrong, redundant, or superfluous process steps.
Remedies:
Good design.
highly structured sequence control - useful
Specialized internal sequence-control mechanisms such as an
internal job control language useful.
Storage of Sequence steps & prerequisites in a table and
interpretive processing by control processor or dispatcher -
easier to test & to correct bugs.
Test Techniques
Due to:
Remedies:
Test Techniques
8) Integration Bugs:
Are detected late in the SDLC and cause several components and hence
are very costly.
Due to:
Remedies:
Employ good integration strategies. ***
Test Techniques
9) System Bugs:
Due to:
Remedies:
Thorough testing at all levels and the test techniques
mentioned below
Test Techniques
Transaction-flow testing.
Its difficult & takes time to identify if a bug is from the software or from the test
script/procedure.
Test Criteria
Testing process is correct, but the criterion for judging softwares
response to tests is incorrect or impossible.
Remedies:
1. Test Debugging:
Testing & Debugging tests, test scripts etc. Simpler when tests
have localized affect.
A word on productivity
Good design inhibits bugs and is easy to test. The two factors are
multiplicative and results in high productivity.
25.0
Bugs percentage
20.0
15.0
10.0
5.0
0.0
ts ct ic s on s lit y ss ss s gs s d gs gs ng ng at a re g ng cal ns on ers ion es ut ion ure se re ilit y ce ns ys nt on gs gs s s gs ied
en re og es ti ge a e e es u ic le u u ci si D ctu dlin odi phi t io t at i t h rat f ac ghp rat ect d U ectu tab an tio erla nme uti bu bu bug nes Bu cif
m cor s L t en nta an tion ct n t en t en in b ost and al b al B en ces ru n a la n O teg t er ou t eg hit an hit un rm ep Ov iro xec gn ion on te ing pe
r e t e h c e e
ui s in en ple m C n orr pl ple ma ag ish ion tu eq ro
n r u st ha & C ogr vio me In l I n hr r I n Arc all Arc co erfo Exc s, nv E esi cut tati ple est Uns
eq ent em om ocu nts d fu n c om om Do di n m nct truc d s p nd and ion typ rds ocu a T c c , n E d m
R ir , c D e an t io e c c d io fu S n n
a
s ta t
& a D e rn ng, t he are / S are d A P sis titio n, an st D Exe en Co er T er,
m
re equ nts on, irem re nc tur ase
n
a dit er a
it io es en g an d
In t
m
i O w O w n
t t a no ar ge ion Te st um e t h t h
u i i u u s n th w n c m in st T i of o f y g P ys it e o c as O O
e t u t f a c e
g co o lo i
f a e c d r a n T D tc
eq R em nta eq ea re/ fe al lf de a pl Co nd s, ,S S ve di S fi
st es
R n sa n t ro a at m ce o ct De
r
ui se
R F tu io es ptio at d I
a em ec st Te T
eq Pre fe
a
n ct m e c on d ty le erf a y st R o rre e
R fu r c
se x S nt S c T
U e lI In
na
ter
Ex
Activity
QUESTIONS FROM PERVIOUS EXAMS FROM UNIT 1
Q. Specify on which factors the importance of bugs depends. Give the metric for
it (importance).
Ans: Importance of bugs as discussed in chapter 2
Q. What are the differences between static data and dynamic data?
Ans: 2nd point in Data bugs in taxonomy of bugs