I wish my purpose were so noble. SpecCheck’s raison d’etre is to make grading easier in large lecture classes. By conditioning student code to better conform to the published specification, we graders are more likely to succeed in running functional tests—which only work if the students name things correctly, have the right parameters, and return the right types. Still, according to my informal surveying, SpecCheck has helped my students better understand the technical narratives they’ve encountered in my classes.
Yes, you may be able to make this work. It is not a satisfactory solution to me for several reasons:
SpecCheck tests aren’t meant to be traditional tests. I didn’t want my students getting flooded with error messages for every one of their deviations all at once. Instead, SpecCheck generates one test method for each specified class. Within each test method there are many assertions, to ensure correct supertypes, correct parameters, correct modifiers, correct return type, and so on. The first failed assertion stops the test and subsequent assertions are not run.
Yes. One instructor found it easiest to create a project for her students with the SpecChecker class already included. The generated JUnit tests inside this class are detected by BlueJ and the class is considered a test fixture. Any other methods in the class, including main, are ignored. If you want a main method orchestrating the test execution, put it in a separate class.