Slide 1

Slide 1 text

CSE360 Introduction to Software Engineering Lecture 28: SoftwareTesting Javier Gonzalez-Sanchez [email protected] javiergs.engineering.asu.edu Office Hours: By appointment

Slide 2

Slide 2 text

COCOMO Examples

Slide 3

Slide 3 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 3 Case 1

Slide 4

Slide 4 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 4 Case 2

Slide 5

Slide 5 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 5 Case 3

Slide 6

Slide 6 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 6 Case 4

Slide 7

Slide 7 text

Software Testing Unit Testing

Slide 8

Slide 8 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 8 Next Step Process Requirements Planning Modeling Coding Deployment Testing

Slide 9

Slide 9 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 9 Definition • Validation. It is about requirements. Are we building the right product? Does this software do what it needs to do? • Verification. It is about design. Are we building the product right? Does this meets it requirements? • Testing. Examination of the behavior of a program by executing it on sample data sets.

Slide 10

Slide 10 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 10 Verify, Validate, and Test

Slide 11

Slide 11 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 11 Testing Testing White Box (Verification) Unit Testing Integration Testing Black Box (Validation) System Testing Scenario-based testing Model-based testing

Slide 12

Slide 12 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 12 Unit Testing • Unit testing is the testing of an individual unit or group of related units. • It test that a unit is producing expected output against given input. • Each Unit developer must define Unit Test Cases for that Unit. • Unit Testing Frameworks are tools and libraries that help to implement the Unit Testing process. Example JUnit

Slide 13

Slide 13 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 13 Limitations and Constraints • Missing or Bad requirements • Exhaustive testing is not possible • Sampling • Limited time and money

Slide 14

Slide 14 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 14 Example

Slide 15

Slide 15 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 15 Example

Slide 16

Slide 16 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 16 Example

Slide 17

Slide 17 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 17 Coverage • Statement Coverage: every statement is executed at least 1 time. • Decision Coverage: every decision point is executed at least 1 time • Decision-Condition Coverage: every decision tested with all possible outcomes

Slide 18

Slide 18 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 18 Statement Coverage 1. if (a <10 || b>5) 2. x = 50 3. else 4. x = 0; 5. if (w == 5 || y>0) 6. z = 48; 7. else 8. z = 5; Total Statements? Statement Coverage with a = 0, b=0, w=0, y=0 ? Statement Coverage with a=10, b=4, w=5, y = anything ? Coverage is cumulative

Slide 19

Slide 19 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 19 Decision Coverage 1. x = 0; 2. if (x<10) 3. doSomething(); 4. x =5; Total Statements? Statement coverage ? Decision Coverage ?

Slide 20

Slide 20 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 20 Decision-Condition Coverage 1. if (x<1 || y>5 a&& z!=0 || flag== T && s==NIL) 2. doThis(); 3. else 4. doThat(); Total Statements? Test cases needed for 100% statement coverage? Test cases needed for Test for 100% decision coverage? Test cases needed for Test for 100% decision-condition coverage?

Slide 21

Slide 21 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 21 Test Yourselves 1. start =1; 2. end = num; 3. found = false; 4. while (starts <= end and not found ) { 5. middle =(start - end)/2; 6. if (key > table[middle]) { 7. start = middle +1 8. } else if (key = table[middle]) { 9. found = T 10. LOC = middle; 11. } else 12. end = middle -1; 13. } 14. } //TestCase1 table={10, 20, 30, 40, 50, 60, 70}, key=55 //TestCase2 table={10, 20, 30, 40, 50, 60, 70}, key=40

Slide 22

Slide 22 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 22 Test Yourselves

Slide 23

Slide 23 text

Javier Gonzalez-Sanchez | CSE360 | Summer 2018 | 23 Reference Chapter 8

Slide 24

Slide 24 text

CSE360 – Introduction to Software Engineering Javier G onzalez-Sanchez javiergs@ asu.edu Sum m er 2017 Disclaim er. These slides can only be used as study m aterial for the class C SE360 at ASU. They cannot be distributed or used for another purpose.