Class: Allure::FileWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/allure_ruby_commons/file_writer.rb

Overview

Allure result file writer

Constant Summary collapse

TEST_RESULT_SUFFIX =

Returns test result suffix.

Returns:

  • (String)

    test result suffix

"-result.json"
TEST_RESULT_CONTAINER_SUFFIX =

Returns test result container suffix.

Returns:

  • (String)

    test result container suffix

"-container.json"
ATTACHMENT_FILE_SUFFIX =

Returns attachment file suffix.

Returns:

  • (String)

    attachment file suffix

"-attachment"

Instance Method Summary collapse

Instance Method Details

#write_attachment(source, attachment) ⇒ void

This method returns an undefined value.

Write allure attachment file

Parameters:

  • source (File, String)

    File or string of attachment to save

  • attachment (Allure::Attachment)


31
32
33
# File 'lib/allure_ruby_commons/file_writer.rb', line 31

def write_attachment(source, attachment)
  source.is_a?(File) ? copy(source.path, attachment.source) : write(attachment.source, source)
end

#write_test_result(test_result) ⇒ void

This method returns an undefined value.

Write test result

Parameters:



16
17
18
# File 'lib/allure_ruby_commons/file_writer.rb', line 16

def write_test_result(test_result)
  write("#{test_result.uuid}#{TEST_RESULT_SUFFIX}", test_result.to_json)
end

#write_test_result_container(test_container_result) ⇒ void

This method returns an undefined value.

Write test result container

Parameters:



23
24
25
# File 'lib/allure_ruby_commons/file_writer.rb', line 23

def write_test_result_container(test_container_result)
  write("#{test_container_result.uuid}#{TEST_RESULT_CONTAINER_SUFFIX}", test_container_result.to_json)
end