CSC161 2011S Imperative Problem Solving

Reading: Unit Testing

Reading: Subramanian: Unit Testing 101 for Non-Programmers. Available at http://www.saravanansubramanian.com/Saravanan/Articles_On_Software/Entries/2010/1/19_Unit_Testing_101_For_Non-Programmers.html

Please submit a question by 9 p.m. on Sunday, 6 March 2011.


Can there ever be an instance where unit testing proves that blocks of code work, but when combined they do not?

Yes. There can be a misunderstanding of how they are supposed to interact.

What is the difference between “Class Under Test”, “Object Under Test”, and “Method Under Test”?

What is the difference between CUT, OUT and MUT?

These are mostly object-oriented issues. We will focus mostly on procedures (method). But we combine methods into objects, and so want to make sure that the methods interact well. We then generalize objects into classes, and want to make sure that the generalization also works.

The reading says that conventional testing is testing software after it is developed. I don't believe that anyone waits until software is completely developed before checking how it works. What is the difference between unit testing and just testing as you go along? Is it only that unit testing is more structured and extensive? The reading says that some programmers are skeptical of unit testing. Why?

Evidence suggests that programmers wait a long time before doing serious testing. (Don't you?) Programmers a skeptical that test-first is a good methodology and worth their time.

Is there a convenient way to test functions you wrote without cluttering up main?

Yes. That's why we learned separate compilation.

Are there other standard forms of testing apart from unit testing and testing an entire program?

Yes.

What does it mean by incremental testing?

Test each piece as you add it to the system.

Can you elaborated on what is “Continuous integration”?

A model of program development in which you don't think in terms of big releases, but adding lots of small parts, bit by bit. With unit testing, you retest each time you add a small part.

What level of complexity do the SUTs usually exhibit? Would some of the basic functions we've been writing be considered units, or have we not yet reached the level of complexity where unit testing would be necessary?

As soon as you've written your first function, you're ready to do unit testing.

How is unit testing as described in the article any different from how we currently test things piece by piece?

It's more automated.

What does a unit test look like? I understand the concept of testing each small piece of code, but how is this implemented?

I think I understand the concepts, but how do you actually write tests?

To be done in class.

I actually understand the article!!!! But also, if unit testing is that helpful, when people began programming, why didn't they just all do parts by parts to make sure it works then the final product? or did I overlook something in the article?

Becaus sometimes even when the parts work, the whole doesn't work. And not everyone buys the value of unit testing. Also, good testing is hard (often as hard as writing good algorithms).

I think I understand, but just to make sure: is using print statements to check intermediate values an example of unit testing?

No.

How often are those TLA actually used? I can't say I've ever heard of them.

Rarely.

What are the unit testing softwares for C?

We'll end up writing our own.

The reading was straightforward, but why is it that when I hear about something new, somewhere in the article/newspaper/paper there is a part about people fearing change? Is it still some form of stigma some people have?

Programmers are (a) often convinced that whatever practices they know are the only good practices and (b) religious in their beliefs.

Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Mon Mar 7 10:45:08 2011.
The source to the document was last modified on Mon Mar 7 10:45:06 2011.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CSC161/2011S/Readings/unit-testing.html.

Samuel A. Rebelsky, rebelsky@grinnell.edu