|
From: Nick C. <sr...@ea...> - 2001-09-05 20:11:42
|
Hi, I've begun consolidating the various junit unit tests that I've created. I've made a new directory uchicago/src/sim/test and placed the various tests in there. These all use the junit testing framework created by those giants among men Erich Gamma and Kent Beck (see www.junit.org). The README attempts to summarize what each test does and what it requires in the way of external libraries. To run the tests you'll need to get a hold of junit from the above url. Once it is installed, make sure you start it with a classpath that includes wherever you've compiled the tests and whatever external library those tests need. For example, java -cp /home/nick/classes:/usr/local/junit/junit.jar:/home/nick/repast/lib/colt.jar junit.swingui.TestRunner You'll get a nice gui where you can load the class file that contains your test (e.g. uchicago.src.sim.test.NetworkTest). Writing these sorts of unit tests serves two purposes (or at least it works that way for me). The first is, of course, to exercise some API to find bugs and I invariably do. The second is to test the semantics of the API itself by actually using it. In fact, developing the tests in conjuction with developing the API helps with the conceptual/semantic part of framework development. So, the point of all this is that if you change the framework in some way, see if there is a relevant test that you can add to and run. If not, try and create some tests to exercise your changes. Of course writing tests is a bit tedious, but junit makes a lot more "fun". There's only a few tests in the the test directory at the moment, but there's some offhand, one-off tests scattered througout the repast source tree and even more in my own non-public test directory. In the next few days, I'll try and consolidate these and make unit tests out of them where applicable. Nick -- Nick Collier Social Science Research Computing University of Chicago http://repast.sourceforge.net |