Skip to content

Commit

Permalink
Merge pull request #241 from palexster/apa/fix_parsing
Browse files Browse the repository at this point in the history
Add standard output messages for successful tests
  • Loading branch information
frisso committed Nov 24, 2019
2 parents 5fa67d1 + 564032e commit bd521f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
20 changes: 9 additions & 11 deletions tests/converter/to_junit.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def file_log_parser(file:str) -> dict:
elif index:
test_logs_results[index] += line + "\n"
return test_logs_results


# For each test we generate a testCase parsing the output file
for file in TESTS_FILE.split("\n"):
file_log = "test_log_" + "_".join(file.split("_")[2:])
test = file_log_parser(file_log)
Expand All @@ -42,16 +43,13 @@ def file_log_parser(file:str) -> dict:
continue
else:
duration=duration[:-1]
tc = TestCase(name=test_name, elapsed_sec=int(duration),status=status)
if status != "PASSED++++":
print(len(test[test_name]))
tc.add_failure_info(output=test[test_name])
if test_name in test:
tc = TestCase(name=test_name, elapsed_sec=int(duration),status=status, stdout=test[test_name])
else:
tc = TestCase(name=test_name, elapsed_sec=int(duration),status=status)
tests.append(tc)

# We create a TestSUite and we write them in a XML File
t = TestSuite(name=args.test_suite_name,test_cases=tests)
with open('output.xml', 'w') as f:
TestSuite.to_file(f, [t], prettyprint=False)

from junitparser import JUnitXml

xml1 = JUnitXml.fromfile('output.xml')
print(xml1)
TestSuite.to_file(f, [t], prettyprint=False)
2 changes: 1 addition & 1 deletion tests/helpers_tests.bash
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ function log_test {
echo "++++TEST $1 FAILED++++" >> $test_results
echo "++++TEST $1 FAILED++++" >> $test_tmp
failed=true
cat $test_tmp >> $test_log
else
test_passed=$(($test_passed+1))
echo "++++TEST $1 PASSED++++"
echo "++++TEST $1 PASSED++++" >> $test_results
echo "++++TEST $1 PASSED++++" >> $test_tmp
fi
cat $test_tmp >> $test_log
return $status
}

Expand Down

0 comments on commit bd521f4

Please sign in to comment.