Commit 072b7287 authored by Romain Courteaud's avatar Romain Courteaud

erp5_test_result: consider line without test as UNKNOWN result

parent 43a67746
Pipeline #11954 failed with stage
in 0 seconds
...@@ -1421,6 +1421,45 @@ class TestTaskDistribution(TaskDistributionTestCase): ...@@ -1421,6 +1421,45 @@ class TestTaskDistribution(TaskDistributionTestCase):
self._createTestResult(test_title='Periodicity Disabled Test Suite') self._createTestResult(test_title='Periodicity Disabled Test Suite')
self.assertEqual(None, test_suite.getAlarmDate()) self.assertEqual(None, test_suite.getAlarmDate())
class TestRetryUnknownTest(TaskDistributionTestCase):
"""Test how failed tests can be automatically retried.
"""
def afterSetUp(self):
super(TestRetryUnknownTest, self).afterSetUp()
self.test_suite, = self.test_suite_module.objectValues()
self._createTestNode()
self.tic()
def test_unknown_test_with_zero_test_not_retried_by_default(self):
test_result_path, _ = self._createTestResult(test_list=['testFoo', ])
test_result = self.portal.unrestrictedTraverse(test_result_path)
line_url, _ = self.tool.startUnitTest(test_result_path)
test_result_line = self.portal.restrictedTraverse(line_url)
status_dict = {
'test_count': 0,
'error_count': 0,
'failure_count': 0,
}
self.tool.stopUnitTest(line_url, status_dict)
self.tic()
self.assertEqual(test_result_line.getStringIndex(), 'UNKNOWN')
self.assertEqual(test_result_line.getSimulationState(), 'stopped')
self.assertEqual(test_result.getStringIndex(), 'FAIL')
self.assertEqual(test_result.getSimulationState(), 'stopped')
def test_unknown_test_without_status_not_retried_by_default(self):
test_result_path, _ = self._createTestResult(test_list=['testFoo', ])
test_result = self.portal.unrestrictedTraverse(test_result_path)
line_url, _ = self.tool.startUnitTest(test_result_path)
test_result_line = self.portal.restrictedTraverse(line_url)
status_dict = {}
self.tool.stopUnitTest(line_url, status_dict)
self.tic()
self.assertEqual(test_result_line.getStringIndex(), 'UNKNOWN')
self.assertEqual(test_result_line.getSimulationState(), 'stopped')
self.assertEqual(test_result.getStringIndex(), 'FAIL')
self.assertEqual(test_result.getSimulationState(), 'stopped')
class TestRetryFailedTest(TaskDistributionTestCase): class TestRetryFailedTest(TaskDistributionTestCase):
"""Test how failed tests can be automatically retried. """Test how failed tests can be automatically retried.
......
...@@ -63,7 +63,7 @@ elif test_result.getPortalType() == 'Test Result Line': ...@@ -63,7 +63,7 @@ elif test_result.getPortalType() == 'Test Result Line':
errors = kw.get('error_count', 0) errors = kw.get('error_count', 0)
failures = kw.get('failure_count', 0) failures = kw.get('failure_count', 0)
skips = kw.get('skip_count', 0) skips = kw.get('skip_count', 0)
if all_tests is None: if (all_tests is None) or (all_tests == 0):
status = 'UNKNOWN' status = 'UNKNOWN'
all_tests = 0 all_tests = 0
elif errors or failures and unexpected(test_result.getParentValue()): elif errors or failures and unexpected(test_result.getParentValue()):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment