Files
HLib/AutoTest/Core/TestModeInitializerUxer.cs
T
2026-06-01 13:23:34 +09:00

65 lines
2.2 KiB
C#

using DocumentFormat.OpenXml.Wordprocessing;
using KssSmaPlaLib.Commons;
using KssSmaPlaLib.AutoTest.Script;
using Serilog.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using KssSmaPlaLib.Batch.Log;
using KssSmaPlaLib.AutoTest.Command.Alias.Loader;
using KssSmaPlaLib.AutoTest.Command.Alias;
using KssSmaPlaLib.AutoTest.Script.Load;
using KssSmaPlaLib.AutoTest.Script.Storage;
using KssSmaPlaLib.AutoTest.Script.Parse;
namespace KssSmaPlaLib.AutoTest.Core
{
public static class TestModeInitializerUxer
{
public static bool TryInitialize(string[] args, out string resultMessage)
{
resultMessage = string.Empty;
// UIステップテストモード判定
var isMode = StepTestRunnerUxer.IsModeByArgs(args);
TestModeUxer.SetTestMode(isMode);
if (!isMode) return true;
// モードのとき、ロード(エイリアス)
if (!CommandAliasLoaderUxer.Try(out var aliasDic, out var messageForMe))
{
resultMessage = messageForMe;
return false;
}
// 保存
CommandAliasUxer.SetAleiasDic(aliasDic);
// ロード(テストスクリプト)
if (!LoadTryUxer.TryLoad(out var stepInfoDTO, out messageForMe))
{
resultMessage = messageForMe;
return false;
}
// 保存
TestScriptStorageUxer.SetStepInfo(stepInfoDTO);
// ステップ内容パース
foreach (var step in stepInfoDTO.StepList)
{
if (!ParseTryUxer.TryParse(step.Raw, out var parsed, out messageForMe))
{
resultMessage = $"ステップ内容が不正です。[ステップNo:{step.StepNo},ステップテキスト:{step.Raw.StepText},エラー内容:{messageForMe}]";
return false;
}
}
// ステップ情報ログ出力
// ↓ToDo自動テスト用ログ出力を作る!
//StepLogUxer.StepInfoLog(stepInfoDTO);
return true;
}
}
}