From 4f1e17de5e4a568e8037837fa474fb319c67bad4 Mon Sep 17 00:00:00 2001 From: Maggie Benson Date: Fri, 8 Jul 2016 15:54:42 -0500 Subject: [PATCH] Added missing setters for some TestCase class members. --- junit_xml/__init__.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/junit_xml/__init__.py b/junit_xml/__init__.py index f969b4b..8f7dd96 100644 --- a/junit_xml/__init__.py +++ b/junit_xml/__init__.py @@ -246,7 +246,7 @@ def to_file(file_descriptor, test_suites, prettyprint=True, encoding=None): def _clean_illegal_xml_chars(string_to_clean): """ Removes any illegal unicode characters from the given XML string. - + @see: http://stackoverflow.com/questions/1707890/fast-way-to-filter-illegal-xml-unicode-chars-in-python """ @@ -285,6 +285,22 @@ def __init__(self, name, classname=None, elapsed_sec=None, stdout=None, self.skipped_message = None self.skipped_output = None + def add_elapsed_time_in_sec(self, elapsed_sec): + """Adds/Updates the test duration to the testcase, test time is in seconds only""" + self.elapsed_sec = elapsed_sec + + def add_classname(self, classname): + """Adds/Updates a classname to the testcase""" + self.classname = classname + + def add_stdout(self, stdout): + """Adds/Updates the stdout to the testcase""" + self.stdout = stdout + + def add_stderr(self, stderr): + """Adds/Updates the stderr to the testcase""" + self.stderr = stderr + def add_error_info(self, message=None, output=None): """Adds an error message, output, or both to the test case""" if message: