Testing These slides are derived from various sources, including slides from a Rational Software course on testing. Copyright to the original slides resides with IBM/Rational. They are used here, in this course, under password protection limited to students enrolled in the course, with permission of the owners, but are not to be published or further distributed. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 1 INTRODUCTION 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 2 Functional Testing • A common, broad current meaning for functional testing is – Black box – Interested in any externally visible or measurable attributes of the software other than performance. • In functional testing, we think of the program as a collection of functions – We test it in terms of its inputs and outputs. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 3 “V” Model of Software Development 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 4 TEST IDEAS 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 5 Test Idea • A brief statement that identifies a test that might be useful. • Differs from a test case, in that the test idea contains no specification of the test workings, only the essence of the idea behind the test. • Test ideas are generators for test cases: potential test cases are derived from a test ideas list. • A key question for the tester or test analyst is which ones are the ones worth trying. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 6 Ground Rules for Brainstorming • • • • • • The goal is to get lots of ideas. You brainstorm together to discover categories of possible tests—good ideas that you can refine later. There are more great ideas out there than you think. Don’t criticize others’ contributions. Jokes are OK, and are often valuable. Work later, alone or in a much smaller group, to eliminate redundancy, cut bad ideas, and refine and optimize the specific tests. Often, these meetings have a facilitator (who runs the meeting) and a recorder (who writes good stuff onto flipcharts). These two keep their opinions to themselves. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 7 Exercise • A field can accept integer values between 20 and 50. • What tests should you try? 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 8 Ideas List for Integer-Input Tests • Answers to the exercise might include: Test Why it’s interesting Expected result 20 Smallest valid value Accepts it 19 Smallest -1 Reject, error msg 0 0 is always interesting Reject, error msg Blank Empty field, what’s it do? Reject? Ignore? 49 Valid value Accepts it 50 Largest valid value Accepts it 51 Largest +1 Reject, error msg -1 Negative number Reject, error msg 4294967296 2^32, overflow integer? Reject, error msg Where Do Test Ideas Come From? • Where would you derive Test Ideas Lists? – Models – Specifications – Customer complaints – Brainstorm sessions among colleagues • How do you create them for your project? 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 10 Identify a Generic List of Test Ideas • Think about the categories of values you’d consider generally applicable in an integer input field with Lower Bound (LB) and Upper Bound (UB). Test Why it’s interesting Expected result A Catalog of Test Ideas for Integer-Input tests Nothing Valid value At LB of value At UB of value At LB of value - 1 At UB of value + 1 Outside of LB of value Outside of UB of value 0 Negative At LB number of digits or chars • At UB number of digits or chars • Empty field (clear the default value) • Outside of UB number of digits or chars • • • • • • • • • • • 5/29/2016 • • • • • • • • • • • Non-digits Wrong data type (e.g. decimal into integer) Expressions Space Non-printing char (e.g., Ctrl+char) DOS filename reserved chars (e.g., "\ * . :") Upper ASCII (128-254) Upper case chars Lower case chars Modifiers (e.g., Ctrl, Alt, Shift-Ctrl, etc.) Function key (F2, F3, F4, etc.) Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 12 The Test-Ideas Catalog • A list of related test ideas that are usable under many circumstances. – For example, the test ideas for numeric input fields can be catalogued together and used for any numeric input field. • In many situations, these catalogs are sufficient test documentation. That is, an experienced tester can often proceed with testing directly from these without creating documented test cases. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 13 Using a Test Matrix Field name Field name Field name TESTING IN UNIFIED PROCESS 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 15 Review: UP Disciplines & Phases In an iteration, you typically address all disciplines Disciplines group activities logically 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 16 Overview of Unified Process Activity: A unit of Concepts work a Role may be asked to perform Role: A set of related responsibilities that may be assigned to an individual or a team in the development organization 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. Artifact: A piece of information that is produced, modified, or used by an Activity 17 Roles Are Used for Resource Planning Role Activities Paul Architect Identify Design Mechanisms Mary System Analyst Find Actors and Use Cases Joe Requirements Specifier Detail a Use Case Sylvia Test Analyst Jane Tester Identify Test Ideas OneFailure role can be Analyze assigned to one or more individuals Resource Each individual in the project is assigned to one or more roles 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 18 RUP TESTING ROLES 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 19 Test Manager Activities: Agree Mission Test Manager Identify Test Motivators Obtain Testability Commitment Assess and Advocate Quality Assess and Improve Test Effort Artifacts: Test Manager Test Plan Test Evaluation Summary The Test Manager role is tasked with the overall responsibility for the test effort's success. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 20 Test Analyst Activities: Test Analyst Identify Targets of Test Identify Test Ideas Define Test Details Define Assessment and Traceability Needs Determine Test Results Artifacts: Test Analyst Test Ideas List Test Case Workload Analysis Model Test Data Test Results The Test Analyst role is responsible for initially identifying and defining the required tests, and subsequently evaluating the results of the test effort. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 21 Test Designer Activities: Test Designer Define Test Approach Define Test Environment Configurations Identify Testability Mechanisms Structure the Test Implementation Define Testability Elements Develop Test Guidelines Artifacts: Test Designer Test Automation Architecture Test Interface Specification Test Environment Configuration Test Suite Test Guidelines The Test Designer role is responsible for defining the test approach and ensuring its successful implementation. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 22 Tester Activities: Implement Test Tester Implement Test Suite Execute Test Suite Analyze Test Failure Artifacts: Tester Test Scripts Test Log The Tester role is responsible for the core activities of the test effort, which involves conducting the necessary tests and logging the outcomes of that testing. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 23 Test Discipline Workflow Define Evaluation Mission Identify the appropriate focus of the test effort for the iteration. Gain agreement with stakeholders on the corresponding goals that will direct the test effort. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 24 Test Discipline Workflow Verify Test Approach Demonstrate the techniques outlined in the Test Approach will support the required testing. Verify that the approach will work, produce accurate results and is appropriate for the available resources. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 25 Test Discipline Workflow Validate Build Stability Validate that the build is stable enough for detailed test and evaluation work to begin. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 26 Test Discipline Workflow Test and Evaluate Achieve appropriate breadth and depth of testing to enable a sufficient evaluation of the targeted test items. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 27 Test Discipline Workflow Achieve Acceptable Mission Deliver a useful evaluation result to the stakeholders of the test effort. Actively prioritize the test work that remains to be conducted. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 28 Test Discipline Workflow Improve Test Assets Maintain and improve the evolving test assets. (e.g. Maintain test suites and test data; harvest test-ideas into catalogs; clarify change request details) 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 29 Testing Workflow Artifacts Test model artifacts Test cases Test procedures Test components Test subsystem packages for complex test Other artifacts Test Plan Defects Test Evaluation MISSION OF TEST GROUP 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 31 Which Group is Better? Testing Group 1 Testing Group 2 From Marick, Classic Testing Mistakes Function A Function B Function C Function D Function E Total Found prerelease 100 0 0 0 0 100 Function A Function B Function C Function D Function E Total 50 6 6 6 6 74 Two groups test the same program. • The functions are equally important • The bugs are equally significant Which Group is Better? Function Function Function Function Function Total A B C D E Function Function Function Function Function Total A B C D E Found prerelease 100 0 0 0 0 100 Found later 0 12 12 12 12 48 Total 50 6 6 6 6 74 50 6 6 6 6 74 100 12 12 12 12 148 100 12 12 12 12 148 Purpose of Testing? • Typical testing group has two key priorities. 1. Find the bugs (preferably in priority order). 2. Assess the condition of the whole product (as a user will see it). • Sometimes, these conflict – The mission of assessment is the underlying reason for testing, from management’s viewpoint. But if you aren’t hammering hard on the program, you can miss key risks. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 34 Missions of Test Groups Can Vary Find defects Maximize bug count Block premature product releases Help managers make ship / no-ship decisions Assess quality Minimize technical support costs Conform to regulations Minimize safety-related lawsuit risk Assess conformance to specification Find safe scenarios for use of the product (find ways to get it to work, in spite of the bugs) • Verify correctness of the product • Assure quality • • • • • • • • • • 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 35 What is your testing mission at this stage in your project? • You answer…. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 36 A Different Take on Mission: Public vs. Private Bugs • A programmer’s public bug rate includes all bugs left in the code at check-in. • A programmer’s private bug rate includes all the bugs that are produced, including the ones fixed before check-in. • Estimates of private bug rates have ranged from 15 to 150 bugs per 100 statements. • What does this tell us about our task? 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 37 Defining the Test Approach • The test approach (or “testing strategy”) specifies the techniques that will be used to accomplish the test mission. • The test approach also specifies how the techniques will be used. • A good test approach is: – – – – – 5/29/2016 Diversified Risk-focused Product-specific Practical Defensible Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 38 Heuristics for Evaluating Testing Approach • James Bach collected a series of heuristics for evaluating a test approach. – Testing should be optimized to find important problems fast, rather than attempting to find all problems with equal urgency. • These are heuristics –won’t always be the best choice for your context. But in different contexts, you’ll find different ones very useful. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 39 TEST DOCUMENTATION 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 40 What Test Documentation Should You Use? • Test planning standards and templates – Examples – Some benefits and costs of using IEEE-829 standard based templates – When are these appropriate? • Thinking about your requirements for test documentation – Requirements considerations – Questions to elicit information about test documentation requirements for your project 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 41 IEEE Standard 829 for Software Test Documentation Test plan • • Test-design specification • Test-case specification – – – – – – – Test-case specification identifier Test items Input specifications Output specifications Environmental needs Special procedural requirements Inter-case dependencies We often see one or more pages per test case. • Test-procedure specification • Test-item transmittal report • Test-log 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 42 Considerations for IEEE 829 • What is the documentation cost per test case? • What is the maintenance cost of the documentation, per test case? • If software design changes create documentation maintenance costs, how much inertia do we build into our system? How much does extensive test documentation add to the cost of late improvement of the software? How much should we add? • What inertia is created in favor of invariant regression testing? • Is this incompatible with exploratory testing? Do we always want to discourage exploration? 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 43 Requirements for Test Documentation – There are many different notions of what a good set of test documentation would include. Before spending a substantial amount of time and resources, it’s worth asking what documentation should be developed (and why?) – Test documentation is expensive and it takes a long time to produce. If you figure out some of your main requirements first, you might be able to do your work in a way that achieves them. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 44 Test Docs Requirements Questions • Is your test documentation a product or a tool? – A product is something that you give to someone else to use. They pay for it. You will probably follow whatever standard they request, subject to their willingness to pay for it. – In contrast, if the documentation is merely an in-house tool, it doesn't have to be any more complete, more organized, or more tidy than the minimum you need to help you meet your objectives. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 45 Write a Purpose Statement for Test Documentation • Try to describe your core documentation requirements in one sentence that doesn’t have more than three components. • Examples: – The test documentation set will primarily support our efforts to find bugs in this version, to delegate work, and to track status. – The test documentation set will support ongoing product and test maintenance over at least 10 years, will provide training material for new group members, and will create archives suitable for regulatory or litigation use. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 46 What is the purpose of the test documention at this stage of your project? • Your team decides? • The instructor decides? 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 47 Review: Define Evaluation Mission • What is a Test Mission? • What is your Test Mission? • What makes a good Test Approach (Test Strategy)? • What is a Test Documentation Mission? • What is your Test Documentation Goal? 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 48 IMPLEMENTING TESTS 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 49 Test and Evaluate – Part One: Test Where this fits into the UP Testing workflow This addresses the “How?” question: How will you test those things? 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 50 Test and Evaluate – Part One: Test The activity here is Implement Test Earlier, we covered TestIdea Lists, which are input here The next activity is Analyze Test Failure, the second half of Test and Evaluate 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 51 TEST TECHNIQUES 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 52 Test Techniques • There are as many as 200 published testing techniques. Many of the ideas are overlapping, but there are common themes. • Similar sounding terms often mean different things, e.g.: – User testing – Usability testing – User interface testing • What are the differences among these techniques? 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 53 Dimensions of Test Techniques • Think of the testing you do in terms of five dimensions: – Testers: who does the testing. – Coverage: what gets tested. – Potential problems: why you're testing (what risk you're testing for). – Activities: how you test. – Evaluation: how to tell whether the test passed or failed. • Test techniques often focus on one or two of these, leaving the rest to the skill and imagination of the tester. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 54 Dominant Test Approaches • Of the 200+ published Functional Testing techniques, there are ten basic themes. • They capture the techniques in actual practice. • We call them: – – – – – – – – – – 5/29/2016 Function testing Equivalence analysis Specification-based testing Risk-based testing Stress testing Regression testing Exploratory testing User testing Scenario testing Stochastic or Random testing Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 55 Which Technique Is the Best? Each has strengths and weaknesses Technique A Think in terms of complement Technique H There is no “one true way” Technique G Mixing techniques can improve coverage Technique B Testers Coverage Potential problems Activities Evaluation Technique C Technique F Technique D Technique E 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 56 Apply Techniques According to the LifeCycle • Test Approach changes over the project • Some techniques work well in early phases; others in later ones • Align the techniques to iteration objectives Inception Elaboration A limited set of focused tests A few components of software under test Simple test environment Construction Transition Many varied tests Large system under test Complex test environment Focus on architecturalOriginal & requirement risks Focus on deployment risks from course Principles of Software Testing for 5/29/2016 Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 57 Individual Techniques • • • • • • • • • • Function testing Equivalence analysis Specification-based testing Risk-based testing Stress testing Regression testing Exploratory testing User testing Scenario testing Stochastic or Random testing 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 58 INDIVIDUAL TECHNIQUES: FUNCTION TESTING 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 59 Function Testing vs. Functional Testing • Earlier we distinguished “functional testing” from non-functional and whitebox testing. • Here, the term “function testing” is distinguished, as one of the kinds of functional testing. • The distinction here is that we are testing functions (small units). 5/29/2016 60 Function Testing Tag line Testers Black box unit testing Test each function thoroughly, one at a time. Any Coverage Each function and user-visible variable Potential problems Activities Evaluation A function does not work in isolation Whatever works Whatever works Complexity Simple Harshness SUT readiness Varies Any stage Objective Strengths & Weaknesses: Function Testing • Representative cases – Spreadsheet, test each item in isolation. – Database, test each report in isolation • Strengths – Thorough analysis of each item tested – Easy to do as each function is implemented • Blind spots – Misses interactions – Misses exploration of the benefits offered by the program. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 62 INDIVIDUAL TECHNIQUES: EQUIVALENCE ANALYSIS 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 63 Equivalence Analysis Tag line Objective Testers Coverage Potential problems Partitioning, boundary analysis, domain testing There are too many test cases to run. Use stratified sampling strategy to select a few test cases from a huge population. Any All data fields, and simple combinations of data fields. Data fields include input, output, and (to the extent they can be made visible to the tester) internal and configuration variables Data, configuration, error handling Equivalence Analysis Divide the set of possible values of a field into subsets, pick values to represent each subset. Typical values will be at boundaries. More generally, the goal is to find a “best Activities representative” for each subset, and to run tests with these representatives. Advanced approach: combine tests of several “best representatives”. Several approaches to choosing optimal small set of combinations. Evaluation Determined by the data Complexity Simple Designed to discover harsh single-variable Harshness tests and harsh combinations of a few variables SUT readiness Any stage Strengths & Weaknesses: Equivalence Analysis • Representative cases – Equivalence analysis of a simple numeric field. – Printer compatibility testing (multidimensional variable, doesn’t map to a simple numeric field, but stratified sampling is essential) • Strengths – Find highest probability errors with a relatively small set of tests. – Intuitively clear approach, generalizes well • Blind spots – Errors that are not at boundaries or in obvious special cases. – The actual sets of possible values are often unknowable. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 66 Exercise: GUI Equivalence Analysis • Consider your project • Select a scenario and screen • Identify each field, and for each field What is the type of the field (integer, real, string, ...)? List the range of entries that are “valid” for the field Partition the field and identify boundary conditions List the entries that are almost too extreme and too extreme for the field – List a few test cases for the field and explain why the values you chose are the most powerful representatives of their sets (for showing a bug) – Identify any constraints imposed on this field by other fields – – – – 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 67 Exercise: Data Equivalence • The program reads three integer values from a card. The three values are interpreted as representing the lengths of the sides of a triangle. The program prints a message that states whether the triangle is scalene, isosceles, or equilateral. – From Glenford J. Myers, The Art of Software Testing (1979) • Write a set of test cases that would adequately test this program. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 68 Exercise: Myers’ Answers • Test case for a valid scalene triangle • Test case for a valid equilateral triangle • Three test cases for valid isosceles triangles – (a=b, b=c, a=c) • One, two or three sides has zero value (5 cases) • One side has a negative • Sum of two numbers equals the third (e.g. 1,2,3) – Invalid b/c not a triangle (tried with 3 permutations a+b=c, a+c=b, b+c=a) • Sum of two numbers is less than the third – (e.g. 1,2,4) (3 permutations) • Non-integer • Wrong number of values (too many, too few) 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 69 Exercise: Numeric Range with Output • The program: –K=I*J – I, J and K are integer variables • Write a set of test cases that would adequately test this program 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 70 INDIVIDUAL TECHNIQUES: SPECIFICATION-BASED TESTING 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 71 Specification-Based Testing Tag line Objective Testers Coverage Potential problems Activities Evaluation Complexity Harshness SUT readiness Verify every claim Check conformance with every statement in every spec, requirements document, etc. Any Documented reqts, features, etc. Mismatch of implementation to spec Write & execute tests based on the spec’s. Review and manage docs & traceability Does behavior match the spec? Depends on the spec Depends on the spec As soon as modules are available Strengths & Weaknesses: SpecBased Testing • Representative cases – Traceability matrix, tracks test cases associated with each specification item. – User documentation testing • Strengths – Critical defense against warranty claims, fraud charges, loss of credibility with customers. – Effective for managing scope / expectations of regulatory-driven testing – Reduces support costs / customer complaints by ensuring that no false or misleading representations are made to customers. • Blind spots – Any issues not in the specs or treated badly in the specs /documentation. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 73 Traceability Tool for SpecificationBased Testing The Traceability Matrix Stmt 1 Stmt 2 Stmt 3 Stmt 4 Stmt 5 Test 1 X X Test 2 X X X Test 3 X X X Test 4 X X Test 5 Test 6 X X X X Exercise: What “Specs” Can You Use? • Challenge: – Getting information in the absence of a spec – What substitutes are available? • Example: – The user manual – think of this as a commercial warranty for what your product does. • What other “specs” can you/should you be using to test? 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 75 Exercise: Specification-Based Testing • Here are some ideas for sources that you can consult when specifications are incomplete or incorrect. – Software change memos that come with new builds of the program – User manual draft (and previous version’s manual) – Product literature – Published style guide and UI standards 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 76 INDIVIDUAL TECHNIQUES: RISK-BASED TESTING 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 78 Definitions—Risk-Based Testing • Three key meanings: 1. Find errors (risk-based approach to the technical tasks of testing) 2. Manage the process of finding errors (risk-based test management) 3. Manage the testing project and the risk posed by (and to) testing in its relationship to the overall project (riskbased project management) • • We’ll look primarily at risk-based testing (#1), proceeding later to risk-based test management. The project management risks are very important, but out of scope at this point. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 79 Risk-Based Testing Tag line Find big bugs first Define, prioritize, refine tests in terms of Objective the relative risk of issues we could test for Testers Any Coverage By identified risk Potential problems Identifiable risks Use qualities of service, risk heuristics and Activities bug patterns to identify risks Evaluation Varies Complexity Any Harshness Harsh SUT readiness Any stage Strengths & Weaknesses: Risk-Based Testing • Representative cases – – – – Equivalence class analysis, reformulated. Test in order of frequency of use. Stress tests, error handling tests, security tests. Sample from predicted-bugs list. • Strengths – Optimal prioritization (if we get the risk list right) – High power tests • Blind spots – Risks not identified or that are surprisingly more likely. – Some “risk-driven” testers seem to operate subjectively. • How will I know what coverage I’ve reached? • Do I know that I haven’t missed something critical? 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 81 Exercise: Risk-Based Testing • You are testing your project • First brainstorm: – What are the functional areas of the app? • Then evaluate risks: – What are some of the ways that each of these could fail? – How likely do you think they are to fail? Why? – How serious would each of the failure types be? 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 87 INDIVIDUAL TECHNIQUES: STRESS TESTING 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 88 Stress Testing Tag line Objective Testers Coverage Potential problems Activities Evaluation Complexity Harshness SUT readiness Overwhelm the product Learn what failure at extremes tells about changes needed in the program’s handling of normal cases Specialists Limited Error handling weaknesses Specialized Varies Varies Extreme Late stage Strengths & Weaknesses: Stress Testing • Representative cases – Buffer overflow bugs – High volumes of data, device connections, long transaction chains – Low memory conditions, device failures, viruses, other crises – Extreme load • Strengths – Expose weaknesses that will arise in the field. – Expose security risks. • Blind spots – Weaknesses that are not made more visible by stress. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 90 INDIVIDUAL TECHNIQUES: REGRESSION TESTING 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 91 Regression Testing Tag line Objective Testers Coverage Potential problems Automated testing after changes Detect unforeseen consequences of change Varies Varies Side effects of changes Unsuccessful bug fixes Create automated test suites and run against Activities every (major) build Complexity Varies Evaluation Varies Harshness Varies SUT readiness For unit – early; for GUI - late Strengths & Weaknesses— Regression Testing • Representative cases – Bug regression, old fix regression, general functional regression – Automated GUI regression test suites • Strengths – Cheap to execute – Configuration testing – Regulator friendly • Blind spots – “Immunization curve” – Anything not covered in the regression suite – Cost of maintaining the regression suite 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 93 INDIVIDUAL TECHNIQUES: EXPLORATORY TESTING 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 94 Exploratory Testing Tag line Objective Testers Coverage Potential problems Activities Evaluation Complexity Harshness SUT readiness Simultaneous learning, planning, and testing Simultaneously learn about the product and about the test strategies to reveal the product and its defects Explorers Hard to assess Everything unforeseen by planned testing techniques Learn, plan, and test at the same time Varies Varies Varies Medium to late: use cases must work Strengths & Weaknesses: Exploratory Testing • Representative cases – Skilled exploratory testing of the full product – Rapid testing & emergency testing (including thrownover-the-wall test-it-today) – Troubleshooting / follow-up testing of defects. • Strengths – Customer-focused, risk-focused – Responsive to changing circumstances – Finds bugs that are otherwise missed • Blind spots – The less we know, the more we risk missing. – Limited by each tester’s weaknesses (can mitigate this with careful management) – This is skilled work, juniors aren’t very good at it. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 96 INDIVIDUAL TECHNIQUES: USER TESTING 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 97 User Testing Tag line Objective Testers Coverage Potential problems Activities Evaluation Complexity Harshness SUT readiness Strive for realism Let’s try real humans (for a change) Identify failures in the overall human/machine/software system. Users Very hard to measure Items that will be missed by anyone other than an actual user Directed by user User’s assessment, with guidance Varies Limited Late; has to be fully operable Strengths & Weaknesses—User Testing • Representative cases – Beta testing – In-house lab using a stratified sample of target market – Usability testing • Strengths – – – – Expose design issues Find areas with high error rates Can be monitored with flight recorders Can use in-house tests focus on controversial areas – – – – Coverage not assured Weak test cases Beta test technical results are mixed Must distinguish marketing betas from technical betas • Blind spots 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 99 INDIVIDUAL TECHNIQUES: SCENARIO TESTING 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 100 Scenario Testing Instantiation of a use case Do something useful, interesting, and complex Objective Challenging cases to reflect real use Testers Any Coverage Whatever stories touch Potential Complex interactions that happen in real use problems by experienced users Interview stakeholders & write screenplays, Activities then implement tests Evaluation Any Complexity High Harshness Varies SUT readiness Late. Requires stable, integrated functionality. Tag line Strengths & Weaknesses: Scenario Testing • Representative cases – Use cases, or sequences involving combinations of use cases. – Appraise product against business rules, customer data, competitors’ output – Hans Buwalda’s “soap opera testing.” • Strengths – Complex, realistic events. Can handle (help with) situations that are too complex to model. – Exposes failures that occur (develop) over time • Blind spots – Single function failures can make this test inefficient. – Must think carefully to achieve good coverage. 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 102 Exercise: Soap Operas for Testing 1. 2. 3. 4. Consider your project Define a scope of the test Identify with the user Include elements that would make things difficult 5. Tell the story 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 106 INDIVIDUAL TECHNIQUES: STOCHASTIC TESTING 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 107 Stochastic or Random Testing Tag line Objective 5/29/2016 Monkey testing High-volume testing with new cases all the time Have the computer create, execute, and evaluate huge numbers of tests. The individual tests are not all that powerful, nor all that compelling. The power of the approach lies in the large number of tests. These broaden the sample, and they may test the program over a long period of time, giving us insight into longer term issues. Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 108 Stochastic or Random Testing Testers Potential problems Machines Broad but shallow. Problems with stateful apps. Crashes and exceptions Activities Focus on test generation Evaluation Generic, state-based Complex to generate, but individual tests are simple Weak individual tests, but huge numbers of them Any Coverage Complexity Harshness SUT readiness USING THE TECHNIQUES TOGETHER 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 110 Combining Techniques (Revisited) • A test approach should be diversified • Applying opposite techniques can improve coverage Technique A • Often one technique can extend another Technique H Technique B Testers Coverage TechniquePotential G Technique C problems Activities Technique FEvaluation Technique D Technique E 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. 111 Apply Opposite Techniques to Boost Coverage Contrast these two techniques Exploration Regression – Inputs: • models or other analyses that yield new tests – Outputs • scribbles and bug reports – Better for: • Find new bugs, scout new areas, risks, or ideas – Inputs: • Old test cases and analyses leading to new test cases – Outputs: • Archival test cases, preferably well documented, and bug reports – Better for: • Reuse across multiExploration version products 5/29/2016 Regression Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions 112 Apply Complementary Techniques Together • Regression testing alone suffers fatigue – The bugs get fixed and new runs add little info • Symptom of weak coverage • Combine automation w/ suitable variance – e.g. Risk-based equivalence analysis • Coverage of the combination can beat sum of the parts 5/29/2016 Original from course Principles of Software Testing for Testers, © 2002 Rational Software, all rights reserved. This version adapted for classroom use under provisions of the IBM Academic Initiative. Equivalence Risk-based Regression 113 Which Techniques Should You Use on your Project? • • Now: Design scenario-based tests, based on use cases. Next term: several other kinds of tests. 5/29/2016 114 Review: Characterize Testing Techniques Testers Function testing Equivalence analysis Specification-based testing Risk-based testing Stress testing Regression testing Exploratory testing User testing Scenario testing Stochastic testing Coverage Problems / Risks Activities Evaluation