All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Common.py
Go to the documentation of this file.
1 # -*- coding: utf-8 -*-
2 
3 class TestResult(object):
4  '''
5  Class used to group details about a test execution.
6  '''
7  def __init__(self, name, **kwargs):
8  self.name = name
9  self.status = kwargs.pop('status', 'untested')
10  self.data = kwargs
11 
12  def xmlElement(self):
13  '''
14  Return an etree element representing the test result.
15  '''
16  import xml.etree.ElementTree as ET
17  elem = ET.Element('Test', Status=self.status)
18  ET.SubElement(elem, 'Name').text = self.name
19  results = ET.SubElement(elem, 'Results')
20  return elem
21 
22 class TestReport(object):
23  '''
24  Group the information about a collection of tests.
25  '''
26  def __init__(self):
27  self.tests = []