/// <summary>
        /// Override the role summary so we can display the actual test failures
        /// </summary>
        /// <param name="InArtifacts"></param>
        /// <param name="Summary"></param>
        /// <returns></returns>
        protected override int GetRoleSummary(UnrealRoleArtifacts InArtifacts, out string Summary)
        {
            int ExitCode = base.GetRoleSummary(InArtifacts, out Summary);

            if (InArtifacts.SessionRole.RoleType == UnrealTargetRole.Editor)
            {
            }

            return(ExitCode);
        }
        public override void CreateReport(TestResult Result, UnrealTestContext Contex, UnrealBuildSource Build, IEnumerable <UnrealRoleArtifacts> Artifacts, string ArtifactPath)
        {
            UnrealRoleArtifacts ClientArtifacts = Artifacts.Where(A => A.SessionRole.RoleType == UnrealTargetRole.Client).FirstOrDefault();

            var SnapshotSummary = new UnrealSnapshotSummary <UnrealHealthSnapshot>(ClientArtifacts.AppInstance.StdOut);

            Log.Info("Elemental Performance Report");
            Log.Info(SnapshotSummary.ToString());

            base.CreateReport(Result, Contex, Build, Artifacts, ArtifactPath);
        }
        protected override int GetExitCodeAndReason(UnrealRoleArtifacts InArtifacts, out string ExitReason)
        {
            int ExitCode = base.GetExitCodeAndReason(InArtifacts, out ExitReason);

            if (InArtifacts.SessionRole.RoleType == UnrealTargetRole.Editor)
            {
                // if no fatal errors, check test results
                if (InArtifacts.LogParser.GetFatalError() == null)
                {
                    AutomationLogParser Parser = new AutomationLogParser(InArtifacts.LogParser);

                    IEnumerable <AutomationTestResult> TotalTests  = Parser.GetResults();
                    IEnumerable <AutomationTestResult> FailedTests = TotalTests.Where(R => !R.Passed);

                    if (FailedTests.Any())
                    {
                        ExitReason = string.Format("{0} of {1} tests failed", FailedTests.Count(), TotalTests.Count());
                        ExitCode   = -1;
                    }
                }
            }

            return(ExitCode);
        }
        protected override int GetExitCodeAndReason(UnrealRoleArtifacts InArtifacts, out string ExitReason)
        {
            string Reason   = "";
            int    ExitCode = -1;

            TestResult FinalResult = TestResult.Invalid;

            UnrealLogParser.LogSummary Summary = InArtifacts.LogSummary;

            if (ErrorType == ErrorTypes.Ensure)
            {
                // for an ensure we should have an entry and a callstack
                int EnsureCount     = Summary.Ensures.Count();
                int CallstackLength = EnsureCount > 0 ? Summary.Ensures.First().Callstack.Length : 0;

                if (EnsureCount == 0)
                {
                    FinalResult = TestResult.Failed;
                    Reason      = string.Format("No ensure error found for failure of type {0}", ErrorType);
                }
                else if (EnsureCount != 1)
                {
                    FinalResult = TestResult.Failed;
                    Reason      = string.Format("Incorrect ensure count found for failure of type {0}", ErrorType);
                }
                else if (CallstackLength == 0)
                {
                    FinalResult = TestResult.Failed;
                    Reason      = string.Format("No callstack error found for failure of type {0}", ErrorType);
                }
                else
                {
                    FinalResult = TestResult.Passed;
                    Reason      = string.Format("Found {0} ensures, test result = {1}", EnsureCount, FinalResult);
                }
            }
            else
            {
                if (Summary.FatalError == null)
                {
                    FinalResult = TestResult.Failed;
                    Log.Info("No fatal error found for failure of type {0}", ErrorType);
                }
                else if (Summary.FatalError.Callstack.Length == 0)
                {
                    FinalResult = TestResult.Failed;
                    Log.Info("No callstack found for failure of type {0}", ErrorType);
                }
                else
                {
                    // all of these should contain a message and a result
                    if (ErrorType == ErrorTypes.Check)
                    {
                        if (!Summary.FatalError.Message.ToLower().Contains("assertion failed"))
                        {
                            FinalResult = TestResult.Failed;
                            Reason      = string.Format("Unexpected assertion message");
                        }
                        else
                        {
                            FinalResult = TestResult.Passed;
                        }
                        Log.Info("Assertion message was {0}", Summary.FatalError.Message);
                    }
                    else if (ErrorType == ErrorTypes.Fatal)
                    {
                        if (!Summary.FatalError.Message.ToLower().Contains("fatal erro"))
                        {
                            FinalResult = TestResult.Failed;
                            Reason      = string.Format("Unexpected Fatal Error message");
                        }
                        else
                        {
                            FinalResult = TestResult.Passed;
                        }

                        Log.Info("Fatal Error message was {0}", Summary.FatalError.Message);
                    }
                    else if (ErrorType == ErrorTypes.GPF)
                    {
                        if (!Summary.FatalError.Message.ToLower().Contains("exception"))
                        {
                            FinalResult = TestResult.Failed;
                            Reason      = string.Format("Unexpected exception message");
                        }
                        else
                        {
                            FinalResult = TestResult.Passed;
                        }

                        Log.Info("Exception message was {0}", Summary.FatalError.Message);
                    }
                }
            }

            if (FinalResult != TestResult.Invalid)
            {
                ExitCode   = (FinalResult == TestResult.Passed) ? 0 : 6;
                ExitReason = Reason;
                return(ExitCode);
            }

            return(base.GetExitCodeAndReason(InArtifacts, out ExitReason));
        }