Skip to content

Commit 5b751e6

Browse files
author
Alex Palesandro
committed
Add standard output messages for successful tests
1 parent d8d1554 commit 5b751e6

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

tests/converter/to_junit.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def file_log_parser(file:str) -> dict:
2626
elif index:
2727
test_logs_results[index] += line + "\n"
2828
return test_logs_results
29-
29+
30+
# For each test we generate a testCase parsing the output file
3031
for file in TESTS_FILE.split("\n"):
3132
file_log = "test_log_" + "_".join(file.split("_")[2:])
3233
test = file_log_parser(file_log)
@@ -42,16 +43,13 @@ def file_log_parser(file:str) -> dict:
4243
continue
4344
else:
4445
duration=duration[:-1]
45-
tc = TestCase(name=test_name, elapsed_sec=int(duration),status=status)
46-
if status != "PASSED++++":
47-
print(len(test[test_name]))
48-
tc.add_failure_info(output=test[test_name])
46+
if test_name in test:
47+
tc = TestCase(name=test_name, elapsed_sec=int(duration),status=status, stdout=test[test_name])
48+
else:
49+
tc = TestCase(name=test_name, elapsed_sec=int(duration),status=status)
4950
tests.append(tc)
51+
52+
# We create a TestSUite and we write them in a XML File
5053
t = TestSuite(name=args.test_suite_name,test_cases=tests)
5154
with open('output.xml', 'w') as f:
52-
TestSuite.to_file(f, [t], prettyprint=False)
53-
54-
from junitparser import JUnitXml
55-
56-
xml1 = JUnitXml.fromfile('output.xml')
57-
print(xml1)
55+
TestSuite.to_file(f, [t], prettyprint=False)

tests/helpers_tests.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ function log_test {
4545
echo "++++TEST $1 FAILED++++" >> $test_results
4646
echo "++++TEST $1 FAILED++++" >> $test_tmp
4747
failed=true
48-
cat $test_tmp >> $test_log
4948
else
5049
test_passed=$(($test_passed+1))
5150
echo "++++TEST $1 PASSED++++"
5251
echo "++++TEST $1 PASSED++++" >> $test_results
5352
echo "++++TEST $1 PASSED++++" >> $test_tmp
5453
fi
54+
cat $test_tmp >> $test_log
5555
return $status
5656
}
5757

0 commit comments

Comments
 (0)