aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting/tests
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2019-11-09 12:28:24 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2019-11-09 13:02:54 +0100
commit728f5c95df4d3edbe6b3f814a270cdf3b532aef9 (patch)
treeb07289945c7bdc6c938ab9dc3b93538a2e6d1feb /xtesting/tests
parent7ddcfae7ff8a20fac21f5ba2b923e8e5cbce19e5 (diff)
Generate Html and Xunit Behave reports
Change-Id: I7d5f31502ba61b61a0b1c885fe8828211bc0bc0a Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'xtesting/tests')
-rw-r--r--xtesting/tests/unit/core/test_behaveframework.py35
1 files changed, 25 insertions, 10 deletions
diff --git a/xtesting/tests/unit/core/test_behaveframework.py b/xtesting/tests/unit/core/test_behaveframework.py
index 70ca9738..c4ab2f7c 100644
--- a/xtesting/tests/unit/core/test_behaveframework.py
+++ b/xtesting/tests/unit/core/test_behaveframework.py
@@ -10,9 +10,12 @@
"""Define the classes required to fully cover behave."""
import logging
+import os
import unittest
import mock
+import six
+
from xtesting.core import behaveframework
__author__ = "Deepak Chandella <deepak.chandella@orange.com>"
@@ -115,11 +118,17 @@ class RunTesting(unittest.TestCase):
self.assertEqual(
self.test.run(suites=self.suites, tags=self.tags),
self.test.EX_OK)
- args[0].assert_called_once_with(
- ['--tags=',
- '--format=json',
- '--outfile={}'.format(self.test.json_file),
- 'foo'])
+ html_file = os.path.join(self.test.res_dir, 'output.html')
+ args_list = [
+ '--tags=', '--junit',
+ '--junit-directory={}'.format(self.test.res_dir),
+ '--format=json', '--outfile={}'.format(self.test.json_file)]
+ if six.PY3:
+ args_list += [
+ '--format=behave_html_formatter:HTMLFormatter',
+ '--outfile={}'.format(html_file)]
+ args_list.append('foo')
+ args[0].assert_called_once_with(args_list)
mock_method.assert_called_once_with()
@mock.patch('os.makedirs')
@@ -143,11 +152,17 @@ class RunTesting(unittest.TestCase):
self.test.run(
suites=self.suites, tags=self.tags),
status)
- args[0].assert_called_once_with(
- ['--tags=',
- '--format=json',
- '--outfile={}'.format(self.test.json_file),
- 'foo'])
+ html_file = os.path.join(self.test.res_dir, 'output.html')
+ args_list = [
+ '--tags=', '--junit',
+ '--junit-directory={}'.format(self.test.res_dir),
+ '--format=json', '--outfile={}'.format(self.test.json_file)]
+ if six.PY3:
+ args_list += [
+ '--format=behave_html_formatter:HTMLFormatter',
+ '--outfile={}'.format(html_file)]
+ args_list.append('foo')
+ args[0].assert_called_once_with(args_list)
args[1].assert_called_once_with(self.test.res_dir)
def test_parse_results_exc(self):