(IJACSA) International Journal of Advanced Computer Science and Applications, Vol. 8, No. 4, 2017 1 | Page www.ijacsa.thesai.org Teaching Software Testing using Data Structures Ingrid A. Buckley Department of Software Engineering Florida Gulf Coast University Fort Myers, FL, USA Winston S. Buckley Department of Mathematical Sciences Bentley University Waltham, MA, USA Abstract—Software testing is typically a rushed and neglected activity that is done at the final stages of software development. In particular, most students tend to test their programs manually and very seldom perform adequate testing. In this paper, two basic data structures are utilized to highlight the importance of writing effective test cases by testing their fundamental properties. The paper also includes performance testing at the unit level, of a classic recursive problem called the Towers of Hanoi. This teaching approach accomplishes two important pedagogical objectives: (1) it allows students to think about how to find hidden bugs and defects in their programs and (2) it encourages them to test more effectively by leveraging data structures that are already familiar to them. Keywords—Software Testing; Data Structures; Abstract Data Type (ADT); Unit Testing; Performance Testing; Stacks; Binary Search Tree; Towers of Hanoi I. INTRODUCTION In general, software testing is a hugely neglected area in the software development life cycle. This is evident in students’ approach to testing. Students often perform very little testing to find bugs or defects in their software projects. Even though these projects are group oriented, consisting of at least two members, testing is rarely ever an automated, planned or systematic activity. Inadequate testing is a major issue in the software development field and bugs and defects account for huge losses and rework when testing is neglected. At the course level, it is important to motivate students to take a responsible approach to software development by integrating proper testing with the aim of finding and correcting bugs and errors. Data Structures [8] is a common course that is offered in most Computer Science, Computer Engineering and Software Engineering degree programs. However, software testing is not always a required course. The idea behind testing may seem simple to most students. However, in general, students only manually test their programs using inputs they know will always produce a correct output, instead of trying to break, find bugs or flaws in the logic of their programs [1,2,3,4,]. This phenomenon is known as confirmation bias [3] in software testing. It may be due to the fact that, finding bugs or defects, means that they will need to spend more time to optimize their programs, and time is something students are typically short of. One of the goals of this paper is to share a relatable teaching approach that will enable students to write automated tests by considering the fundamental properties and constraints of a problem. It introduces a straight forward approach to unit testing by utilizing common data structures that are often used in programming and software development. By using data structures, along with well-known problems that are introduced earlier in the curriculum or in a prerequisite course, students can seamlessly learn the principles and application of software testing without the added burden of learning new unfamiliar content. The rest of the paper is organized as follows. Section 2 presents a fundamental overview of Stacks and Binary Trees. Section 3 explains how to test the fundamental properties and constraints of a stack, and binary search tree. Section 4 presents the Towers of Hanoi which is a classic recursive problem to illustrate performance testing at the unit level. Section 5 concludes, after discussing future work. II. USING DATA STRUCTURES FOR SOFTWARE TESTING As stated earlier, software testing is not always a required course in most degree programs. However, it is a fundamental aspect of software development and is typically introduced briefly in the later stages of most Software Engineering courses. Often times, students become overwhelmed with the software testing tools they need to learn to conduct automated testing. They often struggle with the concept of testing to find bugs rather than just testing to show that their software is operating perfect on a given set of inputs. To address this issue, a wide variety of software testing problems are given to students, and it becomes immediately apparent that they do not quite understand the fundamental properties or dynamics of testing to find bugs. A natural approach is to utilize Abstract Data Types (ADT) to teach them this type of testing [8]. Abstract Data Types [8] are taught in Data Structures, and most students learn about ADTs in the previous semesters to aid and develop their programming skillset and knowledge. It, therefore, makes perfect sense to utilize ADTs in teaching software testing, because doing so provides continuity and allows students to concentrate more on learning and applying testing principles. Stacks are a last-in-first-out (LIFO) data structure. This fundamental property is easy for students to understand and test. In a stack, the element which is placed (inserted or added) last, is accessed (removed) first. Similarly, Binary Search Trees (BST) have a fundamental property which states that all elements in the left sub-tree must be less than the root, and all the nodes in the right sub-tree must be greater than or equal the root node. The Towers of Hanoi is a recursive problem that students are introduced to in Data Structures. This This material is based upon work supported by the National Science Foundation under Grant number DUE-1562773