CSC 216/s08/desire peace

From Expertiza_Wiki
Jump to navigation Jump to search

Formatting Resources

Formatting Help Guide from MetaWiki

Testing Cases (Testing & Debugging)

Testing Cases is an interactive flash video that allows the user or class to choose a briefcase to select an unknown question to answer. This flash video is not solely limited to the subject matter of testing and debugging, but rather could be expanded to incorporate various subject matter. The goal of "Testing Cases" is that upon opening each briefcase, one can test and confirm their knowledge of the material.

http://www.mcbrosmusic.com/CSC/testing_cases.jpg
The link to the game is here: http://www.mcbrosmusic.com/csc_game.swf
The game still has bugs to be worked out... currently having problems with having the text wrap around.

The problem

This exercise is meant to review the material covered following class. It is a colorful and fun way in which to get the students to answer questions. In the interactive flash video created, "testing and debugging" comprises the questions asked.

Participants and props

Everyone that has a computer with Flash is capable of playing. A computer that is capable of playing Flash 8.0 videos.

The script

Each team will choose one case, which will have one question. For each question answered correctly, the team gains a point.


The Questions & Answers

Q: What is the advantage of unit testing?
A: Unit testing allows you to test the class in isolation. This prevents confusion from the interaction between classes in a larger program.

Q: Johnny creates an algorithm that divides two numbers. Johnny is trying to debug his algorithm by using boundary test cases. What boundary value should he use? Why is testing at the boundary important?
A: 0. Testing at the boundary is important because it is where programmers are most likely to make mistakes.

Q: How can you test multiple input values when debugging code?
A: Write a “for” loop that increments through a range of values.

Q: Explain what an oracle is and give an example.
A: An oracle is a method that produces the same value you that you are testing for. For example, since x^1/2 = sqrt(x), you could check a square root algorithm with the Math.pow() method.

Q: What is black box testing?
A: Black box testing tests the functionality of a program without consideration of its internal structure.

Q: If you are performing unit tests of each method, what type of testing strategy are you using?
A: White box. White box testing is a strategy that looks inside the program.

Q: Is it good practice to continually test for a set of past failures, even if they are fixed? What is this called? Why do this?
A: Yes, regression testing ensures that if you fix a bug, it doesn’t show up again in the future.

Q: Use ____ ____ to test classes in isolation.
A: unit tests

Q: When debugging, you run into a call to System.out.println. Should you step into or step over it?
A: Step over it because you are not interested in how the println function works.

Q: The process of testing against a set of past failures is called _______
A: regression testing

Additional comments

Due to limited time constraints, it is not possible to incorporate all the ideas in creating this flash video. One such idea was to create a dynamic component (via PHP) that would allow the students to answer the questions via their laptops off a website (with PHP supported servers). The data (answered correctly or incorrectly) could be dynamically stored and the resulting data could be then displayed to the instructor, which he or she may display to the class.