COMP 2710 Software Construction Project 1 – Implementation: Test Drivers Dr. Xiao Qin Auburn University

Slides:



Advertisements
Similar presentations
Starting Out with C++, 3 rd Edition 1 Chapter 10 – Characters, Strings, and the string Class.
Advertisements

1 COMP 4300 Computer Architecture Datapath Dr. Xiao Qin Auburn University Fall, 2010.
……+(4n-3) = n(2n-1) P 1 = 1(2(1)-1)=1 check.
C++ Basics March 10th. A C++ program //if necessary include headers //#include void main() { //variable declaration //read values input from user //computation.
Battle For Throne by Pattarapong Rojanasthien Present to Dr. Kepuska Software/Hardware Integration ECE 2552.
Overview Reference parameters Documenting functions A game of craps. Design, code, test and document.
Local and Global Variables. COMP104 Local and Global / Slide 2 Scope The scope of a declaration is the block of code where the identifier is valid for.
1 Dr. Xiao Qin Auburn University Spring, 2011 COMP 7370 Advanced Computer and Network Security The VectorCover.
1 Dr. Xiao Qin Auburn University Spring, 2011 COMP 7370 Advanced Computer and Network Security Generalizing.
More on Functions Programming. COMP104 Lecture 19 / Slide 2 Passing Parameters by Reference l To have a function with multiple outputs, we have to use.
1 Dr. Xiao Qin Auburn University Spring, 2011 COMP 7370 Advanced Computer and Network Security The MinGen.
1 Dr. Xiao Qin Auburn University Spring, 2011 COMP 7370 Advanced Computer and Network Security Generalizing.
1 Session-23 CSIT 121 Spring 2006 Revision Ch 7: Reference Parameters Revision Ch 7: Reference Parameters Chapter 8: Value Returning Functions Chapter.
1 Dr. Xiao Qin Auburn University Spring, 2011 COMP 7370 Advanced Computer and Network Security The VectorCover.
1 Dr. Xiao Qin Auburn University Spring, 2011 COMP 7370 Advanced Computer and Network Security Homework.
CS 325: Software Engineering March 31, 2015 Software Testing Black-Box Testing White-Box Testing Regression Testing.
Lecture 14 Arguments, Classes and Files. Arguments.
COMP 3000 Object-Oriented Programming for Engineers and Scientists Operator Overloading Dr. Xiao Qin Auburn University
COMP7330/7336 Advanced Parallel and Distributed Computing OpenMP: Programming Model Dr. Xiao Qin Auburn University
COMP 2710 Software Construction C++ Basics 2 and Exercises Dr. Xiao Qin Auburn University These slides.
COMP 2710 Software Construction Flow of Control – switch and loops Programming Exercises Dr. Xiao Qin Auburn University
Looping I (while statement). CSCE 1062 Outline  Looping/repetition construct  while statement (section 5.1)
COMP 3500 Introduction to Operating Systems Memory Management: Part 2 Dr. Xiao Qin Auburn University Slides.
COMP 2710 Software Construction Project 2 – Analysis of auDiskTool
Auburn University COMP 3500 Introduction to Operating Systems Resource Allocation Graphs Handling Deadlocks Dr. Xiao.
Auburn University
The Law of Supply What is Supply?.
COMP 2710 Software Construction Project 2 – Analysis of auDiskTool
COMP 2710 Software Construction Class Diagrams
Othello Artificial Intelligence With Machine Learning
--- Price List --- A - Marshmallow: £0.20 B - Bubble gum: £0.30
Auburn University COMP 3000 Object-Oriented Programming for Engineers and Scientists Strings (part 2) Dr. Xiao Qin Auburn.
Auburn University COMP 2710 Software Construction xCode Development Environment for C++ Programming in Mac OS Dr. Xiao.
What’s New? Six homework programming assignments. New: five
Auburn University COMP 3000 Object-Oriented Programming for Engineers and Scientists Constructors and Other Tools Dr.
COMP 2710 Software Construction Homework 2 – Design and Algorithm
Software Project Management
COMP 2710 Software Construction Sequence Diagrams (cont.)
Auburn University COMP 3000 Object-Oriented Programming for Engineers and Scientists Function Basics TBC=15 Dr. Xiao Qin.
Auburn University COMP 3000 Object-Oriented Programming for Engineers and Scientists File I/O Dr. Xiao Qin Auburn University.
Exercise 1 From Lec80b-Ponter.ppt.
Auburn University COMP7330/7336 Advanced Parallel and Distributed Computing Data Partition Dr. Xiao Qin Auburn University.
Auburn University COMP 3500 Introduction to Operating Systems Project 3 – Synchronization Condition Variables Dr. Xiao.
Chapter 1. Introduction to Computers and Programming
Auburn University COMP 3000 Object-Oriented Programming for Engineers and Scientists Structures Cont. Dr. Xiao Qin Auburn.
How does it do that? Introducing Computer Software
COMP 2710 Software Construction Pointers
Auburn University COMP 2710 Software Construction Use Case Analysis and Exercises (Part 2) Dr. Xiao Qin Auburn University.
COMP 2710 Software Construction File I/O
Lab Session-9 CSIT-121 Spring 2005
COMP 2710 Software Construction Introduction to GDB
Othello Artificial Intelligence With Machine Learning
Auburn University COMP 7370 Advanced Computer and Network Security The VectorCover Algorithm (2) Dr. Xiao Qin Auburn.
Chapter 5 Function Basics
Game Summary (Please explain your game in your own words):
ECE243 Polling Lab.
Lesson Objectives Aims You should be able to:
ПРОГРАМСКИ ДЕЛ НА КОМПЈУТЕРОТ
Creating Functions with Parameters
Data Visualization Jordan Waters.
Energy-Efficient Storage Systems
Exercise Solution First questions What's output What's input
Game review By ?.
Lesson 8: Creating Functions with Parameters
Functions Solving Equations Simplifying & Solving Variables on Both
Adding Real Numbers pages 27–30 Exercises (–3); –42
U3L8 Creating Functions with Parameters
Tic-Tac-Toe Game Engine
COMP 7370 Advanced Computer and Network Security Comments on Project 1
Othello Artificial Intelligence With Machine Learning
Presentation transcript:

