Lab 4 Announcements

Unit Tests

I’m sure you’ve all read my recitation lecture on why test driven development has taken off, and particularly how unit testing actually saves you time in the long run. And since you’re read the lecture, you’re all using MinUnit as your unit testing framework.

Here’s another golden rule of unit testing.

Whenever you discover a bug, create a unit test to make sure that bug does not resurface ever again.

So perhaps you’re out of ideas on what to unit test? Out of the goodness of my heart, I’ve given you some.

Dictionary

Queue

URL

Crawler

Add more as you think of them!

Live Testing

So after you’ve done all this unit testing, you decide you’re still not completely certain of your code (as you shouldn’t be, quite frankly!). So what do we do? Well, we need live testing with fake data.

All of you have public_html folders in your linux account. Ever wonder what this is for? It’s to create web pages! My username is chander, so if I create a page ~/public_html/index.html, you can find it at http://www.cs.dartmouth.edu/~chander. Similarly, if I create a web page in the folder ~/public_html/cs50/dude.html, then you’ll find that page at http://www.cs.dartmouth.edu/~chander/cs50/dude.html. Why doesn’t the first index.html appear in the URL? There’s a special rule for files called index.html. Read more about that feature here.

So create some sample set of web pages in your linux account, and crawl your own home directory! Once you have that working, you’re really off to a good start.

Towards the end of the period, I’ll create my own set of pages right here on this web site for you to crawl, and you can verify your results against what it should be to make sure that it works.

Live testing is now up and running. This link has been deprecated, though. For more in-depth testing please visit lab5 announcements.

Good luck!