Aravinth Manivannan
0ec5915130
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
40 lines
956 B
Python
40 lines
956 B
Python
from behave import *
|
|
|
|
from ftest_common.logger import upload_logs_to_ftest
|
|
|
|
|
|
def before_all(context):
|
|
context.success = []
|
|
context.failure = {}
|
|
|
|
|
|
def after_all(context):
|
|
max_score = 3
|
|
score = 0
|
|
|
|
score = len(context.success)
|
|
print("\n\n===============")
|
|
if score == max_score:
|
|
print("All tests passed")
|
|
elif score > 0:
|
|
print(f"Partial success. {score} out of {max_score} tests passed")
|
|
|
|
print("Summary:\n")
|
|
|
|
logs = ""
|
|
|
|
if context.success:
|
|
print(f"Successful tests:\n")
|
|
for s in context.success:
|
|
log = f"[OK] {s}\n"
|
|
print(log)
|
|
logs += log
|
|
|
|
if "failure" in context:
|
|
print(f"\n\nFailed tests:\n")
|
|
for _, (test, error) in enumerate(context.failure.items()):
|
|
log = f"[FAIL] {test} failed with error:\n{error}\n-----\n"
|
|
print(log)
|
|
logs += log
|
|
|
|
upload_logs_to_ftest(score == max_score, logs)
|