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
[runTestSuite.in]
filename = runTestSuite.in
md5sum = 524531d759d4e517a993246b4e3f6a27
md5sum = 69a9c2ab0279d7152baddf96e46c93d4
......@@ -13,6 +13,19 @@ import erp5.util.taskdistribution
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():
parser = argparse.ArgumentParser()
parser.add_argument('--test_suite')
......@@ -41,16 +54,19 @@ def main():
project_title = args.project_title,
)
runner = unittest.TextTestRunner()
runner = unittest.TextTestRunner(resultclass=EndToEndResult)
result = runner.run(suite)
errors = dict(result.errors)
failures = dict(result.failures)
skipped = dict(result.skipped)
# TODO: unexpected successes and expected failures
durations = dict(result.durations)
print(errors)
print(failures)
print(skipped)
print(durations)
for t in all_tests:
kind = [errors, failures, skipped]
......@@ -72,7 +88,7 @@ def main():
error_count = count[0],
failure_count = count[1],
skip_count = count[2],
duration = 0,
duration = durations[t],
command = '',
stdout = output,
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