COMP 2710 Software Construction Project 1 – Implementation: Test Drivers Dr. Xiao Qin Auburn University

Pitfalls No purpose. Only offer testing ideas. No expected input and output. Expected inputs are not specific. Expected outputs are not specific. 1-2

How not to design test drivers // test drivers below void test_menu(void) { } void test_hall(void) { } void test_setEncouter(void) { } void test_create_puzzle(void) { } 1-3 There is no design. These are the names of your test drivers.

How not to design test drivers //creates character with set amount of time, //intel, and money //checks that searchChange increases money and //decreses time void searchChangeTest(); 1-4 You’re the design of your test case must be specific.

Be specific: An Example 1-5

Can you test an abnormal usage? 1-6 void searchChangeTest() { Player player; cout << "Testing function searchChange()… "; player.intel = 10; player.time = 0; player.money = 10; searchChange(player); player.intel = 10; player.time = 10; player.money = 0; searchChange(player);... }

Exercise 1: Write a test driver for moveForward() u_short moveForward(Player&); /* * This function moves a player forward one step, * but risks an Encounter or a Puzzle. Moving * also takes 5 time units. * Input: A Player variable containing all of a * player's current game stats. * Output: 0 success * 1 can not move further * 2 negative money * 3 negative intel * 4 negative time */ 1-7

A test driver: moveForwardTest() void moveForwardTest(void) { Player testPlayer; /* Case 1: Enough money, intel, and time */ u_short errorStats; cout << “Test moveForwardTest() case 1:\n”; testPlayer.steps = 50; testPlayer.time = 1000; testPlayer.intel = 1000; testPlayer.money = 1000; error_stats = moveForward(testPlayer); assert(errorStats == 0); assert(testPlayer.steps == 51); assert(testPlayer.time == 995); } 1-8

A test driver: moveForwardTest() (cont.) /* Abnormal cases */ /* Case 2: Player can not move further */ cout << “Test moveForwardTest() case 2:\n”; testPlayer.steps = HALL_LEN; errorStats = moveForward(testPlayer); assert(errorStats == 1); /* Case 3: Player has negative time */ cout << “Test moveForwardTest() case 3:\n”; Player testPlayer.time = -10; errorStats = moveForward(testPlayer); assert(errorStats == 4); } 1-9

Exercise 2: Write a test driver for professor() u_short professor(Player&); /* * Encounter a professor. Player loses a random * extra amount of time, but may slightly increase * intelligence. * Input: A Player variable containing all of a * player's current game stats. * Output: 0 success * 2 negative money * 3 negative intel * 4 negative time */ 1-10