Пример #1
0
        /// <summary>
        /// Called when a test has completed. By default saves artifacts and calles CreateReport
        /// </summary>
        /// <param name="Result"></param>
        /// <returns></returns>
        public override void StopTest(bool WasCancelled)
        {
            base.StopTest(WasCancelled);

            // Shutdown the instance so we can access all files, but do not null it or shutdown the UnrealApp because we still need
            // access to these objects and their resources! Final cleanup is done in CleanupTest()
            TestInstance.Shutdown();

            try
            {
                Log.Info("Saving artifacts to {0}", ArtifactPath);
                Directory.CreateDirectory(ArtifactPath);
                Utils.SystemHelpers.MarkDirectoryForCleanup(ArtifactPath);

                SessionArtifacts = SaveRoleArtifacts(ArtifactPath);

                // call legacy version
                SaveArtifacts_DEPRECATED(ArtifactPath);
            }
            catch (Exception Ex)
            {
                Log.Warning("Failed to save artifacts. {0}", Ex);
            }

            try
            {
                // Artifacts have been saved, release devices back to pool for other tests to use
                UnrealApp.ReleaseDevices();
            }
            catch (Exception Ex)
            {
                Log.Warning("Failed to release devices. {0}", Ex);
            }

            try
            {
                CreateReport(GetTestResult(), Context, Context.BuildInfo, SessionArtifacts, ArtifactPath);
            }
            catch (Exception Ex)
            {
                Log.Warning("Failed to save completion report. {0}", Ex);
            }

            try
            {
                SubmitToDashboard(GetTestResult(), Context, Context.BuildInfo, SessionArtifacts, ArtifactPath);
            }
            catch (Exception Ex)
            {
                Log.Warning("Failed to submit results to dashboard. {0}", Ex);
            }
        }
        /// <summary>
        /// Called when a test has completed. By default saves artifacts and calles CreateReport
        /// </summary>
        /// <param name="Result"></param>
        /// <returns></returns>
        public override void StopTest(bool WasCancelled)
        {
            base.StopTest(WasCancelled);

            // Shutdown the instance so we can access all files, but do not null it or shutdown the UnrealApp because we still need
            // access to these objects and their resources! Final cleanup is done in CleanupTest()
            TestInstance.Shutdown();

            try
            {
                Log.Info("Saving artifacts to {0}", ArtifactPath);
                // run create dir again just in case the already made dir was cleaned up by another buildfarm job or something similar.
                Directory.CreateDirectory(ArtifactPath);
                Utils.SystemHelpers.MarkDirectoryForCleanup(ArtifactPath);

                SessionArtifacts = SaveRoleArtifacts(ArtifactPath);

                // call legacy version
                SaveArtifacts_DEPRECATED(ArtifactPath);
            }
            catch (Exception Ex)
            {
                Log.Warning("Failed to save artifacts. {0}", Ex);
            }

            try
            {
                // Artifacts have been saved, release devices back to pool for other tests to use
                UnrealApp.ReleaseDevices();
            }
            catch (Exception Ex)
            {
                Log.Warning("Failed to release devices. {0}", Ex);
            }

            string Message = string.Empty;

            try
            {
                CreateReport(GetTestResult(), Context, Context.BuildInfo, SessionArtifacts, ArtifactPath);
            }
            catch (Exception Ex)
            {
                CreateReportFailed = true;
                Message            = Ex.Message;
                Log.Warning("Failed to save completion report. {0}", Ex);
            }

            if (CreateReportFailed)
            {
                try
                {
                    HandleCreateReportFailure(Context, Message);
                }
                catch (Exception Ex)
                {
                    Log.Warning("Failed to handle completion report failure. {0}", Ex);
                }
            }

            try
            {
                SubmitToDashboard(GetTestResult(), Context, Context.BuildInfo, SessionArtifacts, ArtifactPath);
            }
            catch (Exception Ex)
            {
                Log.Warning("Failed to submit results to dashboard. {0}", Ex);
            }
        }