Sha256: 61366808a73b3f726c6fcb3eb477a256ee32a230fe00088ca6c6f877bf35aa26

Contents?: true

Size: 1.34 KB

Versions: 31

Compression:

Stored size: 1.34 KB

Contents

module HybridPlatformsConductorTest

  # Report plugins for tests
  class TestsReportPlugin < HybridPlatformsConductor::TestReport

    class << self

      # Reports (that can be compared), per report name
      # Array< Hash<Symbol, Object> >
      attr_accessor :reports

    end

    # Handle tests reports
    def report
      TestsReportPlugin.reports << {
        global_tests: report_from(global_tests),
        platform_tests: report_from(platform_tests),
        node_tests: report_from(node_tests),
        errors_per_test: group_errors(node_tests, :test_name).transform_values do |errors|
          errors.map { |error| error.split("\n").first }
        end,
        nodes_by_nodes_list: nodes_by_nodes_list
      }
    end

    private

    # Get a report from a tests list
    #
    # Parameters::
    # * *tests* (Array<Test>): List of tests
    # Result::
    # Array<Object>: The report, that can be comparable in a list
    def report_from(tests)
      tests.map do |test|
        report = [test.name, test.executed?]
        report << test.platform.name unless test.platform.nil?
        report << test.node unless test.node.nil?
        # Only report the first line of the error messages, as some contain callstacks
        report << test.errors.map { |error| error.split("\n").first } unless test.errors.empty?
        report
      end
    end

  end

end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
hybrid_platforms_conductor-33.9.5 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-33.9.4 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-33.9.2 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-33.9.1 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-33.9.0 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-33.8.4 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-33.8.3 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-33.8.2 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-33.8.1 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-33.8.0 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-33.7.4 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-33.7.3 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-33.7.2 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-33.7.1 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-33.7.0 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-33.6.0 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-33.5.1 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-33.5.0 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-33.4.0 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-33.3.0 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb