|
@@ -17,6 +17,7 @@ namespace AutoTestApplication
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
+ WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ": Start Run RunRobotFrameworkReport");
|
|
|
var maxCount = CommonConfigManager.MaxExcuteCount;
|
|
|
var curDateRecord = CommonConfigManager.Records.Find(d => d.ExcuteDate.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd"));
|
|
|
if (curDateRecord?.ExcuteRecords?.Count >= maxCount)
|
|
@@ -56,10 +57,25 @@ namespace AutoTestApplication
|
|
|
{
|
|
|
Console.WriteLine(scheduledEndTime.ToString("yyyy-MM-dd HH:mm:ss") + ": " + CommonConfigManager.ExcuteCmdConfig + "Run the automated test report fail");
|
|
|
}
|
|
|
+ WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ": End Run RunRobotFrameworkReport");
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
Console.WriteLine("RunRobotFrameworkReport error: " + ex.Message);
|
|
|
+ WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " Error: " + ex.Message);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 写入日志
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="message"></param>
|
|
|
+ private void WriteLog(string message)
|
|
|
+ {
|
|
|
+ var logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"Config", "Log.txt");
|
|
|
+ using (StreamWriter streamWriter = new StreamWriter(logPath, true))
|
|
|
+ {
|
|
|
+ streamWriter.WriteLine(message);
|
|
|
}
|
|
|
}
|
|
|
|