mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Output match data to XML
This commit is contained in:
parent
ba3a03736e
commit
dcdb87e31a
1 changed files with 17 additions and 2 deletions
|
@ -62,8 +62,12 @@ module Spectator::Formatting::Components::JUnit
|
||||||
# Adds a failure element to the test case node.
|
# Adds a failure element to the test case node.
|
||||||
def fail(result)
|
def fail(result)
|
||||||
error = result.error
|
error = result.error
|
||||||
@xml.element("failure", message: error.message, type: error.class) do
|
result.expectations.each do |expectation|
|
||||||
# TODO: Add match-data as text to node.
|
next unless expectation.failed?
|
||||||
|
|
||||||
|
@xml.element("failure", message: expectation.failure_message, type: error.class) do
|
||||||
|
match_data(expectation.values)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -81,6 +85,17 @@ module Spectator::Formatting::Components::JUnit
|
||||||
def pending(result)
|
def pending(result)
|
||||||
@xml.element("skipped", message: result.reason)
|
@xml.element("skipped", message: result.reason)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Writes match data for a failed expectation.
|
||||||
|
private def match_data(values)
|
||||||
|
values.each do |(key, value)|
|
||||||
|
@xml.text("\n")
|
||||||
|
@xml.text(key.to_s)
|
||||||
|
@xml.text(": ")
|
||||||
|
@xml.text(value)
|
||||||
|
end
|
||||||
|
@xml.text("\n")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue