120 likes | 135 Vues
Tips and guidelines for comprehensive software testing covering syntax testing, test specifications, combining rules, complex tests, error test specifications, test content rules, incorporating white box testing, using test drivers and suite drivers, and comparing actual and expected outputs. Recommendations for inspecting code and transitioning to advanced testing practices.
E N D
Plan for today • Review from last week • Basic testing (text book) lec1, lec2 • Syntax testing (chapter 16) Testing/COM 3220/99
Chapter 4: Test Specifications • Format: • Test 3: • Global is initially 5; setglobal(3,7); • Expect • return value is -1; global is 3 • Describe exact, complete inputs. Testing/COM 3220/99
Marking requirements • Test requirements initially marked 0. • Increment each time satisfied by test. • Satisfy many test requirements with a single test specification. Testing/COM 3220/99
Combining rules • Each test specification should satisfy as many test requirements as is reasonable. • All test requirements must be satisfied. • If you must choose among test requirements, choose the one that is satisfied least. • Avoid repeating values; add variety. Testing/COM 3220/99
Need for complex tests (4.2.1) • Think about bugs which are not revealed by simple tests. Testing/COM 3220/99
Error test specifications (4.3) • Normally: use as many requirements per test as possible. • Exception: Test each error in isolation. Reason: errors often mask each other. Testing/COM 3220/99
Rules for test content • Foreground modifications must be visible. (variables a test would change) • Background variables must be visible. (variables that should not be modified) • Is accidental correctness avoided? A+A, A*A, A=2 • Test requirements must be exercised • Make inputs distinct. Testing/COM 3220/99
Combine with white box testing (4.7.2) • Build new checklist from code, generating test requirements from the code. • New tests or update old ones? • Updating old test preferable since it leads to fewer, more complex tests. But sometimes better to write new test (could invalidate old test requirements). Testing/COM 3220/99
Test Drivers and Suite Drivers (chapter 5) • All tests for a product should be collected into a regression test suite. • Rerun test suite periodically. • Test driver: runs one test • Suite driver: runs entire suite Testing/COM 3220/99
Comparing actual and expected outputs • Are expected outputs text? File comparison. How robust? What if more new-line and space characters for better formatting? • Use parsing and object comparison. • How to generate reference file? Generate and check? Testing/COM 3220/99
Inspecting Code with the Question Catalog (chapter 6) • Some faults difficult to detect with testing • Question catalog appendix D (very C oriented) With Java the catalog is much shorter. • If a new field is added to a declaration, has any initializing code not been changed? • Yes answer means a probable fault (Java compiler would detect anyway). Testing/COM 3220/99
PART 2:Getting Going (chapter 10) • Gradual adoption • Current practice is changed little in each step. • First step: use coverage. • If coverage is low: forget about coverage while you improve testing. Testing/COM 3220/99