Software engineering for real-time systems Section 11 Analysing and testing source code
Introduction <ul><li>Objectives </li></ul><ul><li>To: </li></ul><ul><ul><ul><li>Explain the underlying concepts of the tes...
Introduction to software testing Part 1 Overview
Why test software?
Approaches to code testing Preventing errors Detecting errors
Software code test techniques
Software testing steps Test units Integrate units then test functions Integrate functions then test sub-systems Integrate ...
Introduction to static analysis Part 2  Static Analysis
Static analysis techniques
Automated static analysis tools
Evaluating program structure  -  cyclomatic complexity measures McCabe’s cyclomatic complexity metric:  a measure of the a...
Control flow graph  -  simple sequence structure <ul><li>Cyclomatic complexity value v(G):  the number of  independent  pa...
Control flow graph  -  simple selection structure v(G) = 2 Statement Flowchart Statement Statement ?
Control flow graph  -  simple iteration structure { while (DataValue < 10) { cout << &quot;
Input data value&quot;; cin  >...
Example control flow graphs Control flow graph  - highly complex structure Control flow graph  - simplest structure  achie...
Introduction to dynamic analysis Part 3  Dynamic Analysis
Black box and white box testing Two ways of testing code Overall function Internal workings ‘ Black box’ testing Performed...
Basis of dynamic testing
The test harness
Features of general-purpose dynamic testing tools
Coverage analysis and white box testing <ul><li>Coverage analysis </li></ul><ul><li>‘ A measure of the effectiveness and c...
Basis of a practical dynamic testing tool
Dynamic testing and coverage analysis tool
Integration and testing Part 4  Integration  and  test strategies
Combined unit and integration testing Unit A Unit A2 Unit A1 Test code for unit A Test 2 Integrate units A1  and A2 to for...
Reduced integration testing v v Call node (a) Original graph  -  v(G) = 6 Full flow graph of the integrated unit A. Reduct...
Class and object testing Part 5  OO systems  -  Class and object testing
Class and object testing
OO metrics in general use
Use of OO metrics Evaluation of completeness and self-containment Assessment of design complexity Prediction of required t...
Inheritance, polymorphism and testing issues
Multiple clients using multiple servers having polymorphic methods THE question:  How much testing is needed?
Alternative test strategies with multiple clients/servers
Review of ‘Analysing and testing source code’
Upcoming SlideShare
Loading in...5
×

Z_09.ppt

750

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
750
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Z_09.ppt

  1. 1. Software engineering for real-time systems Section 11 Analysing and testing source code
  2. 2. Introduction <ul><li>Objectives </li></ul><ul><li>To: </li></ul><ul><ul><ul><li>Explain the underlying concepts of the testing of source code. </li></ul></ul></ul><ul><ul><ul><li>Describe the basics of static and dynamic analysis. </li></ul></ul></ul><ul><ul><ul><li>Introduce code complexity metrics. </li></ul></ul></ul><ul><ul><ul><li>Describe coverage analysis and its use as part of the dynamic analysis process. </li></ul></ul></ul><ul><ul><ul><li>Illustrate test issues specifically related to object-oriented programming constructs. </li></ul></ul></ul>
  3. 3. Introduction to software testing Part 1 Overview
  4. 4. Why test software?
  5. 5. Approaches to code testing Preventing errors Detecting errors
  6. 6. Software code test techniques
  7. 7. Software testing steps Test units Integrate units then test functions Integrate functions then test sub-systems Integrate sub-systems then test the complete system Software system Software sub-system 1 Software sub-system 2 Major software function 1 Major software function 2 Major software function 3 Code unit 1 Code unit 3 Code unit 2 Code unit 5 Code unit 4 Integration of parts
  8. 8. Introduction to static analysis Part 2 Static Analysis
  9. 9. Static analysis techniques
  10. 10. Automated static analysis tools
  11. 11. Evaluating program structure - cyclomatic complexity measures McCabe’s cyclomatic complexity metric: a measure of the amount of decision logic in a code unit Cyclomatic complexity value: the number of independent paths through a control flow graph Control flow graph Graph complexity measured using Cyclomatic complexity techniques Output from module Source code decision logic Input to module Structure described using a
  12. 12. Control flow graph - simple sequence structure <ul><li>Cyclomatic complexity value v(G): the number of independent paths through a control flow graph. </li></ul><ul><li>Here v(G) = 1 </li></ul>{ Accel [0] = Xnew; Accel [1] = Xold; Accel [2] = Ynew; } Statement 1 Statement 2 Statement 3 Node 1 Node 2 Node 3 Edge (1-2) Edge (2-3) Code of 'module' Corresponding flow graph Statement 1 Statement 2 Statement 3 Flowchart
  13. 13. Control flow graph - simple selection structure v(G) = 2 Statement Flowchart Statement Statement ?
  14. 14. Control flow graph - simple iteration structure { while (DataValue < 10) { cout << &quot; Input data value&quot;; cin >> DataValue' cout << DataValue; } /* end while */ cout << &quot; End of test&quot;; } Construct 1 Construct 2 Construct 3 Construct 4 Code of 'module' Construct 5 Node 1 Edge (1-2) Edge (2-3) Edge (3-4) Edge (4-1) Node 5 Corresponding flow graph Node 3 Node 2 Node 4 Edge (1-5) v(G) = 2 Statement Flowchart Statement ? Statement Statement
  15. 15. Example control flow graphs Control flow graph - highly complex structure Control flow graph - simplest structure achievable
  16. 16. Introduction to dynamic analysis Part 3 Dynamic Analysis
  17. 17. Black box and white box testing Two ways of testing code Overall function Internal workings ‘ Black box’ testing Performed at the interfaces ‘ White box’ testing Performed on the implementation
  18. 18. Basis of dynamic testing
  19. 19. The test harness
  20. 20. Features of general-purpose dynamic testing tools
  21. 21. Coverage analysis and white box testing <ul><li>Coverage analysis </li></ul><ul><li>‘ A measure of the effectiveness and completeness of code testing.’ </li></ul>
  22. 22. Basis of a practical dynamic testing tool
  23. 23. Dynamic testing and coverage analysis tool
  24. 24. Integration and testing Part 4 Integration and test strategies
  25. 25. Combined unit and integration testing Unit A Unit A2 Unit A1 Test code for unit A Test 2 Integrate units A1 and A2 to form A Test code for unit A1 Unit A1 Test 1(a) Test code for unit A2 Unit A2 Test 1(b) Phase 1: test individual units. Phase 2: test the combined unit. This test must exercise all features of A1 and A2.
  26. 26. Reduced integration testing v v Call node (a) Original graph - v(G) = 6 Full flow graph of the integrated unit A. Reduction steps: 1. Identify ALL control structures of units A1 and A2 not concerned with external units (A). 2. Remove these from the flow graph. Reduced flow graph of the integrated unit Call node (a) Reducedl graph - v(G) = 2
  27. 27. Class and object testing Part 5 OO systems - Class and object testing
  28. 28. Class and object testing
  29. 29. OO metrics in general use
  30. 30. Use of OO metrics Evaluation of completeness and self-containment Assessment of design complexity Prediction of required test effort Use of OO metrics (class and object) Estimation of coding errors Ÿ LOC Ÿ AD Ÿ MD Ÿ MHF Ÿ AHF Ÿ LCOM Ÿ DIT Ÿ NOC Ÿ LCOM Ÿ WMC Ÿ WMC Ÿ RFC Ÿ MHF Ÿ CBO
  31. 31. Inheritance, polymorphism and testing issues
  32. 32. Multiple clients using multiple servers having polymorphic methods THE question: How much testing is needed?
  33. 33. Alternative test strategies with multiple clients/servers
  34. 34. Review of ‘Analysing and testing source code’
  1. A particular slide catching your eye?

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

×