Software Testing & Quality Assurance – Unit I Comprehensive Notes

Introduction to Software Testing

Software testing is the systematic investigation of a software artefact with the explicit intent of revealing defects before the product reaches its end-users. It is often described as an "art" because, beyond predefined procedures, it requires creativity, critical thinking, and domain intuition. Testing should be integrated into every phase of the Software Development Life-Cycle (SDLC) so that coding and testing proceed hand-in-hand. Doing so:

  • ensures reliability, safety and user-friendliness;

  • keeps the delivered product aligned with stated requirements;

  • prevents the high downstream cost of hunting through thousands of lines of code to remove latent bugs;

  • mitigates the risk of introducing new errors while fixing old ones;

  • recognises the unavoidable human tendency to err – even the best engineers make mistakes that only structured testing can surface.

A concise summary of motives:

  1. Confirm reliability.

  2. Eliminate failures before shipment.

  3. Demonstrate conformance to client requirements.

  4. Validate usability.

  5. Compensate for multiple human viewpoints, interpretations, and oversights.

  6. Expose design flaws that only emerge once implementation begins.

Testing Objectives, Principles & The Nature of Errors

Core Objectives

  1. Execute programs with the intent of finding errors.

  2. Design test cases that maximise the probability of uncovering yet-unknown defects.

  3. Define success as the discovery of at least one previously unknown defect.

Fundamental Principles

  • Trace every test back to customer requirements – the gravest faults are those that cause requirement failures.

  • Begin planning as soon as requirements are stable and finalise designs for tests as soon as the design model is ready.

  • Apply the Pareto rule: 80%80\% of observed errors originate in roughly 20%20\% of the components; identify and focus on this critical subset.

  • Progress from “testing in the small” (unit components) to “testing in the large” (integrated systems).

  • Accept that exhaustive path coverage is impossible – instead aim for adequate logical and conditional coverage.

  • To maximise objectivity, favour independent third-party testers over the original developers.

Error vs. Bug

An error is any deviation from accuracy or correctness. In software a bug is an error, flaw, fault, or failure that produces an incorrect or unexpected result. Errors arise from incomplete requirements, ambiguous specifications, logic slips, boundary mis-handling, uninitialised data, or plain human oversight.

Common Categories of Software Errors

  1. Functionality Errors – the software behaves in an unexpected or awkward way (e.g.
    a non-clickable ‘Cancel’ button).

  2. Communication Errors – missing or incorrect user guidance, help, or messages.

  3. Missing Command Errors – an expected command (e.g. a closing option) is absent.

  4. Syntactic Errors – misspellings or grammatical mistakes in the GUI.

  5. Error-Handling Errors – cryptic or misleading messages that do not help the user resolve a failure.

  6. Calculation Errors – due to bad logic, wrong formulas, data-type mismatches; NASA’s Mars Climate Orbiter loss is a classic example.

  7. Control-Flow Errors – incorrect sequencing or branching (e.g. clicking ‘Save & Close’ but the form stays open).

Bug vs Defect vs Error vs Fault vs Failure

• Bug – informal synonym for defect.
• Defect – observable divergence between expected and actual behaviour.
• Error – human mistake in code or artefacts that prevents compilation/execution.
• Fault – latent state that can trigger a failure under certain conditions.
• Failure – external manifestation when numerous defects remain in the delivered system.

Preventive strategies range from test-driven development and systematic code reviews to peer inspections and comprehensive re-testing cycles.

Typical Testing Taxonomy

  • Unit, Integration, System and Acceptance testing

  • Functional vs Non-functional

  • Regression – re-execute suites to ensure newly added code hasn’t broken legacy behaviour.

    • Retesting, Re-execution, Comparison approaches

  • Smoke – quick, high-level confidence check that the build “doesn’t catch fire”.

  • Alpha – internal acceptance testing by QA before customer release.

  • Beta – limited external release for real-world feedback.

  • Stress – expose the system to extreme workloads (max memory, thrashing scenario, etc.).

  • Performance / Load – measure run-time behaviour (throughput, latency) under expected loads.

  • Security, Usability, User-Acceptance, etc.

Quality, QA, QC, QM, SQA

Quality refers to measurable attributes of software. Two key views:

  • Quality of Design – what designers specify (materials, tolerances, performance).

  • Quality of Conformance – how faithfully the implementation meets those specs.

Robert Glass’s heuristic:
User Satisfaction=Compliant Product+Good Quality+Delivery on Budget/Schedule\text{User Satisfaction} = \text{Compliant Product} + \text{Good Quality} + \text{Delivery on Budget/Schedule}

Philosophically, DeMarco adds that quality is "how much the product changes the world for the better" – underscoring that small reliability defects may be tolerated if the product’s value is large.

Distinctions:

  • QA (Quality Assurance) – managerial, preventive, process-oriented, audits.

  • QC (Quality Control) – product-oriented, corrective, inspections/tests.

  • QM (Quality Management) – overarching organisational framework, budgets, culture.

  • SQA (Software Quality Assurance) – umbrella activity spanning the entire software process, integrating process definition, reviews, multi-tiered testing, configuration control, standards compliance, measurement and reporting.

Cost of Quality

Costs are grouped into:

  • Prevention – planning, reviews, tool acquisition, training.

  • Appraisal – inspections, calibration, in-process testing.

  • Failure – internal (rework, repair) and external (warranty, help-desk, recalls).
    Late discovery leads to exponential cost escalation; every dollar spent on prevention can save many in external failure costs.

Software Development Life-Cycle (SDLC)

