Skip to content

Commit 9eb9748

Browse files
committed
include more info in junit
1 parent 1473d70 commit 9eb9748

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/parse-taps.bash

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
11
#!/bin/bash
22

3-
head='<?xml version="1.0"?>\n<testsuite>'
3+
head='<?xml version="1.0"?>\n<testsuite name="BatsTests" tests="%d">'
44
foot='</testsuite>'
55

6-
test='<testcase file="%s" name="%s" time="%d" />'
6+
test='<testcase file="%s" classname="%s" time="%d" />'
7+
8+
9+
header(){
10+
line="$1"
11+
count=$(expr "$line" : '1..\([0-9]*\)')
12+
printf "$head" $count
13+
}
714

815
parse_it(){
9-
$line=$1
1016
NAME=$(expr "$line" : '.*ok [0-9]* \(.*\) #time.*')
1117
TIME=$(expr "$line" : '.*ok [0-9]*.*\#time=\(.*\)')
1218
printf "${test}" "${NAME}" "${NAME}" ${TIME}
1319
}
1420

1521

16-
printf "$head"
1722

1823
while read -r line;do
1924
case $line in
20-
1..*) continue ;;
21-
ok*) parse_it $line;;
25+
1..*) header;;
26+
ok*) parse_it;;
2227
\#*) continue;;
2328
*) echo "unkon line" ;;
2429
esac

0 commit comments

Comments
 (0)