diff --git a/tests/conftest.py b/tests/conftest.py index 10a27ddd64..d19e8581a2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -521,22 +521,25 @@ def collect_logs(): query_ = f"?startDate={start_time}&endDate={end_time}" resp = get_target_object.controller_library_object.get_device_statistics_teardown(device_name, query=query_) if resp.status_code == 200: - allure.attach(body=str(resp.json()), name="device_statistics_per_test_case") + allure.attach(body=json.dumps(resp.json(), indent=4), name="device_statistics_per_test_case\n", + attachment_type=allure.attachment_type.JSON) else: logging.info("resp.status_code:- " + str(resp.status_code)) # Check reboot logs query_ = f"?logType=2&startDate={start_time}&endDate={end_time}" resp = get_target_object.controller_library_object.get_device_reboot_logs(device_name, query=query_) if resp.status_code == 200: - allure.attach(body=str(resp.json()), name="device_reboot_logs_per_test_case") + allure.attach(body=json.dumps(resp.json(), indent=4), name="device_reboot_logs_per_test_case\n", + attachment_type=allure.attachment_type.JSON) response = resp.json() # crash log validation if response["values"]: resp = get_target_object.controller_library_object.get_device_reboot_logs(device_name, query="?logType=2") - allure.attach(body=str(resp.json()), name="all_device_reboot_logs") - logging.info("Reboot detected on AP side") - pytest.exit("Reboot detected on AP side") + allure.attach(body=json.dumps(resp.json(), indent=4), name="all_device_reboot_logs\n", + attachment_type=allure.attachment_type.JSON) + logging.info("AP crashed during the test") + pytest.exit("AP crashed during the test") else: logging.info("resp.status_code:- " + str(resp.status_code))