180 likes | 285 Views
WeBWorK Java Evaluator. Nathan Baur. Summary. Project Goals What is a Course Management System? How does the Java evaluator work? Framework JUnit testing Writing problems. Project Goals. Gently introduce programming concepts Grade code fragments or entire programs
E N D
WeBWorK Java Evaluator Nathan Baur
Summary • Project Goals • What is a Course Management System? • How does the Java evaluator work? • Framework • JUnit testing • Writing problems
Project Goals • Gently introduce programming concepts • Grade code fragments or entire programs • Provide specific feedback to help students identify the problems with their code • Provide professors with an easy, flexible system for writing questions • Integrate the evaluator into an existing Course Management System
What is a Course Management System? • Tracks grades and assignments automatically • Some grade certain types assignments automatically, providing immediate feedback • Popular CMS’s include Moodle, Blackboard and WeBWorK
Why choose WeBWorK? • Open-source • Flexible, modular design • Well supported • Already used by a number of institutions
How does the evaluator work? Students are provided with a simple WeBWorK interface to input code Student WeBWorK
How does the evaluator work? Student code is sent from WeBWorK to the Java Evaluator module, which inserts the code into a template file to create a complete Java class Student WeBWorK Evaluator
How does the evaluator work? The Java evaluator launches problem-specific JUnit tests to be run on the student code Student WeBWorK Evaluator JUnit
How does the evaluator work? JUnit returns the results to the Java evaluator module Student WeBWorK Evaluator JUnit
How does the evaluator work? The Java evaluator formats the results into a message for feedback which is sent to WeBWorK Student WeBWorK Evaluator JUnit
How does the evaluator work? WeBWorK gives the students feedback and gives them the opportunity to fix the code and try again. Student WeBWorK Evaluator JUnit
JUnit • Unit testing framework • Tests are written in Java using JUnit classes • Code can be tested for any circumstance • Custom failure messages can be provided based on how the test failed
Writing problems • WeBWorK PG file in perl • Includes the problem description and specifies the .java files to be used by JUnit • Template .java file • Usually minimal • Includes class definition and problem-specific setup so that students don’t have to deal with it • JUnit test file • Includes the tests and feedback messages
Sample PG file DOCUMENT(); # This should be the first executable line in the problem. loadMacros( "PG.pl", "PGbasicmacros.pl", "PGchoicemacros.pl", "PGanswermacros.pl", "PGauxiliaryFunctions.pl", "javaAnswerEvaluators.pl" ); BEGIN_TEXT Hello World! $PAR Given a String object myString, assign it to "Hello World!“ $BR \{ANS_BOX(1,1,30);\} END_TEXT ANS(java_cmp("JavaSampleSet/HelloWorld/","HelloWorld")); ENDDOCUMENT(); # This should be the last executable line in the problem.
Sample .java template file public class HelloWorld { private String myString; public HelloWorld(){ doIt(); } public void doIt(){ replaceme } public String getMyString(){ return myString; } }
Sample JUnit test file import junit.framework.*; public class HelloWorldJUnitTest extends TestCase{ private HelloWorld hw; private String ans = "Hello World!"; public void testDefined(){ Assert.assertTrue("Assigning the variable", hw.getMyString()!=null); } public void testCorrect(){ Assert.assertTrue("Making it say exactly \"Hello World!\"“ , hw.getMyString.equals(ans)); } public static Test suite(){ return new TestSuite(HelloWorldJUnitTest.class); } }
Acknowledgements Andy Wildenberg Jacqueline Baldwin Christelle Scharff Cornell College PACE University Made possible by NSF grant #0511391