BLACK-BOX TESTING IN THE INTRODUCTORY
PROGRAMMING CLASS
Tamara Babaian
Computer Information Systems Department
Bentley College
tbabaian@bentley.edu
什么古装剧最好看Wendy Lucas
Computer Information Systems Department
Bentley College
来字ABSTRACT
Introductory programming cours are often a challenge to both the students taking them and the instr
uctors teaching them. The scope and complexity of topics required for learning how to program can distract from the importance of learning how to test. Even the textbooks on introductory programming rarely address the topic of testing. Yet, anyone who will be involved in the system development process should understand the critical need for testing and know how to design test cas that identify bugs and verify the correct functionality of applications. This paper describes a testing exerci that has been integrated into an introductory programming cour as part of an overall effort to focus attention on effective software testing techniques.1 A comparison of the performance on a common programming assignment of students who had participated in the testing exerci to that of students who had not demonstrates the value of following such an approach.
Keywords: testing, debugging, black-box method, introductory programming
1 A shorter version of this paper, entitled Developing Testing Skills in an Introductory Programming Class, was prented at the 2005 International Conference on Informatics Education Rearch.
I. INTRODUCTION
For veral years now, object-oriented languages have predominated within introductory programming cours in the Computer Science and Information Systems curricula. Programming in
general does not come naturally to all students, and object-oriented concepts can be especially daunting. Students struggling to write their first programs quickly succumb to the mantra that it compiles and runs - therefore it is correct. The importance of testing is lost on the novices in their rush to submit functioning code. Integrated Development Environments (IDEs), which are invaluable in many ways, may have the unintended conquence of supporting this attitude; a simple click of a button compiles and runs code with astonishing speed (particularly to tho of us who remember punch cards). It is so easy to recompile that one can fall into the trap of making changes and rerunning the program without analyzing errors and thinking through the code to address them. While syntactical errors are caught and promptly drawn to the programmer’s attention by the IDE, trapping logical errors requires careful design of test cas and thorough analysis of outputs. The necessity for the skills is often lost on the novice. A far greater risk is that the novice will become a developer who never learned the value of thorough testing. Attesting to the validity of this concern is the estimated $59.5 billion that software bugs are costing the U.S. each year [Tasy, 2002]; early detection of the errors could greatly reduce the costs [Baziuk, 1995]. As noted by Shepard et al. [2001], although testing typically takes at least 50% of the resources for software development projects, the level of resources devoted to testing in the software curriculum is very low. This is largely due to a perceived lack of available time within a mester for covering all of the required topi
cs, let alone making room for one that may not be viewed as core to the curriculum. The motivation for the work prented here aris from the need for teaching solid testing skills right from the start. Students must learn that testing should be given
赞美白衣天使at least as much priority as providing the required functionality if they are to become developers of high-quality software.
This paper describes a testing exerci that has been ud successfully within an introductory programming cour taught using the Java language at Bentley College. This cour is part of the curriculum within the Computer Information Systems (CIS) Department, and is required for CIS majors but open to all interested students. The contents of this cour are in keeping with the IS2002 Model Curriculum [Gorgone et al., 2002], which recommends the teaching of object-oriented programming and recognizes the need for testing as a required part of the courwork. While faculty readily acknowledge this need, developing a similar appreciation for testing in our students has proven far more difficult. The testing exerci described here has been found to be an effective step in this process.
The next ction of this paper reviews rearch that is relevant to the work prented here. We then
provide an overview of the cour and a detailed description of the testing exerci. In order to asss the impact of this exerci, we prent an analysis of student performance on a related coding assignment. This paper concludes with a discussion of directions for future work.
II. LITERATURE REVIEW
The low priority given to testing within the software curriculum and the need for that to change has been acknowledged in the literature. Shepard, Lamb, and Kelly [2001], who strongly argue for more focus on testing, note that Verification and Validation (V&V) techniques are hardly taught, even within software engineering curriculum. They propo having veral cours on testing, software quality, and other issues associated with V&V available for undergraduates. Christenn [2003] agrees that testing should not be treated as an isolated topic, but rather should be integrated throughout the curriculum as
“core knowledge.” The goal must be on producing reliable software, and he propos that systematic testing is a good way to achieve this.
Much of the relevant literature describes the u of Extreme Programming (XP) [Beck, 2000] techniques in programming cours for teaching testing. XP advocates a test-first approach in which
unit tests are created prior to writing the code. For students, benefits of this approach include developing a better understanding of the project’s requirements and learning how to test one module or component at a time.
XP plays a key role in the teaching guidelines propod by Christenn [2003], which include: (1) fixing the requirements of software engineering exercis on high quality, (2) making quality measurable by teaching systematic testing and having students follow the test-driven approach of XP, and (3) formulating exercis as a progression, so that each builds on the solution to the prior exerci. The guidelines have been applied by Christenn in an advanced programming class.
Allen, Cartwright, and Reis [2003] describe an approach for teaching production programming bad on the XP methodology. The authors note that, “It is impossible to overstate the importance of comprehensive, rigorous unit testing since it provides the safeguard that allows students to modify the code without breaking it” [Allen et al., 2003, p. 91]. To familiarize students with the test-first programming approach, they are given a simple, standalone practice assignment at the beginning of the cour for which most of their grade is bad on the quality of the unit tests they write. Another warm-up assignment involves writing units tests for a program written by the cour’s instructors. The exercis were found to be effective in teaching students how to write suitable tests for sub
quent assignments.
The approaches to teaching testing described above are very similar to the approach described in this paper. What differentiates our testing exerci and
follow-up coding assignment is that they are intended for beginning programmers, not the more experienced ones who would be found in advanced or production-level programming cours. This prents the challenge of teaching students who are only beginning to grasp the concept of programming about the importance of testing and the complexities associated with developing effective test cas.
宫非宫
Edwards [2004] does address the issues of teaching testing in an introductory CS cour and recommends a shift from trial-and-error testing techniques to reflection in action [Schön, 1983], which is bad on hypothesis-forming and experimental validation. He advocates the Test Driven Development (TDD) method [Edwards, 2003], which requires, from the very first assignment, that students also submit test cas they have compod for verifying the correctness of their code. Their performance is assd on the basis of “how well they have demonstrated the correctness of their program through testing” [Edwards, 2004, p. 27]. Edwards [2004] focus on tools that support
烧花菜students in writing and testing code, including JUnit (www.junit/), DrJava [Allen et al., 2002], and BlueJ [Kölling, 2005], and on an automated testing prototype tool called Web-CAT (Web-bad Center for Automated Testing) for providing feedback to students. Patterson, Kölling, and Ronberg [2003] also describe an approach to teaching unit testing to beginning students that relies on the integration of JUnit into BlueJ. While Snyder [2004] describes an example that introduces testing to beginning programmers, his work is built around the u of an automated system for conditional compilation.宝贝的意思
What differentiates the works from our own is our explicit focus on the testing exerci itlf, rather than on the different types of tools that provide assistance with testing, as a means for supporting the teaching of testing to novices. Our testing assignment requires a thorough analysis by students of the inner workings of a program for which they do not have access to the code. The
assignment’s components must therefore be carefully designed for u by beginning programmers.
III. COURSE BACKGROUND
In this ction we prent an overview of the Programming Fundamentals cour and describe how instruction in software testing is positioned within its curriculum. This is the first programming cour
within the CIS Major at Bentley College, and it is taught using the Java programming language. While it is required for majors, it also attracts non-majors, with students also differing in terms of backgrounds in programming and class levels. To accommodate the majority of students enrolled in this cour and prepare them for subquent class in software development, it is targeted towards tho students who do not have any prior programming experience. The goal of this cour is for students to develop basic programming and problem-solving skills. This is accomplished through lectures, in-class laboratory ssions for writing and testing code, and assignments that are completed outside of the classroom.
Approximately two-thirds of the material covered in this cour focus on basic data types, control structures, and arrays. The remainder of the mester is spent introducing object-oriented programming concepts, including class and objects, and instance versus static variables and methods. All of the concepts are reinforced through frequent programming assignments, with an assignment due every one to two weeks. Students are expected to complete all assignments on their own, without collaborating with others in the class, in accordance with our academic honesty policy. There are no group assignments in this cour, as we feel that, at the introductory level, individual effort is required to absorb abstract programming concepts. Laboratory assistants and inst
凋谢的警花ructors are always on-hand to answer any questions with assignments and help direct student efforts without revealing solutions.四年级解决问题