A structured sequence of phases – Planning, Requirement Analysis, Design, Implementation, Testing, Deployment & Maintenance – whose goal is to deliver high-quality software meeting or exceeding stakeholder expectations within time and budget constraints.

Key observations:
• ISO/IEC 12207 formalises life-cycle processes.
• Quality/risk planning begins as early as Requirement Analysis.
• Documents: SRS (Software Requirement Specification) → DDS (Design Document Specification).
• Testing isn’t a single terminal phase; modern models embed tests (unit, integration, system) alongside each stage.

Software Quality Factors – McCall’s Model

Eleven factors span three dimensions.

Product Operation:

  1. Correctness – mission fulfilment, accuracy, completeness, timeliness.

  2. Reliability – bounded failure rate.

  3. Efficiency – resource optimisation (CPU MHz, MB/GB, MBps).

  4. Integrity – security and controlled access.

  5. Usability – human effort to learn and operate.

Product Revision:

  1. Maintainability – effort to locate and fix failures.

  2. Flexibility – ease of adaptive/perfective changes.

  3. Testability – built-in diagnostics, observability.

Product Transition:

  1. Portability – effort to transplant across hardware/OS.

  2. Reusability – ability to leverage components in new systems.

  3. Interoperability – ease of interfacing with other systems or firmware.

Verification & Validation (V&V)

• Verification – "Are we building the product right?" Static methods: reviews, inspections, traceability analysis.
• Validation – "Are we building the right product?" Dynamic methods: executing code, system testing, user acceptance.

V&V run continuously and progressively (models, prototypes, system tests) until the user formally accepts that the system is fit for purpose.

The V-Model

A symmetric mapping of development phases (left leg) to corresponding test phases (right leg):

Left – Business Requirements, System Design, Architecture Design, Module Design → Coding (vertex)

Right – Unit Testing, Integration Testing, System Testing, Acceptance Testing

Appropriate when requirements are fixed, the project is small/medium, and the organisation owns sufficient technical expertise. Advantages: early test planning, defect containment, clear checkpoints. Drawbacks: rigidity, poor suitability for highly volatile or complex projects.

Software Reviews, Inspections & Walkthroughs

A Software Review is a systematic peer examination of a software artefact to detect and correct defects early, improve productivity and reduce cost.

Objectives

  1. Amplify defect detection before expensive test-execution.

  2. Increase team productivity via shared knowledge.

  3. Produce deliverables with fewer residual bugs.

  4. Identify specification inadequacies and ambiguities early.

Review Taxonomy

• Peer Reviews – author + peers scrutinise artefacts; includes:
– Code Review,
– Pair Programming,
– Walkthrough (author leads participants through artefact),
– Technical Review (experts focus on standards/spec-conformance),
– Formal Inspection (process-driven, checklist-based, defect logging).

• Management Reviews – evaluate project status and decide downstream actions.
• Audit Reviews – independent, external compliance checks (ISO, contractual).

Formal Technical Review (FTR)

Goals: detect errors in function/logic/implementation; confirm requirement compliance; enforce standards; foster uniform development; enhance manageability; serve as training and backup.

Success factors: rigorous preparation, small focused group, objective tone (critique the product, never the person), documented findings, time-boxed meetings, follow-up on corrections.

Structured Walkthroughs

A lightweight but disciplined meeting in which the author narrates code/design while peers ask questions and spot mistakes. Practical tips: restrict meeting length, provide artefacts in advance, record only defects (not solutions), ensure a firm yet supportive chairperson, and limit participants so everyone engages.

Inspections

More formal than walkthroughs: fixed roles (moderator, designer, programmer, tester), checklists, quantitative defect logging (errors/1000 LOC), and managerial visibility. Though potentially intimidating, inspections yield high defect-removal rates and data for process improvement.

Ethical, Philosophical & Practical Implications

• Deliberate under-testing, falsified results, or shipping known critical defects raises ethical red-flags and legal liabilities.
• Cost-of-quality analysis often convinces management to invest in preventive QA – an explicit alignment of business ethics (do no harm) with financial prudence.
• User-centric definitions of quality remind engineers that perfect code is futile if the delivered product fails to improve the user’s world.
• Peer reviews foster collective code ownership, mentoring, and transparency – valuable cultural side-effects beyond defect removal.

Real-World Connections & Cross-Lecture Bridges

• Earlier courses on Requirements Engineering: testing principles such as traceability reinforce the necessity of precise, measurable requirements.
• Software Design lectures: McCall’s factors map directly to modularity, cohesion, and coupling metrics; higher maintainability stems from solid architectural choices.
• Project Management content: V-model gate reviews align with milestone tracking and risk mitigation strategies.
• Security engineering: Integrity and Interoperability factors tangibly influence threat modelling and API design choices.

Key Numerical & Statistical References

  • Pareto distribution 80%/20%80\%/20\% defect concentration.

  • Defect density metrics (e.g. errors/10001000 LOC) used in inspections.

  • Cost-of-quality buckets often show external failure costs >10×>10\times prevention.

  • Cyclomatic complexity V(G)=E−N+2PV(G) = E - N + 2P aids test-case enumeration.

Summary

A holistic Quality Assurance strategy interweaves testing, peer reviews, standards compliance, and continuous measurement across the SDLC. The earlier errors are exposed—whether by static verification, formal inspection, or rigorous unit tests—the cheaper and safer the resulting software. Ultimately, quality is not an after-thought but a culture: "doing the right things, at the right time, in the right way" so that users receive reliable, valuable, and satisfying products.