Class: TestContext::TestContextBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/perfecto-reporting/test/TestContext.rb

Overview

TestContextBuilder

This class used to create TestContext instance

example: cf1 = CustomField.new(key1, val1) cf2 = CustomField.new(key2, val2) TestContext::TestContextBuilder .withContextTags(“tag1” , “tag2” ) .withCustomFields(cf1, cf2) .build()

Constant Summary collapse

@@customFields =
Hash.new
@@testExecutionTags =
nil

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.buildObject

building a new builder instance



51
52
53
# File 'lib/perfecto-reporting/test/TestContext.rb', line 51

def self.build
  return self.new
end

.withCustomFields(*args) ⇒ Object

define the custom fields, overriding any existing definition



41
42
43
44
45
46
47
48
# File 'lib/perfecto-reporting/test/TestContext.rb', line 41

def self.withCustomFields *args
	unless args.nil?
	  args.each do |cf| 
		@@customFields[cf.key] = cf.value
	  end
	end
  return self
end

.withTestExecutionTags(*args) ⇒ Object

define contextTags



35
36
37
38
# File 'lib/perfecto-reporting/test/TestContext.rb', line 35

def self.withTestExecutionTags *args
  @@testExecutionTags = args
  return self
end

Instance Method Details

#customFieldsObject



59
60
61
# File 'lib/perfecto-reporting/test/TestContext.rb', line 59

def customFields
  @@customFields
end

#testExecutionTagsObject



55
56
57
# File 'lib/perfecto-reporting/test/TestContext.rb', line 55

def testExecutionTags
  @@testExecutionTags
end