tailieunhanh - Lecture Formal methods in software engineering - Lecture 24

Lecture Formal methods in software engineering - Lecture 24 presents the following content: Use of formal methods in SE, test cases VS F-M, structure programming, flow graphs, flow graphs, path coverage overhead, model-based solution, mathematical model, propositional calculus, logic puzzle,. | 1 1 Formal Methods in Software Engineering Lecture # 24 1 1 1 2 2 Use of Formal Methods in SE Branch of computer science in which we argue and analyze the computer programs using formal techniques. Programs specification and verification. Constructing programs. Each step written is valid and lead to a correct solution Number of tools and techniques are available. 2 2 2 3 3 Can we properly test the software? Famous saying by Dijesktra -> By testing we can only prove the present of bug not the absence of bug In order to prove mathematical theorem, counter examples are provided All numbers are a[i+1]){ //4 Swap(a[i]>a[i+1]); //5 Sorted = false; } //6 }//7 } //8 1 2 3 4 6 5 7 8 8 8 8 9 9 Flow Graphs Base upon flow graphs we try to write test cases to test the different components of flow graph Limitations of these kind of testing 3 types of test coverage's that we have when using flow graphs Statement coverage: We make sure that every statement must be executed at least once. Branch Coverage: Identify branches and try to test all the branches Path . | 1 1 Formal Methods in Software Engineering Lecture # 24 1 1 1 2 2 Use of Formal Methods in SE Branch of computer science in which we argue and analyze the computer programs using formal techniques. Programs specification and verification. Constructing programs. Each step written is valid and lead to a correct solution Number of tools and techniques are available. 2 2 2 3 3 Can we properly test the software? Famous saying by Dijesktra -> By testing we can only prove the present of bug not the absence of bug In order to prove mathematical theorem, counter examples are provided All numbers are < 1000 You can either provide formal prove or counter example Overhead with test cases: Not possible to write huge number of test cases 3 3 3 4 4 Test Cases VS F-M Test two equal Strings . isEqual (“Cat”, Dog”) – Expected output: False isEqual (“Testing”, Testing”) – Expected output: True isEqual (“House”, Home”) – Expected output: False Many number of possibilities 4 4 4 5 5 Test Cases VS F-M .