blob: ebe3bbd9ca391c9a825536130d94426d7f3784fa [file] [log] [blame]
Naresh Kamboju9b438952016-08-16 13:00:44 +05301#!/usr/bin/python
2#
3# Robot framework test results parser
4#
5# Copyright (C) 2010 - 2016, Linaro Limited.
6#
7# This program is free software; you can redistribute it and/or
8# modify it under the terms of the GNU General Public License
9# as published by the Free Software Foundation; either version 2
10# of the License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20#
21# Author: Naresh Kamboju <naresh.kamboju@linaro.org>
22
Naresh Kamboju9d3ebf92016-08-16 14:49:23 +053023import sys
Naresh Kamboju9b438952016-08-16 13:00:44 +053024import xml.etree.ElementTree as ET
Naresh Kamboju9d3ebf92016-08-16 14:49:23 +053025
26input_file = sys.argv[1]
27tree = ET.parse(input_file)
Naresh Kamboju9b438952016-08-16 13:00:44 +053028root = tree.getroot()
29
30for statistics in root.findall('statistics'):
31 for suite in statistics.findall('suite'):
32 for stat in suite.findall('stat'):
33 name = stat.get('name')
34 if '1' == stat.get('pass'):
Naresh Kambojuc3d0bc92016-08-17 12:11:19 +053035 status = 'pass'
Naresh Kamboju9b438952016-08-16 13:00:44 +053036 else:
Naresh Kambojuc3d0bc92016-08-17 12:11:19 +053037 status = 'fail'
Naresh Kamboju4ae54582016-08-17 12:44:25 +053038 print name, " ", status