自動化テスト出力の解釈
注釈:本資料はAI技術を用いて翻訳されています。
概要
自動化テストは通常、自動ビルドパイプラインの一部として使用され、頻繁なビルドにおけるコストを削減します。自動化テストは2種類の出力を生成します。
-
Unrealログ:このログは、コマンドラインで実行する場合はコマンドラインに出力され、Unreal Editorで実行する場合はUnrealログウィンドウに出力されます。Unrealログファイルは、セッション中にUnrealコンソールに出力された内容です。デフォルトでは、ログは以下の場所に保存されます。
\<ProjectRoot>\ProjectName\Saved\Logs -
AccelByte Development Toolkit(ADT)ログファイル:テストは、JSON lines形式で1つのレベルのテスト結果を含む複数のADTログファイルを生成します。ADTログファイルのレイアウトは以下のとおりです。
<header>
---
<body>
---
<footer>
Unrealを使用して自動化テストを実行すると、システムはADTログファイルを生成します。ファイルは任意の場所に配置でき、後でADT CLIを使用してアップロードできます。例:
\<ProjectRoot>\ProjectName\Saved\Logs\AutomatedTest\AutomatedTest_Windows_Level1.json
BlackBoxログファイル
ファイルの各部分はJSON lines形式です。ヘッダーは1行、フッターは1行、本文の各エントリはそれぞれ1行で記述します。ヘッダーと本文の間、および本文とフッターの間には、---のみの行を入れてください。ADTはこれらの---行で各部分の開始位置を判断するため、ファイルから削除しないでください。
BlackBoxログファイルヘッダー
BlackBoxログファイルの<header>部分は次のようになります:
{"@encoding": "blackbox/snifftest+json.v2.1.0", "test_id": "<test id in UUID>", "map": "<map>"}
@encoding:このADTログファイルのエンコーディングバージョン。blackbox/snifftest+json.v2.1.0を使用してください。ADT CLIはファイルのアップロード時にこの値を確認し、ADT Webはこの値を使用してファイルを読み取ります。test_id:このテスト実行を識別する、生成されたランダムなUUID。本文のすべての行とフッターで同じ値を使用してください。map:現在のテストが実行されているマップ(レベル)。ADT WebのAutomated Test一覧に表示されます。
BlackBoxログファイル本文
テスト結果の<body>部分は、以下の形式である必要があります。
{"test_id": "<test id in UUID>", "type": "begin_test", "name": "test1"}
{"test_id": "<test id in UUID>", "type": "msg", "msg_type": "error", "msg": "errors", "callstack": "C:\\Dev\\Project\\Source\\Project\\Private\\Automation\\AutoCommands.cpp (777)", "timestamp": 1612416088}
{"test_id": "<test id in UUID>", "type": "msg", "msg_type": "warning", "msg": "warning", "callstack": "C:\\Dev\\Project\\Source\\Project\\Private\\Automation\\AutoCommands.cpp (778)", "timestamp": 1612416089}
{"test_id": "<test id in UUID>", "type": "msg", "msg_type": "info", "msg": "info", "callstack": "C:\\Dev\\Project\\Source\\Project\\Private\\Automation\\AutoCommands.cpp (779)", "timestamp": 1612416090}
{"test_id": "<test id in UUID>", "type": "end_test", "name": "test1", "result": "success"}
例:
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "type": "begin_test", "name": "Mantle"}
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "type": "msg", "msg_type": "info", "msg": "MantleFromActorsPosition test : start", "callstack": "C:\\Dev\\Project\\Source\\Project\\Private\\Automation\\AutoCommands_Locomotion.cpp (777)", "timestamp": 1612416088}
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "type": "msg", "msg_type": "info", "msg": "MantleFromActorsPosition Teleport to Mantle1", "callstack": "C:\\Dev\\Project\\Source\\Project\\Private\\Automation\\AutoCommands_Locomotion.cpp (830)", "timestamp": 1612416089}
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "type": "msg", "msg_type": "info", "msg": "MantleFromActorsPosition test : Mantle state reached", "callstack": "C:\\Dev\\Project\\Source\\Project\\Private\\Automation\\AutoCommands_Locomotion.cpp (877)", "timestamp": 1612416090}
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "type": "msg", "msg_type": "info", "msg": "MantleFromActorsPosition from actor (Mantle1) : Mantle Success", "callstack": "C:\\Dev\\Project\\Source\\Project\\Private\\Automation\\AutoCommands_Locomotion.cpp (884)", "timestamp": 1612416091}
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "type": "msg", "msg_type": "info", "msg": "MantleFromActorsPosition test : finish", "callstack": "C:\\Dev\\Project\\Source\\Project\\Private\\Automation\\AutoCommands_Locomotion.cpp (892)", "timestamp": 1612416092}
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "type": "end_test", "name": "Mantle", "result": "success"}
ログを"begin_test"と"end_test"で囲みます。内部にエラータイプのログがある場合、テストは失敗します。
"begin_test"タイプの本文は、以下のパラメータで構成されます。
- テスト実行の
test_id(ヘッダーと同じ値) - 現在のJSON行の
type(形式:"type":"begin_test") - 現在のテストの
name(形式:"name": "test1")
"msg"タイプの本文は、以下のパラメータで構成されます。
- テスト実行の
test_id(ヘッダーと同じ値) - 現在のJSON行の
type(形式:"type":"msg") msg_type:ログの詳細度タイプ(info、error、warning)msg:ログメッセージcallstack:ログが呼び出されたコールスタックtimestamp:ログが書き込まれた時刻(Unix時間、ミリ秒ではなく秒単位)。すべての"msg"行に追加してください。ADT Webでログの横に表示されます。省略した場合もログは表示されますが、時刻は表示されません。ADT Webはログをタイムスタンプ順ではなく、ファイル内の順序で表示します。
"end_test"タイプの本文は、以下のパラメータで構成されます。
- テスト実行の
test_id(ヘッダーと同じ値) - 現在のJSON行の
type(形式:"type":"end_test") - 現在のテストの
name - 現在のテストの
result(エラーログメッセージがある場合は"failed")
BlackBoxログファイルフッター
テスト結果の<footer>部分:
{"test_id": "<test id in UUID>", "total_test": 0, "failed": 0, "success": 0, "result": "<result>"}
- テスト実行の
test_id(ヘッダーと同じ値) total_testは<body>部分のテスト数("begin_test"と"end_test"の1組が1テスト)。total_test、failed、successは、文字列(例:"2")ではなく、JSONの数値(例:2)で記述してください。上記テンプレートの0はプレースホルダーです。failedは失敗したテストの数successは成功したテストの数resultはテスト実行全体の結果。オプションはsuccessまたはfailedです。結果は、本文内のレコードのいずれにも失敗した結果がない場合にのみsuccessになります。
テスト結果の例
ABShooterというゲームのLevel 1を使用したADTログファイルの例:
{"@encoding": "blackbox/snifftest+json.v2.1.0", "test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "map": "Level_1"}
---
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "type": "begin_test", "name": "LoadMap-Level_1"}
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "type": "msg", "msg_type": "warning", "msg": "RegisterLocationMarkersForBodyPartCaps has been called", "callstack": "C:\\Dev\\Project\\Source\\Project\\Private\\Automation\\Something.cpp (830)", "timestamp": 1612416088}
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "type": "msg", "msg_type": "warning", "msg": "GetVertexLocations returned false for mesh HeadStump.", "callstack": "C:\\Dev\\Project\\Source\\Project\\Private\\Automation\\Something.cpp (830)", "timestamp": 1612416089}
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "type": "msg", "msg_type": "info", "msg": "FlushAsyncLoading: 1 QueuedPackages, 0 AsyncPackages", "callstack": "C:\\Dev\\Project\\Source\\Project\\Private\\Automation\\Something.cpp (830)", "timestamp": 1612416090}
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "type": "msg", "msg_type": "info", "msg": "ULevelStreaming::RequestLevel(/Game/Maps/Game/Escape/Sections/Security/Escape_Security_VFX) is flushing async loading", "callstack": "C:\\Dev\\Project\\Source\\Project\\Private\\Automation\\Something.cpp (830)", "timestamp": 1612416091}
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "type": "msg", "msg_type": "error", "msg": "USoundControllerComponent::BeginPlay - sound slots not configured!", "callstack": "C:\\Dev\\Project\\Source\\Project\\Private\\Automation\\Something.cpp (830)", "timestamp": 1612416092}
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "type": "msg", "msg_type": "error", "msg": "USoundControllerComponent::BeginPlay - sound slots not configured!", "callstack": "C:\\Dev\\Project\\Source\\Project\\Private\\Automation\\Something.cpp (830)", "timestamp": 1612416093}
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "type": "end_test", "name": "LoadMap-Level_1", "result": "failed"}
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "type": "begin_test", "name": "Flashlight-PlayerStart"}
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "type": "msg", "msg_type": "info", "msg": "Flashlight test : start", "callstack": "C:\\Dev\\Project\\Source\\Project\\Private\\Automation\\Something.cpp (830)", "timestamp": 1612416094}
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "type": "msg", "msg_type": "info", "msg": "Flashlight test : Success", "callstack": "C:\\Dev\\Project\\Source\\Project\\Private\\Automation\\Something.cpp (830)", "timestamp": 1612416095}
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "type": "end_test", "name": "Flashlight-PlayerStart", "result": "success"}
---
{"test_id": "fc341e58-9a5a-48e6-9ffc-c3b398f935e5", "total_test": 2, "failed": 1, "success": 1, "result": "failed"}