Отчет об ошибке тестирования в отчете Allure

#python #exception #allure #python-behave

Вопрос:

Я использую следующий метод Try except для обработки ошибки утверждения. Но для подлинной ошибки утверждения я не получаю никакого статуса сбоя в отчетах Allure. Таким образом, даже после того, как на самом деле тестовые случаи завершились неудачей из-за ошибки утверждения, отчет allure показывает 100% — ный проход. Можно ли сообщить об ошибках в отчете allure для подлинного сбоя теста из-за ошибки утверждения?

 @then('Premium is generated for {status},{exp_date},{owner},{reg_date},{man_yr},{vchl_make},{vchl_code} accordingly') def step_impl(context, status, exp_date, owner, reg_date, man_yr, vchl_make, vchl_code):  if context.conv_exp_date lt; context.conv_expnd_date:  if context.conv_reg_date gt;= '01-09-2018':  if man_yr == context.expctd_manu_year:  if not context.json_response:  print("empty response")  json_data = context.payload  sys.stdout = open("OD_Plans.log", "a")  print("Previous Policy Status="   " "   status)  print("expiry date="   " "   exp_date)  print("Owner="   " "   owner)  print("Registration Date="   " "   reg_date)  print("Manufacturing Year="   " "   man_yr)  print("Veichle Maker="   " "   vchl_make)  print("Maker Code="   " "   vchl_code)  print(json.dumps(json_data, indent=2))  else:  try:  assert context.json_response is not None  assert float(context.json_response[0]['base_premium']) gt; float(1)  assert float(context.json_response[0]['total_premium']) lt; float(1)  assert float(context.json_response[0]['tax']) gt; float(1)  print(context.json_response[0]["tax"])  except AssertionError:  json_data = context.payload  sys.stdout = open("OD_Plans.log", "a")  print("Test failure due to assertion error")  print("Previous Policy Status="   " "   status)  print("expiry date="   " "   exp_date)  print("Owner="   " "   owner)  print("Registration Date="   " "   reg_date)  print("Manufacturing Year="   " "   man_yr)  print("Veichle Maker="   " "   vchl_make)  print("Maker Code="   " "   vchl_code)  print(json.dumps(json_data, indent=2))