Naresh Kamboju | 9b43895 | 2016-08-16 13:00:44 +0530 | [diff] [blame] | 1 | #!/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 Kamboju | 9d3ebf9 | 2016-08-16 14:49:23 +0530 | [diff] [blame] | 23 | import sys |
Naresh Kamboju | 9b43895 | 2016-08-16 13:00:44 +0530 | [diff] [blame] | 24 | import xml.etree.ElementTree as ET |
Naresh Kamboju | 9d3ebf9 | 2016-08-16 14:49:23 +0530 | [diff] [blame] | 25 | |
| 26 | input_file = sys.argv[1] |
| 27 | tree = ET.parse(input_file) |
Naresh Kamboju | 9b43895 | 2016-08-16 13:00:44 +0530 | [diff] [blame] | 28 | root = tree.getroot() |
| 29 | |
| 30 | for 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 Kamboju | c3d0bc9 | 2016-08-17 12:11:19 +0530 | [diff] [blame] | 35 | status = 'pass' |
Naresh Kamboju | 9b43895 | 2016-08-16 13:00:44 +0530 | [diff] [blame] | 36 | else: |
Naresh Kamboju | c3d0bc9 | 2016-08-17 12:11:19 +0530 | [diff] [blame] | 37 | status = 'fail' |
Naresh Kamboju | 4ae5458 | 2016-08-17 12:44:25 +0530 | [diff] [blame] | 38 | print name, " ", status |