Demonstrate to developers and customers that software meets requirements.
For custom software, ensure at least one test per requirement in the requirements document.
For generic software, test all system features and their combinations for product release.
Discover situations where software behavior is incorrect, undesirable, or doesn't conform to specifications.
Defect testing focuses on rooting out undesirable system behavior like crashes, unwanted interactions, incorrect computations, and data corruption.
Software Inspections
Involve people examining the source code representation to discover anomalies and defects.
Do not require system execution, so they can be used before implementation.
Applicable to any representation of the system (requirements, design, configuration data, test data, etc.).
Effective technique for discovering program errors.
Advantages of Inspections
During testing, errors can mask other errors, but inspections being static avoid this issue.
Incomplete system versions can be inspected without additional costs, avoiding the need for specialized test harnesses.
Inspections can consider broader quality attributes like compliance with standards, portability, and maintainability.
Stages of Testing
Development testing: Testing during development to discover bugs and defects.
Release testing: Separate testing team tests a complete system version before user release.
User testing: Users or potential users test the system in their own environment.
Development Testing
Includes all testing activities carried out by the development team.
Unit testing: Testing individual program units or object classes, focusing on object/method functionality.
Component testing: Integrating individual units to create composite components, focusing on testing component interfaces.
System testing: Integrating some or all components to test the system as a whole, focusing on component interactions.
Unit Testing
Testing individual components in isolation.
A defect testing process.
Units can be:
Individual functions or methods within an object.
Object classes with several attributes and methods.
Composite components with defined interfaces.
Object Class Testing
Complete test coverage involves:
Testing all operations associated with an object.
Setting and interrogating all object attributes.
Exercising the object in all possible states.
Inheritance complicates test design as information isn't localized.
Automated Testing
Unit testing should be automated whenever possible for tests to run without manual intervention.
Use a test automation framework (e.g., JUnit) to write and run program tests.
Unit testing frameworks provide generic test classes that are extended to create specific test cases.
Frameworks run tests and report on their success, often through a GUI.
Testing Strategies
Partition testing: Identify input groups with common characteristics processed the same way.
Choose tests from within each group.
Guideline-based testing: Use testing guidelines to choose test cases.
Guidelines reflect past experiences with common programmer errors.
Partition Testing
Input data and output results often fall into different classes where all members of a class are related.
Each class is an equivalence partition or domain where the program behaves equivalently for each class member.
Test cases should be chosen from each partition.
General Testing Guidelines
Choose inputs that force the system to generate all error messages.
Design inputs that cause input buffers to overflow.
Repeat the same input or series of inputs numerous times.
Force invalid outputs to be generated.
Force computation results to be too large or too small.
Test-Driven Development (TDD)
An approach to program development interleaving testing and code development.
Tests are written before code, and passing tests drives development.
Code is developed incrementally along with a test for that increment; development doesn't proceed until the code passes its test.
TDD was introduced as part of agile methods like Extreme Programming but can be used in plan-driven development.
TDD Process Activities
Identify the required increment of functionality (small and implementable in a few lines of code).
Write a test for this functionality and implement it as an automated test.
Run the test along with all other implemented tests; the new test will initially fail.
Implement the functionality and re-run the test.
Once all tests run successfully, move on to implementing the next chunk of functionality.
Benefits of Test-Driven Development
Code coverage: Every code segment has at least one associated test.
Regression testing: A regression test suite is developed incrementally as a program is developed.
Simplified debugging: When a test fails, the problem location should be obvious.
System documentation: The tests themselves document what the code should be doing.
Release Testing
Testing a particular system release intended for use outside the development team.
The primary goal is to convince the supplier that the system is good enough for use.
Release testing must show that the system delivers its specified functionality, performance, and dependability and doesn't fail during normal use.
Usually a black-box testing process where tests derive from the system specification.
Release Testing and System Testing
Release testing is a form of system testing, but with important differences:
A separate team not involved in system development should handle release testing.
System testing by the development team focuses on discovering bugs (defect testing), while release testing checks that the system meets requirements and is suitable for external use (validation testing).
Features Tested By Scenario
Authentication by logging into the system.
Downloading and uploading specified patient records to a laptop.
Home visit scheduling.
Encryption and decryption of patient records on a mobile device.
Record retrieval and modification.
Links with the drugs database maintaining side-effect information.
The system for call prompting.
User Testing
User or customer testing is a stage in the testing process in which users or customers provide input and advice on system testing.
User testing is essential, even after comprehensive system and release testing, because user working environment influences can't be replicated in a testing environment.
Types of User Testing
Alpha testing: Users work with the development team to test the software at the developer's site.
Beta testing: A software release is made available to users to allow experimentation and problem reporting to developers.
Acceptance testing: Customers test a system to decide whether or not it is ready to be accepted from the developers and deployed in the customer environment, primarily for custom systems.