Class: Sapphire::Testing::TeamCity::RubyMineReporter

Inherits:
Reporter show all
Includes:
Rake::TeamCity::RunnerCommon, Rake::TeamCity::RunnerUtils, Rake::TeamCity::StdCaptureHelper, Rake::TeamCity::Utils::UrlFormatter
Defined in:
lib/sapphire/TeamCity/RubyMineReporter.rb

Constant Summary collapse

TEAMCITY_FORMATTER_INTERNAL_ERRORS =
[]
@@reporter_closed =
false
@@RUNNING_EXAMPLES_STORAGE =
{}

Instance Attribute Summary

Attributes inherited from Reporter

#broken_count, #failing_count, #passing_count, #pending_count, #test_count, #time

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRubyMineReporter

Teamcity #############################



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 46

def initialize()
  # Setups Test runner's MessageFactory
  set_message_factory(::Rake::TeamCity::MessageFactory)

  # Initializes
  @groups_stack = []

  if ::Rake::TeamCity.is_in_idea_mode
    #log(@message_factory.create_tests_count(@example_count))
  elsif ::Rake::TeamCity.is_in_buildserver_mode
    log(@message_factory.create_progress_message("Starting..."))
  end

  @current = 0
end

Class Method Details

.closeObject



40
41
42
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 40

def self.close()
  @@reporter_closed = true
end

.closed?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 36

def self.closed?()
  @@reporter_closed
end

Instance Method Details

#BeginTestingObject



162
163
164
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 162

def BeginTesting
  log(@message_factory.create_test_reported_attached)
end

#InsertLineBreakObject



84
85
86
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 84

def InsertLineBreak()

end

#log(msg) ⇒ Object

Teamcity #############################



29
30
31
32
33
34
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 29

def log(msg)
  send_msg(msg)

  # returns:
  msg
end

#OutputResultsObject



166
167
168
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 166

def OutputResults()

end

#PostPrintObject



92
93
94
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 92

def PostPrint

end

#PrePrintObject



88
89
90
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 88

def PrePrint

end

#PrintFooterObject



80
81
82
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 80

def PrintFooter()

end

#PrintHeaderObject



76
77
78
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 76

def PrintHeader()

end

#PrintItem(result, depth) ⇒ Object



62
63
64
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 62

def PrintItem(result, depth)

end

#ScenarioComplete(scenario) ⇒ Object



70
71
72
73
74
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 70

def ScenarioComplete(scenario)
  log(@message_factory.create_suite_finished("Finally"))
  log(@message_factory.create_suite_finished("Assuming"))
  log(@message_factory.create_suite_finished("Scenario: " + scenario.text))
end

#ScenarioStart(scenario) ⇒ Object



66
67
68
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 66

def ScenarioStart(scenario)
  log(@message_factory.create_suite_started("Scenario: " + scenario.text))
end

#TestBroken(test) ⇒ Object



153
154
155
156
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 153

def TestBroken(test)
  log(@message_factory.create_test_ignored(test.text, "Broken"))
  log(@message_factory.create_suite_finished("Finally")) if test.item.is_a? Finally
end

#TestFailed(test) ⇒ Object



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 132

def TestFailed(test)
  if test.messages.is_a? Array
    messages = test.messages.join("\n")
  else
    messages = test.messages
  end
  stack = ""
  test.stack.each do |line|
    if (!line.include? "sapphire")
      stack += line + "\n"
    end
  end
  log(@message_factory.create_test_failed(test.text, messages, stack))
  log(@message_factory.create_suite_finished("Finally")) if test.item.is_a? Finally
end

#TestingCompleteObject



158
159
160
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 158

def TestingComplete()

end

#TestPassed(test) ⇒ Object



127
128
129
130
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 127

def TestPassed(test)
  log(@message_factory.create_test_finished(test.text, test.time))
  log(@message_factory.create_suite_finished("Finally")) if test.item.is_a? Finally
end

#TestPending(test) ⇒ Object



148
149
150
151
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 148

def TestPending(test)
  log(@message_factory.create_test_ignored(test.text, "Pending: Not Yet Implemented"))
  log(@message_factory.create_suite_finished("Finally")) if test.item.is_a? Finally
end

#TestStarted(test) ⇒ Object



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/sapphire/TeamCity/RubyMineReporter.rb', line 96

def TestStarted(test)

  if test.is_a? Given and @current > 0
    log(@message_factory.create_suite_finished("Then"))
    log(@message_factory.create_suite_finished("When"))
    log(@message_factory.create_suite_finished("Given"))
  elsif test.is_a? Finally
    log(@message_factory.create_suite_finished("Then"))
    log(@message_factory.create_suite_finished("When"))
    log(@message_factory.create_suite_finished("Given"))
  end

  @current = 1

  if test.is_a? Given
    log(@message_factory.create_suite_started("Given"))
  elsif test.is_a? When
    log(@message_factory.create_suite_started("When"))
  elsif test.is_a? Then
    log(@message_factory.create_suite_started("Then"))
  elsif test.is_a? Background
    log(@message_factory.create_suite_started("Assuming"))
  elsif test.is_a? Finally
    log(@message_factory.create_suite_started("Finally"))
  end

  @current = @current + 1

  log(@message_factory.create_test_started(test.text))
end