Your SlideShare is downloading. ×
0
Static Testing 1 Principles 2 Lifecycle 4 Dynamic test techniques 3 Static testing 5 Management 6 Tools Software Testing  ...
Contents <ul><li>Reviews and the test process </li></ul><ul><li>Types of review </li></ul><ul><li>Static analysis </li></ul>
People techniques <ul><li>individual: </li></ul><ul><ul><li>desk-checking, data-stepping, proof-reading </li></ul></ul><ul...
Benefits of reviews <ul><li>Development productivity improvement </li></ul><ul><li>Reduced development timescales </li></u...
Reviews are cost-effective <ul><li>10 times reduction in faults reaching test, testing cost reduced by 50% to 80% </li></u...
<ul><li>25% reduction in schedules, remove 80% - 95% of faults at each stage, 28 times reduction in maintenance cost, many...
What can be Inspected? Anything written down can be Inspected <ul><li>policy, strategy, business plans, marketing or adver...
<ul><li>system designs, logical & physical </li></ul><ul><li>software code </li></ul><ul><li>user manuals, procedures, tra...
What can be reviewed? <ul><li>anything which could be Inspected </li></ul><ul><ul><li>i.e. anything written down </li></ul...
What to review / Inspect? Tests Tests Tests Tests Requirements Design  Code  Functions Integration T Unit Test Accept. Tes...
Costs of reviews <ul><li>Rough guide: 5%-15% of development effort </li></ul><ul><ul><li>half day a week is 10% </li></ul>...
Contents Reviews and the test process Types of review Static analysis ISEB Foundation Certificate Course Static testing 1 ...
Types of review of documents <ul><li>Informal Review undocumented </li></ul><ul><ul><ul><li>widely viewed as useful and ch...
<ul><li>Decision-making Review: </li></ul><ul><ul><ul><li>group discusses document and makes a decision about the content,...
Types of review of documents <ul><li>Walkthrough </li></ul><ul><ul><ul><li>author guides the group through a document and ...
Reviews in general 1 <ul><li>Objectives / goals </li></ul><ul><ul><li>validation & verification against specifications & s...
Reviews in general 2 <ul><li>Activities </li></ul><ul><ul><li>planning </li></ul></ul><ul><ul><li>overview / kickoff meeti...
Reviews in general 3 <ul><li>Roles and responsibilities </li></ul><ul><ul><li>Leader / moderator - plans the review / Insp...
<ul><ul><li>Reviewers / Inspectors - specialised fault-finding roles for Inspection </li></ul></ul><ul><ul><li>Managers - ...
Reviews in general 4 <ul><li>Deliverables </li></ul><ul><ul><li>Changes (edits) in review product </li></ul></ul><ul><ul><...
Reviews in general 5 <ul><li>Pitfalls (they don’t always work!) </li></ul><ul><ul><li>lack of training in the technique (e...
<ul><ul><li>Lack of management support - “lip service” - want them done, but don’t allow time for them to happen in projec...
Inspection is different <ul><li>the document to be reviewed is given out in advance </li></ul><ul><li>typically dozens of ...
Inspection is different <ul><li>some people have time to look through it and make comments before the meeting (which is di...
Inspection is different <ul><li>&quot;I don't like this&quot; </li></ul><ul><li>much discussion, some about technical  app...
Inspection is more and better <ul><li>entry criteria  </li></ul><ul><li>training  </li></ul><ul><li>optimum checking rate ...
The Inspection Process Software Development Stage . . Planning Kick off Ind Chk Meet Edit Change Request Process  Improvem...
At first glance .. Here’s a document: review this (or Inspect it)
Reviews: time and size determine rate Time Checking Rate Size 2 hrs? 100 pages? 50 pages per hour Checking Rate
Review “Thoroughness”? ordinary “review” - finds some faults, one major, fix them, consider the document now corrected and...
Inspection: time and rate determine size Time Checking Rate Size 2 hrs? Optimum: 1 page *   per hour 2 pages (at optimum r...
Inspection Thoroughness Inspection can find deep-seated faults:  <ul><li>all of that type can be corrected </li></ul><ul><...
Inspection surprises <ul><li>Fundamental importance of Rules </li></ul><ul><ul><li>democratically agreed as applying </li>...
Contents <ul><li>Reviews and the test process </li></ul><ul><li>Types of review </li></ul><ul><li>Static analysis </li></ul>
What can static analysis do?   Remember: static techniques do not execute the code <ul><li>A form of automated testing </l...
<ul><li>Descended from compiler technology </li></ul><ul><ul><li>a compiler statically analyses code, and “knows” a lot ab...
Data flow analysis <ul><li>This is the study of program variables </li></ul><ul><ul><li>variable defined* where a value is...
Data flow analysis faults n := 0 read (x) n := 1 while x > y do begin   read (y)   write( n*y)   x := x - n end Data flow ...
Control flow analysis <ul><li>Highlights: </li></ul><ul><ul><li>nodes not accessible from start node </li></ul></ul><ul><u...
Unreachable code example <ul><li>Macro definitions (different for different platforms the code runs on) </li></ul><ul><li>...
<ul><li>Static Analysis finds the THEN clause unreachable, so will flag a fault </li></ul>
Cyclomatic complexity <ul><li>cyclomatic complexity is a measure of the complexity of a flow graph </li></ul><ul><ul><li>(...
Which flow graph is most complex? 1 2 3 5 What is the cyclomatic complexity?
Example control flow graph Result = 0 Right = 0 DO WHILE more Questions IF Answer = Correct THEN    Right = Right + 1 ENDI...
Other static metrics <ul><li>lines of code (LOC) </li></ul><ul><li>operands & operators (Halstead’s metrics) </li></ul><ul...
Limitations and advantages <ul><li>Limitations: </li></ul><ul><ul><li>cannot distinguish &quot;fail-safe&quot; code from p...
Summary: Key Points <ul><li>Reviews help to find faults in development and test documentation, and should be applied early...
Upcoming SlideShare
Loading in...5
×

Iseb, ISTQB Static Testing

8,204

Published on

Iseb, ISTQB Static Testing Foundation Level Software Testing Lecture Notes, Static Testing www.onsoftwaretest.com

Published in: Technology, Business
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
8,204
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
912
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide
  • Transcript of "Iseb, ISTQB Static Testing"

    1. 1. Static Testing 1 Principles 2 Lifecycle 4 Dynamic test techniques 3 Static testing 5 Management 6 Tools Software Testing ISEB Foundation Certificate Course
    2. 2. Contents <ul><li>Reviews and the test process </li></ul><ul><li>Types of review </li></ul><ul><li>Static analysis </li></ul>
    3. 3. People techniques <ul><li>individual: </li></ul><ul><ul><li>desk-checking, data-stepping, proof-reading </li></ul></ul><ul><li>group: </li></ul><ul><ul><li>Reviews (informal & formal): for consensus </li></ul></ul><ul><ul><li>Walkthrough: for education </li></ul></ul><ul><ul><li>Inspection (most formal): to find faults </li></ul></ul>Static techniques do not execute code
    4. 4. Benefits of reviews <ul><li>Development productivity improvement </li></ul><ul><li>Reduced development timescales </li></ul><ul><li>Reduced testing time and cost </li></ul><ul><li>Lifetime cost reductions </li></ul><ul><li>Reduced fault levels </li></ul><ul><li>Improved customer relations </li></ul><ul><li>etc. </li></ul>
    5. 5. Reviews are cost-effective <ul><li>10 times reduction in faults reaching test, testing cost reduced by 50% to 80% </li></ul><ul><ul><li>Freedman & Weinberg, Handbook of Walkthroughs, Inspections & Technical Reviews </li></ul></ul><ul><li>reduce faults by a factor of 10 </li></ul><ul><ul><li>Yourdon, Structured Walkthroughs </li></ul></ul>
    6. 6. <ul><li>25% reduction in schedules, remove 80% - 95% of faults at each stage, 28 times reduction in maintenance cost, many others </li></ul><ul><ul><li>Gilb & Graham, Software Inspection </li></ul></ul>
    7. 7. What can be Inspected? Anything written down can be Inspected <ul><li>policy, strategy, business plans, marketing or advertising material, contracts </li></ul><ul><li>system requirements, feasibility studies, acceptance test plans </li></ul><ul><li>test plans, test designs, test cases, test results </li></ul>
    8. 8. <ul><li>system designs, logical & physical </li></ul><ul><li>software code </li></ul><ul><li>user manuals, procedures, training material </li></ul>
    9. 9. What can be reviewed? <ul><li>anything which could be Inspected </li></ul><ul><ul><li>i.e. anything written down </li></ul></ul><ul><li>plans, visions, “big picture”, strategic directions, ideas </li></ul><ul><li>project progress </li></ul><ul><ul><li>work completed to schedule, etc. </li></ul></ul><ul><li>“Should we develop this” marketing options </li></ul>
    10. 10. What to review / Inspect? Tests Tests Tests Tests Requirements Design Code Functions Integration T Unit Test Accept. Test System Test
    11. 11. Costs of reviews <ul><li>Rough guide: 5%-15% of development effort </li></ul><ul><ul><li>half day a week is 10% </li></ul></ul><ul><li>Effort required for reviews </li></ul><ul><ul><li>planning (by leader / moderator) </li></ul></ul><ul><ul><li>preparation / self-study checking </li></ul></ul><ul><ul><li>meeting </li></ul></ul><ul><ul><li>fixing / editing / follow-up </li></ul></ul><ul><ul><li>recording & analysis of statistics / metrics </li></ul></ul><ul><ul><li>process improvement (should!) </li></ul></ul>
    12. 12. Contents Reviews and the test process Types of review Static analysis ISEB Foundation Certificate Course Static testing 1 2 4 5 3 6
    13. 13. Types of review of documents <ul><li>Informal Review undocumented </li></ul><ul><ul><ul><li>widely viewed as useful and cheap (but no one can prove it!) A helpful first step for chaotic organisations. </li></ul></ul></ul><ul><li>Technical Review: (or peer review) </li></ul><ul><ul><ul><li>includes peer and technical experts, no management participation. Normally documented, fault-finding. Can be rather subjective. </li></ul></ul></ul>
    14. 14. <ul><li>Decision-making Review: </li></ul><ul><ul><ul><li>group discusses document and makes a decision about the content, e.g. how something should be done, go or no-go decision, or technical comments </li></ul></ul></ul>
    15. 15. Types of review of documents <ul><li>Walkthrough </li></ul><ul><ul><ul><li>author guides the group through a document and his or her thought processes, so all understand the same thing, consensus on changes to make </li></ul></ul></ul><ul><li>Inspection: </li></ul><ul><ul><ul><li>formal individual and group checking, using sources and standards, according to generic and specific rules and checklists, using entry and exit criteria, Leader must be trained & certified, metrics required </li></ul></ul></ul>
    16. 16. Reviews in general 1 <ul><li>Objectives / goals </li></ul><ul><ul><li>validation & verification against specifications & standards </li></ul></ul><ul><ul><li>achieve consensus (excluding Inspection) </li></ul></ul><ul><ul><li>process improvement (ideal, included in Inspection) </li></ul></ul>
    17. 17. Reviews in general 2 <ul><li>Activities </li></ul><ul><ul><li>planning </li></ul></ul><ul><ul><li>overview / kickoff meeting (Inspection) </li></ul></ul><ul><ul><li>preparation / individual checking </li></ul></ul><ul><ul><li>review meeting (not always) </li></ul></ul><ul><ul><li>follow-up (for some types) </li></ul></ul><ul><ul><li>metrics recording & analysis (Inspections and sometimes reviews) </li></ul></ul>
    18. 18. Reviews in general 3 <ul><li>Roles and responsibilities </li></ul><ul><ul><li>Leader / moderator - plans the review / Inspection, chooses participants, helps & encourages, conducts the meeting, performs follow-up, manages metrics </li></ul></ul><ul><ul><li>Author of the document being reviewed / Inspected </li></ul></ul>
    19. 19. <ul><ul><li>Reviewers / Inspectors - specialised fault-finding roles for Inspection </li></ul></ul><ul><ul><li>Managers - excluded from some types of review, need to plan project time for review / Inspection </li></ul></ul><ul><ul><li>Others: e.g. Inspection/ review Co-ordinator </li></ul></ul>
    20. 20. Reviews in general 4 <ul><li>Deliverables </li></ul><ul><ul><li>Changes (edits) in review product </li></ul></ul><ul><ul><li>Change requests for source documents (predecessor documents to product being reviewed / Inspected) </li></ul></ul><ul><ul><li>Process improvement suggestions </li></ul></ul><ul><ul><ul><li>to the review / Inspection process </li></ul></ul></ul><ul><ul><ul><li>to the development process which produced the product just reviewed / Inspected </li></ul></ul></ul><ul><ul><li>Metrics (Inspection and some types of review) </li></ul></ul>
    21. 21. Reviews in general 5 <ul><li>Pitfalls (they don’t always work!) </li></ul><ul><ul><li>lack of training in the technique (especially Inspection, the most formal) </li></ul></ul><ul><ul><li>lack of or quality of documentation - what is being reviewed / Inspected </li></ul></ul>
    22. 22. <ul><ul><li>Lack of management support - “lip service” - want them done, but don’t allow time for them to happen in project schedules </li></ul></ul><ul><ul><li>Failure to improve processes (gets disheartening just getting better at finding the same thing over again) </li></ul></ul>
    23. 23. Inspection is different <ul><li>the document to be reviewed is given out in advance </li></ul><ul><li>typically dozens of pages to review </li></ul><ul><li>instructions are &quot;please review this&quot; </li></ul><ul><li>not just product, sources </li></ul><ul><li>chunk or sample </li></ul><ul><li>training, roles </li></ul>
    24. 24. Inspection is different <ul><li>some people have time to look through it and make comments before the meeting (which is difficult to arrange) </li></ul><ul><li>the meeting often lasts for hours </li></ul><ul><li>entry criteria to meeting, may not be worth holding </li></ul><ul><li>2 max., often much shorter </li></ul>
    25. 25. Inspection is different <ul><li>&quot;I don't like this&quot; </li></ul><ul><li>much discussion, some about technical approaches, some about trivia </li></ul><ul><li>don't really know if it was worthwhile, but we keep doing it </li></ul><ul><li>Rule violations, objective, not subjective </li></ul><ul><li>no discussion, highly focused, anti-trivia </li></ul><ul><li>only do it if value is proven (continually) </li></ul>
    26. 26. Inspection is more and better <ul><li>entry criteria </li></ul><ul><li>training </li></ul><ul><li>optimum checking rate </li></ul><ul><li>prioritising the words </li></ul><ul><li>standards </li></ul><ul><li>process improvement </li></ul><ul><li>exit criteria </li></ul><ul><li>quantified estimates of remaining major faults per page </li></ul>typical review early Inspection mature Inspection effectiveness return on investment 10 - 20% unknown 30 - 40% 6 - 8 hrs / Insp hr 80 - 95% 8 - 30 hrs / Insp hr
    27. 27. The Inspection Process Software Development Stage . . Planning Kick off Ind Chk Meet Edit Change Request Process Improvement Entry Next Software Development Stage Exit
    28. 28. At first glance .. Here’s a document: review this (or Inspect it)
    29. 29. Reviews: time and size determine rate Time Checking Rate Size 2 hrs? 100 pages? 50 pages per hour Checking Rate
    30. 30. Review “Thoroughness”? ordinary “review” - finds some faults, one major, fix them, consider the document now corrected and OK major minor minor
    31. 31. Inspection: time and rate determine size Time Checking Rate Size 2 hrs? Optimum: 1 page * per hour 2 pages (at optimum rate) Size * 1 page = 300 important words
    32. 32. Inspection Thoroughness Inspection can find deep-seated faults: <ul><li>all of that type can be corrected </li></ul><ul><li>but needs optimum checking rate </li></ul>
    33. 33. Inspection surprises <ul><li>Fundamental importance of Rules </li></ul><ul><ul><li>democratically agreed as applying </li></ul></ul><ul><ul><li>define major issues / faults </li></ul></ul><ul><li>Slow checking rates </li></ul><ul><li>Strict entry & exit criteria </li></ul><ul><li>Fast logging rates </li></ul><ul><li>Amount of responsibility given to author </li></ul>
    34. 34. Contents <ul><li>Reviews and the test process </li></ul><ul><li>Types of review </li></ul><ul><li>Static analysis </li></ul>
    35. 35. What can static analysis do? Remember: static techniques do not execute the code <ul><li>A form of automated testing </li></ul><ul><ul><li>check for violations of standards </li></ul></ul><ul><ul><li>check for things which may be a fault </li></ul></ul>
    36. 36. <ul><li>Descended from compiler technology </li></ul><ul><ul><li>a compiler statically analyses code, and “knows” a lot about it, e.g. variable usage; finds syntax faults </li></ul></ul><ul><ul><li>static analysis tools extend this knowledge </li></ul></ul><ul><ul><li>can find unreachable code, undeclared variables, parameter type mis-matches, uncalled functions & procedures, array bound violations, etc. </li></ul></ul>
    37. 37. Data flow analysis <ul><li>This is the study of program variables </li></ul><ul><ul><li>variable defined* where a value is stored into it </li></ul></ul><ul><ul><li>variable used where the stored value is accessed </li></ul></ul><ul><ul><li>variable is undefined before it is defined or when it goes out of scope </li></ul></ul>*defined should not be confused with declared x = y + z IF a > b THEN read(S) x is defined, y and z are used a and b are used, S is defined
    38. 38. Data flow analysis faults n := 0 read (x) n := 1 while x > y do begin read (y) write( n*y) x := x - n end Data flow anomaly: n is re-defined without being used Data flow fault: y is used before it has been defined (first time around the loop)
    39. 39. Control flow analysis <ul><li>Highlights: </li></ul><ul><ul><li>nodes not accessible from start node </li></ul></ul><ul><ul><li>infinite loops </li></ul></ul><ul><ul><li>multiple entry to loops </li></ul></ul><ul><ul><li>whether code is well structured, i.e. reducible </li></ul></ul><ul><ul><li>whether code conforms to a flowchart grammar </li></ul></ul><ul><ul><li>any jumps to undefined labels </li></ul></ul><ul><ul><li>any labels not jumped to </li></ul></ul><ul><ul><li>cyclomatic complexity and other metrics </li></ul></ul>
    40. 40. Unreachable code example <ul><li>Macro definitions (different for different platforms the code runs on) </li></ul><ul><li>Buffsize: 1000 </li></ul><ul><li>Mailboxmax: 1000 </li></ul><ul><li>IF Buffsize < Mailboxmax THEN </li></ul><ul><li>Error-Exit ENDIF </li></ul>
    41. 41. <ul><li>Static Analysis finds the THEN clause unreachable, so will flag a fault </li></ul>
    42. 42. Cyclomatic complexity <ul><li>cyclomatic complexity is a measure of the complexity of a flow graph </li></ul><ul><ul><li>(and therefore the code that the flow graph represents) </li></ul></ul><ul><li>the more complex the flow graph, the greater the measure </li></ul><ul><li>it can most easily be calculated as: </li></ul><ul><ul><li>complexity = number of decisions + 1 </li></ul></ul>
    43. 43. Which flow graph is most complex? 1 2 3 5 What is the cyclomatic complexity?
    44. 44. Example control flow graph Result = 0 Right = 0 DO WHILE more Questions IF Answer = Correct THEN Right = Right + 1 ENDIF END DO Result = (Right / Questions) IF Result > 60% THEN Print &quot;pass&quot; ELSE Print &quot;fail” ENDIF do if r=r+1 end init if res pass fail end Pseudo-code:
    45. 45. Other static metrics <ul><li>lines of code (LOC) </li></ul><ul><li>operands & operators (Halstead’s metrics) </li></ul><ul><li>fan-in & fan-out </li></ul><ul><li>nesting levels </li></ul><ul><li>function calls </li></ul><ul><li>OO metrics: inheritance tree depth, number of methods, coupling & cohesion </li></ul>
    46. 46. Limitations and advantages <ul><li>Limitations: </li></ul><ul><ul><li>cannot distinguish &quot;fail-safe&quot; code from programming faults or anomalies (often creates overload of spurious error messages) </li></ul></ul><ul><ul><li>does not execute the code, so not related to operating conditions </li></ul></ul><ul><li>Advantages: </li></ul><ul><ul><li>can find faults difficult to &quot;see&quot; </li></ul></ul><ul><ul><li>gives objective quality assessment of code </li></ul></ul>
    47. 47. Summary: Key Points <ul><li>Reviews help to find faults in development and test documentation, and should be applied early </li></ul><ul><li>Types of review: informal, walkthrough, technical / peer review, Inspection </li></ul><ul><li>Static analysis can find faults and give information about code without executing it </li></ul>
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×