270
by dilshan_a
Initial check in for test framework, and example problems |
1 |
import sys |
289
by dilshan_a
Updated tests so it works in the test framework |
2 |
sys.path.append('../../www/apps/tutorialservice/test/') |
295
by dilshan_a
Added a filesum problem. |
3 |
|
289
by dilshan_a
Updated tests so it works in the test framework |
4 |
from parse_exercise import * |
513
by stevenbird
test/test_framework/*, exercises/sample/* |
5 |
|
270
by dilshan_a
Initial check in for test framework, and example problems |
6 |
def print_results(problem): |
288
by dilshan_a
Jsonified test framework output. |
7 |
print "Problem: %s" %problem['name'] |
8 |
if 'critical_error' in problem: |
|
9 |
error = problem['critical_error'] |
|
10 |
print "Critical error: %s - %s" %(error['name'], error['detail']) |
|
11 |
else: |
|
12 |
for case in problem['cases']: |
|
13 |
print "Case: %s" %case['name'] |
|
14 |
if 'exception' in case: |
|
15 |
error = case['exception'] |
|
16 |
print "Exception %s - %s" %(error['name'], error['detail']) |
|
17 |
else: |
|
18 |
for part in case['parts']: |
|
19 |
if part['passed']: |
|
20 |
print " Passed: %s" %part['description'] |
|
21 |
else: |
|
22 |
print " Failed: %s -- %s" %(part['description'],part['error_message']) |
|
23 |
print
|
|
24 |
||
295
by dilshan_a
Added a filesum problem. |
25 |
problem_suite = parse_exercise_file('filesum_text.xml') |
513
by stevenbird
test/test_framework/*, exercises/sample/* |
26 |
print_results(problem_suite.run_tests(file("filesum.py").read())) |
302
by dilshan_a
Updated test framework so that student's code is passed in as a string. |
27 |
|
270
by dilshan_a
Initial check in for test framework, and example problems |
28 |
problem_suite = parse_exercise_file('hello_text.xml') |
513
by stevenbird
test/test_framework/*, exercises/sample/* |
29 |
print_results(problem_suite.run_tests(file("hello.py").read())) |
302
by dilshan_a
Updated test framework so that student's code is passed in as a string. |
30 |
|
283
by dilshan_a
Fixed a bug where variables were persistent across test cases. |
31 |
problem_suite = parse_exercise_file('all_input_text.xml') |
513
by stevenbird
test/test_framework/*, exercises/sample/* |
32 |
print_results(problem_suite.run_tests(file("all_input.py").read())) |
302
by dilshan_a
Updated test framework so that student's code is passed in as a string. |
33 |
|
283
by dilshan_a
Fixed a bug where variables were persistent across test cases. |
34 |
problem_suite = parse_exercise_file('fib_text.xml') |
513
by stevenbird
test/test_framework/*, exercises/sample/* |
35 |
print_results(problem_suite.run_tests(file("fib.py").read())) |
302
by dilshan_a
Updated test framework so that student's code is passed in as a string. |
36 |