1 / 23

Overview of Software Testing

Overview of Software Testing. WISTPC 2013. Peter Clarke. 07/12/2013. Outline of Presentation. Testing Terminology Testing Approaches Levels of Testing Unit Testing. What is software testing?.

ehren
Télécharger la présentation

Overview of Software Testing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Overview of Software Testing WISTPC 2013 Peter Clarke 07/12/2013

  2. Outline of Presentation • Testing Terminology • Testing Approaches • Levels of Testing • Unit Testing

  3. What is software testing? • Software testing is the process of operating software under specified conditions, observing or recording the results and making an evaluation of some aspect of the software. (IEEE/ANSI std 610.12-1990)

  4. CEN 4010 Class 17 - 7/11 Overview of Testing - Terminology • Software testing is the dynamic verification of the behavior of a program on a finite set of test cases, suitably selected from the usually infinite execution domain, against the expected behavior. (Guide to the Software Engineering Body of Knowledge 2004 Version)

  5. Testing Terminology The following defns are taken from Binder 2000 and McGregor & Sykes 2001. • Failure – is the manifested inability of a system or component to perform a required function within specified limits e.g. abnormal termination, or unmet time and space constraints of the software. • Fault- incorrect step, process, or data definition in the software. • Error- a human action that produces a fault.

  6. Introduction to Testing Theory .F(d) d. F(t) t T F R D

  7. Testing Concepts Test case components: • Name – identifies the test case, it is a good idea to derive the name from the requirement being tested. • Purpose – states the purpose of the test and relates it to the requirement (or scenario). • Test set up – describe the h/w and s/w and environment required for a successful test. • Input – description of the input data or commands. • Expected output(or Oracle) – expected test results against which the output of the test is compared.

  8. Testing Concepts cont • Test cases are classified depending on which aspect of the system model is tested: • Blackbox(specification-based or functional)tests focus on the input/output behavior (or functionality) of the component. Tests do not deal with the internal aspects of the component nor with the behavior or the structure of the components. • Whitebox(structural or implementation-based) tests focus on the internal structure of the component. That is, test cases are constructed based on the code that implements the software.

  9. Testing Concepts cont • Combination of blackbox and whitebox testing is referred to as graybox testing. • Regression testing includes the re-execution of prior tests after a change, this ensures that the functionality that worked before the change has not been affected.

  10. Testing Concepts cont Test criteria - The criteria that a system or component must meet in order to pass a given test. [IEEE 610] There are two types of testing criteria: • Test data selection criterion – represents a rule used to determine which test cases to select. • Test data adequacy criterion – a rule used determine whether or not sufficient testing has been performed.

  11. Levels of Testing • Unit Testing - refers to tests that verify the functionality of a specific section of code, usually at the function level. In an object-oriented environment, this is usually at the class level, and the minimal unit tests include the constructors and destructors. (wikipedia, 2010) • Integration Testing - is any type of software testing that seeks to verify the interfaces between components against a software design. Components may be integrated in an iterative way or all together ("big bang"). (wikipedia, 2010)

  12. Levels of Testing • System Testing - testing a completely integrated system to verify that it meets its requirements. (wikipedia, 2010) See http://en.wikipedia.org/wiki/Software_testing

  13. Unit Testing • Focuses on the building blocks of the software system i.e., objects and subsystems. • Many unit testing techniques have been devised including: equivalence testing, state-based testing, boundary testing, domain testing, control flow-based testing (statement, branch).

  14. Unit Testing – Equivalence Partitioning • Equivalence partitioning is a blackbox testing technique that minimizes the number of test cases. • Possible inputs are partitioned into equivalence testing classes, and a test case is selected from each class. • Assumption - system behaves in a similar way for all members of an equiv. class. • Criteria used to determine equivalence classes: coverage, disjointedness, representation.

  15. Example: Valid inputs to test the getNumberDaysInMonth() method Unit Testing – Equivalence Partitioning

  16. Unit Testing – Boundary Analysis • Test cases are generated using the extremes of the input domain, e.g. maximum, minimum, just inside/outside boundaries, typical values, and error values. • It is similar to Equivalence Partitioning but focuses on "corner cases“. Exercise: write test case input using boundary analysis for the getNumberDaysInMonth() method.

  17. Control Flow Adequacy Criteria Flow Graph (FG) [Binder 00] • A segment is represented by a node in the FG (a sphere). A segment is one or more contiguous statements with no conditionally executed statements. • A conditional transfer of control is a branch. A branch is represented by an outgoing edge in the FG. • The entry point of a method is represented by the entry node, which is a node no incoming edges. The exit point of a method is represented by the exit node, which has no outbound edges.

  18. Control Flow Adequacy Criteria cont Flow graph Entry A Example: Source code public int Fun(int x){ k = 0; while (x <= 10 && k < 3){ if (x%2 != 0) k = k + 1; x = x + 1; } if (x < 0){ x = 10; k = 0; } return k; } B K=0 F x<=10 && k<3 C G T F X<0 F x%2 != 0 D T T X = 10 K = 0 k=k+1 E H x=x+1 F return k I

  19. Unit Testing – Statement Coverage • Statement coverage – A set P of execution paths satisfies the statement coverage criterioniff for all nodes n in the FG, there is at least one path p in Ps.t. n is on the path p. Whitebox testing technique. • Generate test data to execute every stmt in the program at least once. Exercise: Indentify value(s) of x to execute every stmt in Fun(int x) at least once.

  20. Unit Testing – Branch Coverage • Branch coverage – A set P of execution paths satisfies the branch coverage criterioniff for all edges e in the FG, there is at least one path p in Ps.t. p contains edge e. Whitebox testing technique. • Generate test data to exercise the true and false outcomes of every decision. Exercise: Indentify value(s) of x to execute every branch in Fun(int x) at least once.

  21. Homework Draw a flow graph Identify pairs of values for for x and y that gives: (a) 100% statement coverage (b) 100% branch coverage Source code • public int Fun1(int x, int y){ • k = 0; • while (x <= 10 && k < 10){ • if (x%2 != 0){ • k = k + y; • k = k – 2; • } • x = x + 1; • k = x + k; • } • if (x < 0){ • x = y; • k = k + x; • } • return k; • }

  22. Summary • Testing terminology – software testing, test case, test driver, stub, fault, failure, error • Testing Approaches – blackbox, whitebox, and graybox testing • Levels of Testing – unit, integration, system

  23. Summary cont • Unit Testing • Blackbox: equivalence partitioning and boundary analysis. • Whitebox: statement coverage, branch coverage. • Practice exercises were given for each testing technique.

More Related