Академический Документы
Профессиональный Документы
Культура Документы
A A stack of computer and no only low no documentation complex conglomeration documentation A disk printoutsand level documentation
Software Testing: A Newcomers Guide 2009 2
A Talk in 4 Parts
1. Why do we test ?
Costs and Attitudes
Cost of Testing
Youre going to spend at least half of your development budget on testing, whether you want to or not
In the real-world, testing is the principle post-design activity Restricting early testing usually increases cost Extensive hardware-software integration requires more testing
2009
Not testing is even more expensive Planning for testing after development is prohibitively expensive Hardware developers spend huge amounts on testing Software test tools arent that expensive. Many are free!!!
2009 6
Good Techniques and Tools are Not Enough: Practitioners Need to Adopt Them Too!
Software Testing: A Newcomers Guide 2009 7
Part 2 : What ?
2009
Safety critical, real-time software Web apps must be highly reliable And of course security is now all about software faults !
2009 9
Test Activities
Testing can be broken up into four general types of activities 1. Test Design 1.a) Criteria-based 2. Test Automation 1.b) Human-based 3. Test Execution 4. Test Evaluation Each type of activity requires different skills, background knowledge, education and training No reasonable software development organization uses the same people for requirements, design, implementation, integration and configuration control
Why do test organizations still use the same people for all four test activities?? This is clearly a waste of resources
Software Testing: A Newcomers Guide 2009 10
Requires much of a traditional CS degree This is intellectually stimulating, rewarding, and challenging Test design is analogous to software architecture on the development side Using people who are not qualified to design tests is a sure way to get ineffective tests
2009 11
This is much harder than it may seem to developers Criteria-based approaches can be blind to special situations Requires knowledge of :
Domain, testing, and user interfaces
2009
12
2. Test Automation
Embed test values into executable scripts
Requires very little theory Very boring for test designers Programming is out of reach for many domain experts Who is responsible for determining and embedding the expected outputs ?
Test designers may not always know the expected outputs Test evaluators need to get involved early to help with this
2009
13
3. Test Execution
Run tests on the software and record the results
This is easy and trivial if the tests are well automated Requires basic computer skills
Interns Employees with no technical background
Asking qualified test designers to execute tests is a sure way to convince them to look for a development job If, for example, GUI tests are not well automated, this requires a lot of manual labor Test executors have to be very careful and meticulous with bookkeeping
2009
14
4. Test Evaluation
Evaluate results of testing, report to developers
2009
15
Other Activities
Test management : Sets policy, organizes team, interfaces with development, chooses criteria, decides how much automation is needed, Test maintenance : Tests must be saved for reuse as software evolves
Requires cooperation of test designers and automators Deciding when to trim the test suite is partly policy and partly technical and in general, very hard ! Tests should be put in configuration control
2009
16
A mature test organization may need only one test designer to work with several test automaters, executors and evaluators Improved automation will reduce the number of test executors
Theoretically to zero but not in practice
Putting the wrong people on the wrong tasks leads to inefficiency, low job satisfaction and low job performance
A qualified test designer will be bored with other tasks and look for a job in development A qualified test evaluator will not understand the benefits of test criteria
Test evaluators have the domain knowledge, so they must be free to add tests that blind engineering processes will not think of
2009
17
These four general test activities are quite different It is a poor use of resources to use people inappropriately Most test teams use the same people for ALL FOUR activities !!
2009
18
To use our people effectively and to test efficiently we need a process that lets test designers raise their level of abstraction
2009
19
software artifact
input values
pass / fail
test results
test scripts
test cases
2009
20
software artifact
execute evaluate automate pass / test test test fail results scripts cases
2009
21
Test Design
software artifact
IMPLEMENTATION Raising our abstraction level makes ABSTRACTION test design MUCH easier LEVEL
input values
pass / fail
test results
test scripts
test cases
Test Evaluation
Software Testing: A Newcomers Guide
Test Execution
2009 22
Like any field, software testing comes with a large number of specialized terms that have particular meanings in this context Some of the following terms are standardized, some are used consistently throughout the literature and the industry, but some vary by author, topic, or test organization The definitions here are intended to be the most commonly used
2009
23
Validation : The process of evaluating software at the end of software development to ensure compliance with intended usage Verification : The process of determining whether the products of a given phase of the software development process fulfill the requirements established during the previous phase
2009
24
Test Engineer : An IT professional who is in charge of one or more technical test activities
designing test inputs producing test values running test scripts analyzing results reporting results to developers and managers
2009
25
design
Test Designs
Test Engineer
instantiate
Executable Tests
Test Engineer
Computer
execute
Output
Evaluate
2009
26
2009
27
Software Fault : A static defect in the software Software Error : An incorrect internal state that is the manifestation of some fault Software Failure : External, incorrect behavior with respect to the requirements or other description of the expected behavior
2009
28
2009
29
2009
30
Test Case
Test Case Values : The values that directly satisfy one test requirement Expected Results : The result that will be produced when executing the test if the program satisfies it intended behavior
2009
31
Software Observability : How easy it is to observe the behavior of a program in terms of its outputs, effects on the environment and other hardware and software components
Software that affects hardware devices, databases, or remote files have low observability
Software Controllability : How easy it is to provide a program with the needed inputs, in terms of values, operations, and behaviors
Easy to control software with inputs from keyboards Inputs from hardware sensors or distributed software is harder Data abstraction reduces controllability and observability
2009
32
Prefix Values : Any inputs necessary to put the software into the appropriate state to receive the test case values Postfix Values : Any inputs that need to be sent to the software after the test case values Two types of postfix values
1. Verification Values : Values necessary to see the results of the test case values 2. Exit Commands : Values needed to terminate the program or otherwise return it to a stable state
Executable Test Script : A test case that is prepared in a form to be executed automatically on the test software and produce a report
Example: Junit tests
2009
33
Top-Down Testing : Test the main procedure, then go down through procedures it calls, and so on Bottom-Up Testing : Test the leaves in the tree (procedures that make no calls), and move up to the root.
Each procedure is not tested until all of its children have been tested
2009
34
Black-box testing : Deriving tests from external descriptions of the software, including specifications, requirements, and design White-box testing : Deriving tests from the source code internals of the software, specifically including branches, individual conditions, and statements
This view is really out of date. The more general question is: from what level of abstraction to we derive tests? tests?
Software Testing: A Newcomers Guide 2009 35
2009
36
main Class P
Acceptance testing: Is the software acceptable to the user? System testing: Test the overall functionality of the system Integration testing: Test how modules interact with each other Module testing: Test each class, file, module or component Unit testing: Test each unit (method) individually
37
2009
Tailored to:
a particular software artifact code, design, specifications a particular phase of the lifecycle requirements, specification, design, implementation
But graphs do not characterize all testing techniques well Four abstract models seem to suffice
2009
38
Test
Criterion : A collection of rules and a process that define test requirements Testing researchers have defined dozens of criteria, but they are all really just a few criteria on four types of structures
2009
39
2. Logical Expressions
(not X or not Y) and A and B A: {0, 1, >1} B: {600, 700, 800} C: {swe, cs, isa, infs} if (x > y) z = x - y; else z = 2 * x;
2009 40
4. Syntactic Structures
Software Testing: A Newcomers Guide
7 Node (Statement) Edge (Branch) Path Cover every node Cover every edge Cover every path
12567 12567 12567 1343567 1343567 1257 1357 13567 1357 1343567
2009
134357
41
2
def = {x, y} use = {x} use = {a}
6
use = {m}
1
use = {x} def = {a}
5 3
use = {a}
DefsDefs & Uses All Uses Pairs All Every(1,2)), (x, 1, (1,3)) (x, 1, def used once Every def reaches every
(y, 1, 4), (y, 1, 6) use
4
def = {m} use = {y}
1, 2, 5, 6, 7
1, 3, 4, 3, 5,7
42
Driver 1 Configuration
[Ignition = off] | Button1 [Ignition = on] |
Driver 2 Configuration
seatBack () seatBottom () lumbar () sideMirrors ()
(to Modified)
Ignition = off
Ignition = off
[Ignition = on] |
Modified Configuration
43
2. Logical Expressions
( (a > b) or G ) and (x < y)
Transitions Logical Program Decision Statements Software Specifications Expressions
2009
44
2. Logical Expressions
( (a > b) or G ) and (x < y)
2009
45
2. Logic Active Clause Coverage or Multiple Condition/Decision Coverage (MCDC) ( (a > b) or G ) and (x < y)
With these values for G and (x<y), (a>b) determines the value of the predicate
1 T 2 F 3 F 4 F 5 T 6 T
F F T F T T
T T T T T F
2009 46
duplicate
For implicant cd
For c, choose UTP, NFP pair FFTT, FFFT For d, choose UTP, NFP pair FFTT, FFTF
System level
Number of students Level of course Major { 0, 1, >1 } { 600, 700, 800 } { swe, cs, isa, infs }
Unit level
Parameters F (int X, int Y) Possible values X: { <0, 0, 1, 2, >2 }, Y : { 10, 20, 30 } Tests F (-5, 10), F (0, 20), F (1, 30), F (2, 10), F (5, 20)
2009
48
4. Syntactic Structures
z = x - y; ( z = x + y; ( z = x m; else z = 2 * x;
2009
49
Source of Structures
Model-based testing derives tests from a model that describes some aspects of the system under test
The model usually describes part of the behavior The source is usually not considered a model
2009
50
Coverage Overview
Four Structures for Modeling Software Graphs
Applied to
Logic
Applied to Source Specs
Input Space
FSMs DNF
Syntax
Applied to
Source Design
Software Testing: A Newcomers Guide
Source
Models Input
51
Integ
Coverage
Given a set of test requirements TR for coverage criterion C, a test set T satisfies C coverage if and only if for every test requirement tr in TR, there is at least one test t in T TR, such that t satisfies tr
2009
52
2009
53
Generator : A procedure that automatically generates values to satisfy a criterion Recognizer : A procedure that decides whether a given set of test values satisfies a criterion Both problems are provably undecidable for most criteria It is possible to recognize whether test cases satisfy a criterion far more often than it is possible to generate tests that satisfy the criterion Coverage analysis tools are quite plentiful
2009
54
Criteria Subsumption : A test criterion C1 subsumes C2 if and only if every set of test cases that satisfies criterion C1 also satisfies C2 Must be true for every set of test cases Example : If a test set has covered every branch in a program (satisfied the branch criterion), then the test set is guaranteed to also have covered every statement
2009
55
Traditional software testing is expensive and labor-intensive Formal coverage criteria are used to decide which test inputs to use More likely that the tester will find problems Greater assurance that the software is of high quality and reliability A goal or stopping rule for testing Criteria makes testing more efficient and effective
Part 3 : How ?
2009
57
2009
58
Level 0 Thinking
Testing is the same as debugging Does not distinguish between incorrect behavior and mistakes in the program Does not help develop software that is reliable or safe
Level 1 Thinking
Level 2 Thinking
Purpose is to show failures Looking for failures is a negative activity Puts testers and developers into an adversarial relationship What if there are no failures?
This describes most software companies. How can we move to a team approach ??
Software Testing: A Newcomers Guide 2009 61
Level 3 Thinking
Testing can only show the presence of failures Whenever we use software, we incur some risk Risk may be small and consequences unimportant Risk may be great and the consequences catastrophic Testers and developers work together to reduce risk
Level 4 Thinking
A mental discipline that increases quality
Testing is only one way to increase quality Test engineers can become technical leaders of the project Primary responsibility to measure and improve software quality Their expertise should help the developers
Summary
2009
64
Open Questions
2009
65
Why do we test to reduce the risk of using the software Four types of test activities test design, automation, execution and evaluation Software terms faults, failures, the RIP model, observability and controllability Four structures test requirements and criteria Test process maturity levels level 4 is a mental discipline that improves the quality of the software
2009
67
Basic Issues
Many systems have only a GUI interface Problems may exist in GUI, or in underlying application Structural Tests Legal event sequences / hiding of uninteresting events Model Based Tests Operational / Behavioral / Graph models
Research Foci
Case studies on industrial software Reuse and scalability are huge issues Particularly in the presence of maintenance Crash testing
2009
68
Basic Issues
Define a labeled state space with transitions: A state machine Check (temporal) properties over paths in that state space Bonus: Counterexamples Standard Problem: Scalability
Research Foci
Show two descriptions consistent (or identical) Test case generation Interpreting counterexamples as test cases Using model checker as test generation engine Model checking real code Direct application to programs (eg JavaPathFinder)
2009
69
Basic Issues
Embedded software has a huge observability problem How do you know the exact state of the SUT? Testing timeliness constraints as well as functional correctness
Research Foci
Abstract models for SUT Notions such as Partial Observability Passive Testing Non interference of test harness with observations Test specification frameworks for specific domains TTCN-3
2009
70
Basic Issues
Scale: How to manage very large artifacts Comprehensiveness: How to encompass heterogeneous analyses?
Research Foci
In vivo testing of deployed applications Contrast with testing in a lab No clean slate Flexible frameworks to manage analysis Dealing with large test suites Substantial test set up time required Contention for test resource between different test tasks
2009
71
Basic Issues
Test cases are derived from a model of the SUT Modeling addresses many engineering concerns Very active research area
Research Foci
Testing real-time systems when to best schedule a test? Testing from UML Sequence and state machine models Exploring the link between formal modeling and model-based testing
2009
72
Basic Issues
Analyze code without execution Widely used for identifying vulnerabilities and other flaws
Research Foci
Empirical analysis of effectiveness of static analysis tools Fault detection Refactoring Symbolic analysis Safety analysis for critical software Actionable static analysis alerts Distinguishing false positives from true positives
2009
73
Basic Issues
Testing intended security functions Very similar to testing any other type of function Testing for unintended behavior Much harder focus is on what system does not do
Research Foci
Adapting functional tests to also test intended security functions Separation of concerns implementations Predicting which components are attack targets Early identification of problem components Issue of false positives vs. true positives Very high level models Seasonal variations in vulnerability discovery
2009
74
Basic Issue
Empirical studies are crucial foundations for software engineering Only so much you can do with theorems
Research Foci
Studying automating software testing in large organizations What are the factors that lead to success? Studying capture/recapture models Effect of number of natural faults Studying redundancy in test cases Basis for reducing test sets such as regression sets
2009
75
Basic Issues
Old, but very important problem We need tools that can automatically generate good test data!
Research Foci
Generating feasible paths in finite state machines Hard problem whether a given transition is, in fact, feasible Generating test inputs to follow paths Key factors Constraint solving Path explosion Relation of paths to other coverage goals Test inputs to satisfy complex predicates Efficient algorithms
2009
76
Basic Issues
Web testing is large, complex issue Reliability requirements are very high Customers simply click away from unreliable web applications
Research Foci
Testing tools for web services Data driven test generation Taking advantage of user session data Identifying key relationships by observing actual behavior Penetration testing By definition, every web application is a potential target Key: Find vulnerabilities in web applications before the bad guys
2009
77
Basic Issues
Very disparate session Logic faults, fault localization, and aspect-oriented programming!
Research Foci
Minimizing the size of fault-detecting test sets (logic testing) Analyzing infeasible test requirements Making sure every test has a reason for being in the set Tracing failed test cases back to faults Probabilistic distributions of faults Aspect-Oriented programming Using test cases to drive pointcut descriptors
2009
78
Basic Issues
Mutation testing is a powerful approach to testing Goal is a test set sensitive enough to detect all mutants Mutants used as source for seeded faults Testing nonfunctional properties such as response time and security
Research Foci
Mutation testing for logic expressions New mutation operators with much more powerful mutants Revived research interest in Higher-Order Mutants (HOMs) Mutation testing of database applications Goal: Test databases rich enough to detect query faults Testing component-based distributed systems Widespread applications demand effective approaches
2009
79
Basic Issues
Assertions are statements that must be true at given points in execution Extremely powerful approach to fault detection Failure states are program states after something bad happens.
Research Foci
Extracting tests from runtime failures Automatically turning any failure (in operation) into a test Huge potential practical impact Clearly, overhead needs to be low Assertion-based test validation When software is modified, which assertions need to be checked? Metamorphic testing Solving the oracle problem by relating multiple program runs Experience with implementing this approach via assertions
2009
80
Basic Issue
Testability: The degree to which components are easy to test Components can be designed to be easier to test The efficiency of the test process
Research Foci
Why testability is hard in practice Organizational factors Technical Factors
2009
81
Basic Issues
How to plan for test phase of a project How to optimize test resources
Research Foci
Estimating test effort based on use cases Case study with comparison to other approaches Estimating test effort for functional test cases Case study Regression set selection Which tests need to be rerun Evaluation on large industrial system
2009
82
Basic Issues
Test generation Code for multi-core processors Specialized languages
Research Foci
Test generation to satisfy coverage criteria Application to safety critical system How to test code optimized for multi-core? Testing multi-threaded is much harder than single-threaded! Developing high level languages for specific domains High level test approaches are a necessary complement
2009
83