From 10d593d4138af9b841e715b3535bf31550411b51 Mon Sep 17 00:00:00 2001 From: Alex Overchenko Date: Fri, 27 Nov 2020 10:23:54 +0300 Subject: [PATCH] parse_output test_suite tag can be passed as arg now --- auto/parse_output.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/auto/parse_output.rb b/auto/parse_output.rb index d5515d5..f0c062b 100644 --- a/auto/parse_output.rb +++ b/auto/parse_output.rb @@ -18,6 +18,9 @@ # To use this parser use the following command # ruby parseOutput.rb [options] [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 #============================================================ @@ -33,6 +36,9 @@ class ParseOutput @array_list = false # current suite name and statistics + ## testsuite name + @real_test_suite_name = 'Unity' + ## classname for testcase @test_suite = nil @total_tests = 0 @test_passed = 0 @@ -45,6 +51,12 @@ class ParseOutput @xml_out = true 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 def write_xml_output 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 def push_xml_output_suite_info # Insert opening tag at front - heading = '' + heading = '' @array_list.insert(0, heading) # Push back the closing tag @array_list.push '' @@ -325,6 +337,8 @@ if ARGV.size >= 1 ARGV.each do |arg| if arg == '-xml' parse_my_file.set_xml_output + elsif arg.start_with?('-suite') + parse_my_file.set_test_suite_name(arg) else parse_my_file.process(arg) break