@@ -188,20 +188,25 @@ public void compileTests() {
188188 }
189189
190190 StringWriter output = new StringWriter ();
191+ boolean didCompile = true ;
191192
192193 /* Compile the sample solution */
193- Compiler .compile (Compiler .getSourceFiles (solution ), options .classPath ,
194+ didCompile = Compiler .compile (Compiler .getSourceFiles (solution ), options .classPath ,
194195 solutionOutput .getUnmaskedPath (), output );
195196
196197 String classPath = options .classPath
197198 + System .getProperty ("path.separator" )
198199 + solutionOutput .getUnmaskedPath ();
199200
200201 /* Compile the tests with the sample solution */
201- Compiler .compile (Compiler .getSourceFiles (tests ), classPath ,
202- testOutput .getUnmaskedPath (), output );
202+ didCompile = Compiler .compile (Compiler .getSourceFiles (tests ), classPath ,
203+ testOutput .getUnmaskedPath (), output ) || didCompile ;
203204 testCompiledOutputDirectory = testOutput .getUnmaskedPath ();
204205
206+ if (!didCompile ) {
207+ System .out .println (output );
208+ }
209+
205210 /* Summarise tests using the solution. */
206211 for (String className : tests .getClasses ("" )) {
207212 List <Data > results = JUnitRunner .runTests (className , classPath );
@@ -246,14 +251,22 @@ public Collection run(Collection submission) {
246251 */
247252
248253 /* Class path contains dependencies and the compiled submission */
249- String classPath = options . classPath
254+ String classPath = submission . getWorking (). getUnmaskedPath ( "bin" )
250255 + System .getProperty ("path.separator" )
251- + submission . getWorking (). getUnmaskedPath ( "bin" ) ;
256+ + options . classPath ;
252257 JSONArray testResults = (JSONArray ) submission .getResults ().get ("tests" );
253258 int totalNumTests = 0 ;
254259 JSONArray functionalityResults = new JSONArray ();
255260 Map <String , TestClassInfo > testInfo = new HashMap <>();
256- for (String className : tests .getClasses ("" )) {
261+ String [] testNames ;
262+ try {
263+ testNames = submission .getSource ().getFile ("tasks" ).getContent ().split ("\n " );
264+ } catch (IOException e ) {
265+ System .out .println ("Unable to find tasks file" );
266+ return submission ;
267+ }
268+ for (String className : testNames ) {
269+ className = "demos." + className + "Test" ;
257270 List <Data > results = JUnitRunner .runTests (className , classPath );
258271 // There are no tests in file - skip over it.
259272 if (results .isEmpty ()) {
@@ -329,11 +342,12 @@ public Collection run(Collection submission) {
329342 }
330343 double scaled = Math .ceil ((total / possible ) * options .weighting );
331344
332- results += "\n $$\n \\ dfrac{" + total + "}{" + possible + "} \\ times " + options .weighting + " = " + scaled + "\n $$" ;
345+ //results += "\n$$\n\\dfrac{" + total + "}{" + possible + "} \\times " + options.weighting + " = " + scaled + "\n$$";
346+ results += "\n $$sum = " +total +"$$" ;
333347
334348 Data data = new Data ();
335349 data .set ("name" , "Functionality Tests" );
336- data .set ("score" , scaled );
350+ data .set ("score" , total );
337351 data .set ("max_score" , options .weighting );
338352 data .set ("output" , results );
339353 data .set ("output_format" , "md" );
0 commit comments