You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
ITestNode now defines GetWarnings and GetErrors calls for tests to return instances that occurred during a test. Split creation of Summary report in UnrealTestNode into Header/Body functions to allow tests to more easily customize these. Added GetLogChannels() function to UnrealLogParser that will return all lines from multiple channels Added AutomatonLogParser that specifically parses the output of automation (non-Gauntlet) tests. #rb CRd [at]josh.engebretson [at]clayton.langford [at]ben.salem #ROBOMERGE-OWNER: ryan.vance #ROBOMERGE-AUTHOR: andrew.grant #ROBOMERGE-SOURCE: CL 6241133 via CL 6246005 via CL 6246055 #ROBOMERGE-BOT: DEVVR (Main -> Dev-VR) [CL 6249793 by andrew grant in Dev-VR branch]
148 lines
2.6 KiB
C#
148 lines
2.6 KiB
C#
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Gauntlet.SelfTest
|
|
{
|
|
public abstract class BaseTestNode : ITestNode
|
|
{
|
|
public virtual float MaxDuration
|
|
{
|
|
get
|
|
{
|
|
return 300;
|
|
}
|
|
}
|
|
|
|
public TestPriority Priority { get { return TestPriority.Normal; } }
|
|
|
|
public string Name
|
|
{
|
|
get
|
|
{
|
|
return ToString();
|
|
}
|
|
}
|
|
|
|
public bool HasWarnings { get { return false; } }
|
|
|
|
public TestResult GetTestResult()
|
|
{
|
|
return InnerResult;
|
|
}
|
|
|
|
|
|
public TestStatus GetTestStatus()
|
|
{
|
|
return InnerStatus;
|
|
}
|
|
|
|
public string GetTestSummary()
|
|
{
|
|
return string.Format("{0} {1}", Name, GetTestResult());
|
|
}
|
|
|
|
/// <summary>
|
|
/// Return list of warnings. Empty by default
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public virtual IEnumerable<string> GetWarnings()
|
|
{
|
|
return new string[0];
|
|
}
|
|
|
|
/// <summary>
|
|
/// Return list of errors. Empty by default
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public virtual IEnumerable<string> GetErrors()
|
|
{
|
|
return new string[0];
|
|
}
|
|
|
|
|
|
public virtual ITestNode[] GetSubTests()
|
|
{
|
|
return new ITestNode[0];
|
|
}
|
|
|
|
public bool RestartTest()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public void SetContext(ITestContext InContext)
|
|
{
|
|
}
|
|
|
|
protected TestResult InnerResult;
|
|
protected TestStatus InnerStatus;
|
|
|
|
public virtual bool IsReadyToStart()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public virtual bool StartTest(int Pass, int NumPasses)
|
|
{
|
|
InnerStatus = TestStatus.InProgress;
|
|
return true;
|
|
}
|
|
public virtual void CleanupTest()
|
|
{
|
|
}
|
|
|
|
public virtual void StopTest(bool WasCancelled)
|
|
{
|
|
}
|
|
|
|
public BaseTestNode()
|
|
{
|
|
TestFailures = new List<string>();
|
|
}
|
|
|
|
public bool CheckResult(bool Result, string Format, params object[] Args)
|
|
{
|
|
|
|
if (Result == false)
|
|
{
|
|
StackTrace Stack = new StackTrace();
|
|
StackFrame StackFrame = Stack.GetFrame(1);
|
|
string TestClass = GetType().Name;
|
|
|
|
string UserMessage = string.Format(Format, Args);
|
|
|
|
string Msg = string.Format("Test Failure: {0}::{1} {2}", TestClass, StackFrame.GetMethod().Name, UserMessage);
|
|
TestFailures.Add(Msg);
|
|
Log.Error(Msg);
|
|
}
|
|
Trace.Assert(Result);
|
|
|
|
return Result;
|
|
}
|
|
|
|
protected void MarkComplete(TestResult InResult)
|
|
{
|
|
InnerResult = InResult;
|
|
InnerStatus = TestStatus.Complete;
|
|
}
|
|
|
|
protected void MarkComplete()
|
|
{
|
|
MarkComplete(TestFailures.Count == 0 ? TestResult.Passed : TestResult.Failed);
|
|
}
|
|
|
|
// Self test interface
|
|
public abstract void TickTest();
|
|
|
|
protected List<string> TestFailures;
|
|
|
|
}
|
|
}
|