Class: Dragnet::TestRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/dragnet/test_record.rb

Overview

Represents a Manual Test Record loaded from a MTR file.

Constant Summary collapse

PASSED_RESULT =
'passed'
REVIEWED_STATUS =
'reviewed'
NO_FINDINGS =
'no findings'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ TestRecord

Note:

Either :files or :repos should be present, not both.

Creates a new instance of the class.

Parameters:

  • args (Hash)

    The data for the Manual Test Record

Options Hash (args):

  • :id (String)

    The ID of the MTR

  • :result (String)

    The result of the Manual Test.

  • :sha1 (String)

    The SHA1 of the commit in which the Manual Test was performed.

  • :name (String, Array<String>, nil)

    The name of the person who performed the Manual Test.

  • :description (String, nil)

    The description of the Manual Test, normally which actions were performed and what it was mean to test.

  • :files (String, Array<String>, nil)

    The files involved in the MTR, these are the files which will be checked for changes when evaluating the validity of the MTR.

  • :repos (Array<Hash>, nil)

    An array of Hashes with the information about the repositories that are involved in the MTR, these repositories will be checked for changes during the evaluation of the MTR.

  • :review_status (String, nil)

    or :reviewstatus The review status of the MTR. (Normally changed when someone other than the tester verifies the result of the Manual Test)

  • :review_comments (String, nil)

    or :reviewcomments The comments left by the person who performed the review of the Manual Test.

  • :findings (String, nil)

    The findings that the reviewer collected during the review process (if any).

  • :test_method (String, Array<String>, nil)

    The method(s) used to carry out the test.

  • :tc_derivation_method: (String, Array<String>, nil)

    The method(s) used to derive the test case,



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/dragnet/test_record.rb', line 52

def initialize(args)
  @id = args[:id]
  @result = args[:result]
  @sha1 = args[:sha1]
  @name = args[:name]
  @description = args[:description]
  @files = args[:files]
  @repos = args[:repos]
  @review_status = args[:review_status] || args[:reviewstatus]
  @review_comments = args[:review_comments] || args[:reviewcomments]
  @findings = args[:findings]
  @test_method = args[:test_method]
  @tc_derivation_method = args[:tc_derivation_method]
end

Instance Attribute Details

#descriptionObject

:reek:Attribute (This is an entity class)



14
15
16
# File 'lib/dragnet/test_record.rb', line 14

def description
  @description
end

#filesObject

:reek:Attribute (This is an entity class)



14
15
16
# File 'lib/dragnet/test_record.rb', line 14

def files
  @files
end

#findingsObject

:reek:Attribute (This is an entity class)



14
15
16
# File 'lib/dragnet/test_record.rb', line 14

def findings
  @findings
end

#idObject

:reek:Attribute (This is an entity class)



14
15
16
# File 'lib/dragnet/test_record.rb', line 14

def id
  @id
end

#nameObject

:reek:Attribute (This is an entity class)



14
15
16
# File 'lib/dragnet/test_record.rb', line 14

def name
  @name
end

#reposObject

:reek:Attribute (This is an entity class)



14
15
16
# File 'lib/dragnet/test_record.rb', line 14

def repos
  @repos
end

#resultObject

:reek:Attribute (This is an entity class)



14
15
16
# File 'lib/dragnet/test_record.rb', line 14

def result
  @result
end

#review_commentsObject

:reek:Attribute (This is an entity class)



14
15
16
# File 'lib/dragnet/test_record.rb', line 14

def review_comments
  @review_comments
end

#review_statusObject

:reek:Attribute (This is an entity class)



14
15
16
# File 'lib/dragnet/test_record.rb', line 14

def review_status
  @review_status
end

#sha1Object

:reek:Attribute (This is an entity class)



14
15
16
# File 'lib/dragnet/test_record.rb', line 14

def sha1
  @sha1
end

#source_fileObject

:reek:Attribute (This is an entity class)



14
15
16
# File 'lib/dragnet/test_record.rb', line 14

def source_file
  @source_file
end

#tc_derivation_methodObject

:reek:Attribute (This is an entity class)



14
15
16
# File 'lib/dragnet/test_record.rb', line 14

def tc_derivation_method
  @tc_derivation_method
end

#test_methodObject

:reek:Attribute (This is an entity class)



14
15
16
# File 'lib/dragnet/test_record.rb', line 14

def test_method
  @test_method
end

#verification_resultObject

:reek:Attribute (This is an entity class)



14
15
16
# File 'lib/dragnet/test_record.rb', line 14

def verification_result
  @verification_result
end

Instance Method Details

#findings?Boolean

Returns True if the Manual Test Record has findings (problems annotated during the review), false otherwise.

Returns:

  • (Boolean)

    True if the Manual Test Record has findings (problems annotated during the review), false otherwise.



87
88
89
# File 'lib/dragnet/test_record.rb', line 87

def findings?
  !(findings.nil? || findings.strip.empty? || findings.downcase == NO_FINDINGS)
end

#passed?Boolean

Returns True if the Manual Test passed, false otherwise.

Returns:

  • (Boolean)

    True if the Manual Test passed, false otherwise.



75
76
77
# File 'lib/dragnet/test_record.rb', line 75

def passed?
  result == PASSED_RESULT
end

#reviewed?Boolean

Returns True if the Manual Test Record has been reviewed, false otherwise.

Returns:

  • (Boolean)

    True if the Manual Test Record has been reviewed, false otherwise.



81
82
83
# File 'lib/dragnet/test_record.rb', line 81

def reviewed?
  review_status == REVIEWED_STATUS
end

#validateObject

Validates the MTR's fields

Raises:



70
71
72
# File 'lib/dragnet/test_record.rb', line 70

def validate
  Dragnet::Validators::Entities::TestRecordValidator.new(self).validate
end