Presentation is loading. Please wait.

Presentation is loading. Please wait.

3.3 Static analysis by tools. Contents The objective of static analysisCompare static and dynamic testingBenefits of using static analysis Recall typical.

Similar presentations


Presentation on theme: "3.3 Static analysis by tools. Contents The objective of static analysisCompare static and dynamic testingBenefits of using static analysis Recall typical."— Presentation transcript:

1 3.3 Static analysis by tools

2 Contents The objective of static analysisCompare static and dynamic testingBenefits of using static analysis Recall typical defects that can be found using static analysis Main features of static analysis Some Terms

3  Compiler  Complexity  Control flow  Data flow  Static analysis

4 Some Terms  Compiler: Trình biên dịch, còn gọi là phần mềm biên dịch, compiler, là một chương trình máy tính làm công việc dịch một chuỗi các câu lệnh được viết bằng một ngôn ngữ lập trình (gọi là ngôn ngữ nguồn hay mã nguồn), thành một chương trình tương đương nhưng ở dưới dạng một ngôn ngữ máy tính mới (gọi là ngôn ngữ đích) và thường là ngôn ngữ ở cấp thấp hơn, như ngôn ngữ máy. Chương trình mới được dịch này gọi mã đối tượng.chương trình máy tínhngôn ngữ lập trìnhmã nguồnngôn ngữ máy tínhmã đối tượng

5 Some Terms  Complexity: mức độ mà một thành phần hoặc hệ thống có thiết kế và / hoặc cấu trúc bên trong gây khó hiểu, khó bảo trì hoặc khó kiểm lại.  Control flow: một chuỗi các sự kiện (các đường dẫn) trong quá trình thực thi một thành phần hoặc hệ thống.  Data flow: một sự đại diện trừu tượng cho những thay đổi trạng thái liên tiêp và có thể xảy ra của các đối tượng dữ liệu, nơi mà trạng thái của một đối tượng dữ liệu là bất kì: sự sáng tạo, sự sử dụng, hoặc phá hủy nào.  Static analysis: công việc phân tích các sản phẩm phần mềm, ví dụ các yêu cầu hoặc mã lệnh, được tiến hành mà không cần thực thi những sản phẩm phần mềm này.

6 static analysis ????  Static analysis is an examination of requirements, design and code that differs from more traditional dynamic testing in a number of important ways: Static analysis is performed on requirements, design or code without actually executing the software artifact being examined. Static analysis is ideally performed before the types of formal review discussed in Section 3.2. Static analysis is unrelated to dynamic properties of the requirements, design and code, such as test coverage.

7 The objective of static analysis The objective of static analysis is to find defects in software source code and software models

8 Compare static and dynamic testing Static testing Kiểm tra một thành phần hoặc hệ thống ở mức độ kĩ thuật hoặc thực ( Static analysis, also called static code analysis, is a method of computer program debugging that is done by examining the code without executing the program ) Dynamic testing Thử nghiệm bao gồm thực hiện phần mềm của một thành phần hay một hệ thống. Text

9 Benefits of using static analysis Early detection of defects prior to test execution. Early warning about suspicious aspects of the code or design, by the calculation of metrics, such as a high complexity measure. Identification of defects not easily found by dynamic testing. Detecting dependencies and inconsistencies in software models, such as links. Improved maintainability of code and design. Prevention of defects, if lessons are learned in development.

10 Typical defects discovered by static analysis tools include: TEXT Referencing a variable with an undefined value Inconsistent interface between modules and components Variables that are never used Syntax violations of code and software models Unreachable (dead) code Programming standards violations Security vulnerabilities

11 B C A Coding standards Code metrics Code structure Add Your Text Three main features Main features of static analysis

12 Coding standards The most well known of all features. Usually a coding standard consists of a set of programming rules, naming conventions and layout specifica-tions. The main advantage of this is th at it saves a lot of effort. An extra reason for adopting this approach is that if you take a well-known coding standard there will probably be checking tools available that supp ort this standard. It can even be put the other way around: purchase a static code analyzer and declare (a selection of) the rules in it as your coding standard. Without such tools, the enforcement of a coding standard in an organization is likely to fail. There are three main causes for this: the number of rules in a coding standard is usually so large that nobody can reme mber them all; some context-sensitive rules that demand reviews of several fi les are very hard to check by human beings; and if people spend time checking coding standards in reviews, that will distract them from other defects they mi ght otherwise find, making the review process less effective

13


Download ppt "3.3 Static analysis by tools. Contents The objective of static analysisCompare static and dynamic testingBenefits of using static analysis Recall typical."

Similar presentations


Ads by Google