Sha256: deee29b038cc5cf4ec688224454160dc82637a213a117ddeb512af20b2d77416

Contents?: true

Size: 1.39 KB

Versions: 36

Compression:

Stored size: 1.39 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: Hash[group_errors(node_tests, :test_name).map do |test_name, errors|
          [
            test_name,
            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

36 entries across 36 versions & 1 rubygems

Version Path
hybrid_platforms_conductor-33.0.0 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-32.18.0 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-32.17.1 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-32.17.0 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-32.16.4 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-32.16.3 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-32.16.2 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-32.16.1 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-32.16.0 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-32.15.0 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-32.14.0 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-32.13.4 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-32.13.3 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-32.13.2 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-32.13.1 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-32.13.0 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-32.12.0 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-32.11.2 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-32.11.1 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb
hybrid_platforms_conductor-32.11.0 spec/hybrid_platforms_conductor_test/tests_report_plugin.rb