Class: Course::Assessment::Java::JavaProgrammingTestCaseReport::TestSuite

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

Instance Method Summary collapse

Constructor Details

#initialize(suite) ⇒ TestSuite

Creates a new test suite. This represents a <testsuite> element.

Parameters:

  • suite (Nokogiri::XML::Element)

13
14
15
# File 'lib/autoload/course/assessment/java/java_programming_test_case_report.rb', line 13

def initialize(suite)
  @suite = suite
end

Instance Method Details

#durationFloat|nil

The duration for running the test suite.

Returns:

  • (Float|nil)

    The duration for the test suite, nil if the duration was not recorded.


34
35
36
37
38
39
# File 'lib/autoload/course/assessment/java/java_programming_test_case_report.rb', line 34

def duration
  @duration ||= begin
    duration = @suite['duration-ms']
    duration ? duration.to_f / 1000 : nil
  end
end

#identifierString

The identifier for the test suite.

Returns:

  • (String)

27
28
29
# File 'lib/autoload/course/assessment/java/java_programming_test_case_report.rb', line 27

def identifier
  name
end

#nameString

The name of the test suite.

Returns:

  • (String)

20
21
22
# File 'lib/autoload/course/assessment/java/java_programming_test_case_report.rb', line 20

def name
  @suite['name']
end

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

Gets the test cases found in this test suite.

Returns:

  • (Enumerable<Course::Assessment::JavaProgrammingTestCaseReport::TestCase>)

44
45
46
47
48
# File 'lib/autoload/course/assessment/java/java_programming_test_case_report.rb', line 44

def test_cases
  @suite.search('./test/class/test-method').map do |test_case|
    TestCase.new(self, test_case)
  end
end