Share
Embed
CSE360 Flipped Lecture 09
Introduction to Software Engineering
Software Testing
(202010)
Javier Gonzalez-Sanchez PRO
June 09, 2020
Transcript
32 slides
-
CSE 360 Introduction to Software Engineering Lecture 09: Software Testing
Dr. Javier Gonzalez-Sanchez [email protected] javiergs.engineering.asu.edu | javiergs.com PERALTA 230U Office Hours: By appointment -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 2 Announcements
(This Week) • Assignment 04 (Junit Test) • A Sample Exam is available for you to test your access to Lock Down Browser. It has no value, and you can take it as many times as needed. Test your system ASAP -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 3 Announcements
(Next Week) • Second Midterm Exam Next Week. During the lecture time. No lecture that day. Lockdown browser will not allow you to use Zoom • Exercise 06 will open. It is about Cyclomatic Complexity. -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 4 Important
§ Review, Understand, and Follow the Online Proctored Exam Guidelines § During the exam, show your environment. § It is a CLOSED BOOK exam. Do not use any material § Scratch paper is allowed. Show it on camera when you show your environment! -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 5 Email
Etiquette • What course? CSE 360 • What section? Tuesday or Thursday • Is it about a grade? First, contact the TA • Is it about a medical condition? Include documentation • Use your ASU email -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 7 Note
The following is a summary of the most relevant ideas. But the exam is not limited to these, i.e., The following IS NOT a comprehensive list -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 8 It
is Comprehensive 1. Concepts 2. Process Models 3. Requirement Engineering 4. Diagrams (Use Case, Activity, State, 5. Software Design (Class diagram) -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 9 New
topics 1. Diagrams (Sequence Diagram) 2. Version Control and GitHub 3. Abstraction, Encapsulation, Relationships, Polymorphism, Cohesion, Coupling 4. Design Patterns: Observer and Decorator 5. Algorithms: Decision tables and trees -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 10 New
topics 6. Flowchart and Nassi-Schneiderman Diagrams 7. Pseudocode 8. Software Architecture 9. Architectural Patterns 10.Software Testing (Unit Testing) -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 12 Activities
1. Requirements 2. Modeling or Design 3. Construction or Coding 4. Testing 5. Deployment or Delivery -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 13 Software
Testing § Testing is intended to show that a program does what it is intended to do (validation) and to discover program defects (verification) before it is put into use. § When you test software, you execute a program using artificial data. § You check the results of the test run for errors, anomalies or information about the program’s non-functional attributes. § Testing can reveal the presence of errors NOT their absence. § Testing quality is only as good as the test cases you give it. -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 14 Software
Testing developer independent tester Understands the system but, will test "gently" and, is driven by "delivery" Must learn about the system, but, will attempt to break it and, is driven by quality -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 18 Black
Box Testing Knowing the specified function that a product has been designed to perform, tests to demonstrate each function is fully operational while at the same time searching for errors in each function CHAPTER 8 SOFTWARE TESTING 18 -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 19 Black
Box Focus Attempt to find errors in following categories § Incorrect or missing functions § Interface errors § Errors in data structures or external database access § Performance errors § Initialization and termination errors Performed in later stages of testing 19 10/29/20 CHAPTER 8 SOFTWARE TESTING -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 20 White
Box Testing Knowing the internal workings of a product, tests can be conducted to ensure that internal operations are performed according to specifications i.e., the goal is to ensure that all statements and conditions have been executed at least once CHAPTER 8 SOFTWARE TESTING 10/29/20 -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 21 White
Box | Selective Testing loop < 20 X Selected path -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 22 White
Box | Control-flow-based Testing • Step 1: from the source, create a graph describing the flow of control, called the control flow graph (extracted from the source code) manually or automatically) • Step 2: design test cases to cover certain elements of this graph (Nodes, edges, paths) 22 10/29/20 CHAPTER 8 SOFTWARE TESTING -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 23 if
(x+y < 100) s:= s+x+y; else d:= d+x-y; } 1 2 3 4 5 6 7 8 s:=0; d:=0; while (x<y) { x:= x+3; y:= y+2; Control Flow Graph -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 24 Coverage
§ Statement Coverage: every statement in the code is executed at least once. § Decision or Branch Coverage: each one of the possible branch from each decision point is executed at least once and thereby ensuring that all reachable code is executed: (1) True and false branches of each IF; (2) The two branches corresponding to the condition of a loop; (3) All alternatives in a SWITCH statement § Condition Coverage : each boolean expression must be evaluated to true and false at least once. For example: • Path Coverage: every path is executed at least once. -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 26 Decision
or Branch coverage • Decision or Branch coverage has been considered a necessary testing minimum. To achieve it: pick a set of start-to-end paths (in the CFG) that cover all branches, and then write test cases to execute these paths -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 27 Example
1 // test case 1: values a = 5; b = 5; if(a==5){ if(b==5){ System.out.println("Hi”); } } // 100% statement coverage // 50% branch coverage 27 10/29/20 CHAPTER 8 SOFTWARE TESTING -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 28 Example
2 // test case 1: values a = 5; b = 5; if(a==5 || b==5){ System.out.println("Bye"); } else { if(b==5){ System.out.println("Hi"); } } // 50% statement coverage // ??% branch coverage 28 10/29/20 CHAPTER 8 SOFTWARE TESTING -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 29 Example
2 // use another test case // test case 2: values a = 0; b = 0; c = 5; if(a==5 || b==5){ System.out.println("Bye"); } else { if(c==5){ System.out.println("Hi"); } } // 100% statement coverage (with 2 test cases) // ??% branch coverage (with 2 test cases) 29 10/29/20 CHAPTER 8 SOFTWARE TESTING -
Javier Gonzalez-Sanchez | CSE360 | Fall 2020 | 31 Homework
Complete This Week’s Hybrid Activities -
CSE360 – Introduction to Software Engineering Javier Gonzalez-Sanchez [email protected] Summer
2020 Disclaimer. These slides can only be used as study material for the class CSE360 at ASU. They cannot be distributed or used for another purpose.