mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-08-24 13:51:39 +08:00
parse_output test_suite tag can be passed as arg now
This commit is contained in:

committed by
Alex Overchenko

parent
2b725883f7
commit
10d593d413
@ -18,6 +18,9 @@
|
|||||||
# To use this parser use the following command
|
# To use this parser use the following command
|
||||||
# ruby parseOutput.rb [options] [file]
|
# ruby parseOutput.rb [options] [file]
|
||||||
# options: -xml : produce a JUnit compatible XML file
|
# options: -xml : produce a JUnit compatible XML file
|
||||||
|
# -suiteRequiredSuiteName
|
||||||
|
# : replace default test suite name to
|
||||||
|
# "RequiredSuiteName" (can be any name)
|
||||||
# file: file to scan for results
|
# file: file to scan for results
|
||||||
#============================================================
|
#============================================================
|
||||||
|
|
||||||
@ -33,6 +36,9 @@ class ParseOutput
|
|||||||
@array_list = false
|
@array_list = false
|
||||||
|
|
||||||
# current suite name and statistics
|
# current suite name and statistics
|
||||||
|
## testsuite name
|
||||||
|
@real_test_suite_name = 'Unity'
|
||||||
|
## classname for testcase
|
||||||
@test_suite = nil
|
@test_suite = nil
|
||||||
@total_tests = 0
|
@total_tests = 0
|
||||||
@test_passed = 0
|
@test_passed = 0
|
||||||
@ -45,6 +51,12 @@ class ParseOutput
|
|||||||
@xml_out = true
|
@xml_out = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Set the flag to indicate if there will be an XML output file or not
|
||||||
|
def set_test_suite_name(cli_arg)
|
||||||
|
@real_test_suite_name = cli_arg['-suite'.length..-1]
|
||||||
|
puts 'Real test suite name will be \'' + @real_test_suite_name + '\''
|
||||||
|
end
|
||||||
|
|
||||||
# If write our output to XML
|
# If write our output to XML
|
||||||
def write_xml_output
|
def write_xml_output
|
||||||
output = File.open('report.xml', 'w')
|
output = File.open('report.xml', 'w')
|
||||||
@ -57,7 +69,7 @@ class ParseOutput
|
|||||||
# Pushes the suite info as xml to the array list, which will be written later
|
# Pushes the suite info as xml to the array list, which will be written later
|
||||||
def push_xml_output_suite_info
|
def push_xml_output_suite_info
|
||||||
# Insert opening tag at front
|
# Insert opening tag at front
|
||||||
heading = '<testsuite name="Unity" tests="' + @total_tests.to_s + '" failures="' + @test_failed.to_s + '"' + ' skips="' + @test_ignored.to_s + '">'
|
heading = '<testsuite name="' + @real_test_suite_name + '" tests="' + @total_tests.to_s + '" failures="' + @test_failed.to_s + '"' + ' skips="' + @test_ignored.to_s + '">'
|
||||||
@array_list.insert(0, heading)
|
@array_list.insert(0, heading)
|
||||||
# Push back the closing tag
|
# Push back the closing tag
|
||||||
@array_list.push '</testsuite>'
|
@array_list.push '</testsuite>'
|
||||||
@ -325,6 +337,8 @@ if ARGV.size >= 1
|
|||||||
ARGV.each do |arg|
|
ARGV.each do |arg|
|
||||||
if arg == '-xml'
|
if arg == '-xml'
|
||||||
parse_my_file.set_xml_output
|
parse_my_file.set_xml_output
|
||||||
|
elsif arg.start_with?('-suite')
|
||||||
|
parse_my_file.set_test_suite_name(arg)
|
||||||
else
|
else
|
||||||
parse_my_file.process(arg)
|
parse_my_file.process(arg)
|
||||||
break
|
break
|
||||||
|
Reference in New Issue
Block a user