Class: Course::Assessment::ProgrammingTestCaseReport

Inherits:
Object
  • Object
show all
Defined in:
lib/autoload/course/assessment/programming_test_case_report.rb

Overview

Represents a Programming Question test report.

We adopt the JUnit XML format (documented at http://help.catchsoftware.com/display/ET/JUnit+Format) so that evaluations can be run in any language.

Direct Known Subclasses

Java::JavaProgrammingTestCaseReport

Defined Under Namespace

Classes: TestCase, TestSuite

Instance Method Summary collapse

Constructor Details

#initialize(report) ⇒ ProgrammingTestCaseReport

Parses a test case report.


242
243
244
# File 'lib/autoload/course/assessment/programming_test_case_report.rb', line 242

def initialize(report)
  @report = Nokogiri::XML::Document.parse(report)
end

Instance Method Details

#test_casesEnumerable<Course::Assessment::ProgrammingTestCaseReport::TestCase>

Gets the set of test cases in this report.


258
259
260
# File 'lib/autoload/course/assessment/programming_test_case_report.rb', line 258

def test_cases
  test_suites.map(&:test_cases).tap(&:flatten!)
end

#test_suitesEnumerable<Course::Assessment::ProgrammingTestCaseReport::TestSuite>

Gets the set of test suites found in this report.


249
250
251
252
253
# File 'lib/autoload/course/assessment/programming_test_case_report.rb', line 249

def test_suites
  @report.search('./testsuites/testsuite|./testsuite').map do |suite|
    TestSuite.new(suite)
  end
end