avocado.job: Always add JSON and Xunit outputs to job dir

As specified in the requirements meeting, always have Xunit and
JSON outputs written to the results dir. The basic idea is to
enable any output plugins specified in the cmd line, the Xunit
and JSON compulsorily, and in the end, if there are no output
plugins requested in the command line, enable human output.
Signed-off-by: NLucas Meneghel Rodrigues <lmr@redhat.com>
上级 26798e6a
......@@ -17,6 +17,7 @@
Module that describes a sequence of automated test operations.
"""
import argparse
import imp
import logging
import multiprocessing
......@@ -35,6 +36,8 @@ from avocado.utils import archive
from avocado import multiplex_config
from avocado import test
from avocado import result
from avocado.plugins import xunit
from avocado.plugins import jsonresult
_NEW_ISSUE_LINK = 'https://github.com/avocado-framework/avocado/issues/new'
......@@ -214,12 +217,40 @@ class Job(object):
self.result_proxy.add_output_plugin(result_plugin)
def _make_test_result(self):
"""
Set up output plugins.
The basic idea behind the output plugins is:
* If there are any active output plugins, use them
* Always add Xunit and JSON plugins outputting to files inside the
results dir
* If at the end we only have 2 output plugins (Xunit and JSON), we can
add the human output plugin.
"""
if self.args:
# If there are any active output plugins, let's use them
self._set_output_plugins()
if not self.result_proxy.output_plugins:
default_plugin = result.HumanTestResult(self.output_manager, self.args)
self.result_proxy.add_output_plugin(default_plugin)
# Setup the xunit plugin to output to the debug directory
xunit_file = os.path.join(self.debugdir, 'results.xml')
args = argparse.Namespace()
args.xunit_output = xunit_file
xunit_plugin = xunit.xUnitTestResult(self.output_manager, args)
self.result_proxy.add_output_plugin(xunit_plugin)
# Setup the json plugin to output to the debug directory
json_file = os.path.join(self.debugdir, 'results.json')
args = argparse.Namespace()
args.json_output = json_file
json_plugin = jsonresult.JSONTestResult(self.output_manager, args)
self.result_proxy.add_output_plugin(json_plugin)
# If there are no active output plugins besides xunit and json,
# set up the human output.
if len(self.result_proxy.output_plugins) == 2:
human_plugin = result.HumanTestResult(self.output_manager, self.args)
self.result_proxy.add_output_plugin(human_plugin)
def _run(self, urls=None, multiplex_file=None):
"""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册