Understanding testing methodologies, strategies, and best practices
To demonstrate to the developer & the system customer that the software meets its requirements
A successful test shows that the system operates as intended
To discover faults or defects in the software where its behavior is incorrect or not in conformance with its specification
A successful test is a test that makes the system perform incorrectly & so exposes a defect
Inputs causing anomalous behaviour
Outputs which reveal the presence of defects
"Are we building the right product?"
The software should do what the user really requires; related to validation testing
"Are we building the product right?"
The software should conform to its specification; related to defect testing
Aim of V&V is to establish confidence that the system is "fit for purpose"
Depends on system's purpose, user expectations & marketing environment:
Concerned with analysis of the static system representation to discover problems (static verification)
May be supplemented by tool-based document & code analysis
Concerned with exercising & observing product behaviour (dynamic verification)
The system is executed with test data & its operational behaviour is observed
Create test scenarios
Set up test inputs
Execute tests
Analyze outputs
Document findings
Development testing includes all testing activities carried out by the team developing the system:
Individual program units or object classes are tested. Focus on testing functionality of objects or methods.
Several individual units are integrated to create composite components. Focus on testing component interfaces.
Some or all components in a system are integrated. Focus on testing component interactions.
Complete test coverage of a class involves:
Challenge: Inheritance makes it more difficult to design object class tests as the information to be tested is not localized
Benefit: Automation enables continuous testing and reduces human error in test execution
Initialize the system with the test case, namely the inputs & expected outputs
Call the object or method to be tested
Compare the result of the call with the expected result. If assertion evaluates to true, test successful; if false, test failed
The test cases should show that, when used as expected, the component works correctly. If there are defects, these should be revealed by test cases.
Should reflect normal operation of a program & should show that the component works as expected
Should use abnormal inputs to check that these are properly processed & do not crash the component
Identify groups of inputs that have common characteristics & should be processed in the same way
You should choose tests from within each of these groups
Use testing guidelines to choose test cases
These guidelines reflect previous experience of the kinds of errors that programmers often make
Input equivalence partitions
Output partitions
Correct outputs
Less than 10000: 9999
Between 10000 and 99999: 10000, 50000, 99999
More than 99999: 100000
Less than 4: 3
Between 4 and 10: 4, 7, 10
More than 10: 11
The objective is to detect faults due to interface errors or invalid assumptions about interfaces
Data passed from one method or procedure to another
Block of memory is shared between procedures or functions
Sub-system encapsulates a set of procedures to be called by other sub-systems
Sub-systems request services from other sub-systems
A calling component calls another component & makes an error in its use of its interface e.g., parameters in the wrong order
A calling component embeds assumptions about the behaviour of the called component which are incorrect
The called & the calling component operate at different speeds & out-of-date information is accessed
Exhaustive system testing is impossible so testing policies which define the required system test coverage may be developed
Examples of testing policies:
Define what to build
Create automated test
Execute (should fail)
Write code to pass test
Improve code quality
Every code segment that you write has at least one associated test so all code written has at least one test
A regression test suite is developed incrementally as a program is developed
When a test fails, it should be obvious where the problem lies. The newly written code needs to be checked & modified
The tests themselves are a form of documentation that describe what the code should be doing
Release testing is a form of system testing
A separate team that has not been involved in the system development, should be responsible for release testing
System testing by the development team should focus on discovering bugs in the system (defect testing). The objective of release testing is to check that the system meets its requirements & is good enough for external use (validation testing)
Requirements-based testing involves examining each requirement & developing a test or tests for it
Mentcare system requirements example:
George is a nurse who specializes in mental healthcare. One of his responsibilities is to visit patients at home to check that their treatment is effective & that they are not suffering from medication side effects.
On a day for home visits, George logs into the Mentcare system & uses it to print his schedule of home visits for that day, along with summary information about the patients to be visited. He requests that the records for these patients be downloaded to his laptop. He is prompted for his key phrase to encrypt the records on the laptop.
One of the patients that he visits is Jim, who is being treated with medication for depression. Jim feels that the medication is helping him but believes that it has the side effect of keeping him awake at night. George looks up Jim's record & is prompted for his key phrase to decrypt the record.
Users of the software work with the development team to test the software at the developer's site
A release of the software is made available to users to allow them to experiment & to raise problems that they discover with the system developers
Customers test a system to decide whether or not it is ready to be accepted from the system developers & deployed in the customer environment. Primarily for custom systems
Establish standards
Create test strategy
Design specific tests
Execute test cases
Review findings
Make final decision
Today we covered:
Remember: Testing shows the presence of bugs, not their absence!
We'll continue our exploration of software engineering by examining:
Preparation: Review today's testing concepts and think about how they apply to long-term software maintenance
JUnit (Java), pytest (Python), Jest (JavaScript), NUnit (.NET)
"The Art of Software Testing" by Myers, Sandler & Badgett
Software Testing Help, Ministry of Testing community
Selenium (web testing), Postman (API testing), LoadRunner (performance)
COIT20258 - Software Engineering
Week 6: Software Testing