Commit 2446782a authored by Xavier Thompson's avatar Xavier Thompson

software/end-to-end-testing: Report test durations

parent 1b0fa5b9
...@@ -4,4 +4,4 @@ md5sum = 562e123cefa9e39cbc78300e4643f7b3 ...@@ -4,4 +4,4 @@ md5sum = 562e123cefa9e39cbc78300e4643f7b3
[runTestSuite.in] [runTestSuite.in]
filename = runTestSuite.in filename = runTestSuite.in
md5sum = 524531d759d4e517a993246b4e3f6a27 md5sum = 69a9c2ab0279d7152baddf96e46c93d4
...@@ -13,6 +13,19 @@ import erp5.util.taskdistribution ...@@ -13,6 +13,19 @@ import erp5.util.taskdistribution
import slapos.client import slapos.client
class EndToEndResult(unittest.TextTestResult):
def __init__(self, stream, descriptions, verbosity):
self.durations = []
super().__init__(stream, descriptions, verbosity)
def startTest(self, test):
self._startTime = time.perf_counter()
def stopTest(self, test):
stopTime = time.perf_counter()
self.durations.append((test, stopTime - self._startTime))
def main(): def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--test_suite') parser.add_argument('--test_suite')
...@@ -41,16 +54,19 @@ def main(): ...@@ -41,16 +54,19 @@ def main():
project_title = args.project_title, project_title = args.project_title,
) )
runner = unittest.TextTestRunner() runner = unittest.TextTestRunner(resultclass=EndToEndResult)
result = runner.run(suite) result = runner.run(suite)
errors = dict(result.errors) errors = dict(result.errors)
failures = dict(result.failures) failures = dict(result.failures)
skipped = dict(result.skipped) skipped = dict(result.skipped)
# TODO: unexpected successes and expected failures
durations = dict(result.durations)
print(errors) print(errors)
print(failures) print(failures)
print(skipped) print(skipped)
print(durations)
for t in all_tests: for t in all_tests:
kind = [errors, failures, skipped] kind = [errors, failures, skipped]
...@@ -72,7 +88,7 @@ def main(): ...@@ -72,7 +88,7 @@ def main():
error_count = count[0], error_count = count[0],
failure_count = count[1], failure_count = count[1],
skip_count = count[2], skip_count = count[2],
duration = 0, duration = durations[t],
command = '', command = '',
stdout = output, stdout = output,
stderr = '', stderr = '',
......
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