예제 #1
0
            /// <summary>
            /// Convert UnrealAutomatedTestPassResults to Horde data model
            /// </summary>
            /// <param name="InTestPassResults"></param>
            /// <param name="ReportPath"></param>
            /// <param name="ReportURL"></param>
            public static UnrealEngineTestPassResults FromUnrealAutomatedTests(UnrealAutomatedTestPassResults InTestPassResults, string ReportPath, string ReportURL)
            {
                UnrealEngineTestPassResults OutTestPassResults = new UnrealEngineTestPassResults();

                OutTestPassResults.ClientDescriptor           = InTestPassResults.clientDescriptor;
                OutTestPassResults.ReportCreatedOn            = InTestPassResults.reportCreatedOn;
                OutTestPassResults.ReportURL                  = ReportURL;
                OutTestPassResults.SucceededCount             = InTestPassResults.succeeded;
                OutTestPassResults.SucceededWithWarningsCount = InTestPassResults.succeededWithWarnings;
                OutTestPassResults.FailedCount                = InTestPassResults.failed;
                OutTestPassResults.NotRunCount                = InTestPassResults.notRun;
                OutTestPassResults.TotalDurationSeconds       = InTestPassResults.totalDuration;
                if (InTestPassResults.tests != null)
                {
                    foreach (UnrealAutomatedTestResult InTestResult in InTestPassResults.tests)
                    {
                        TestResult ConvertedTestResult = OutTestPassResults.AddNewTestResult();
                        ConvertedTestResult.TestDisplayName = InTestResult.testDisplayName;
                        ConvertedTestResult.FullTestPath    = InTestResult.fullTestPath;
                        ConvertedTestResult.State           = InTestResult.state;
                        Guid TestGuid = Guid.NewGuid();
                        ConvertedTestResult.ArtifactName = TestGuid + ".json";
                        InTestResult.artifactName        = ConvertedTestResult.ArtifactName;
                        // Copy Test Result Detail
                        TestResultDetailed ConvertedTestResultDetailed = ConvertedTestResult.GetTestResultDetailed();
                        ConvertedTestResultDetailed.Errors   = InTestResult.errors;
                        ConvertedTestResultDetailed.Warnings = InTestResult.warnings;
                        foreach (UnrealAutomationArtifact InTestArtifact in InTestResult.artifacts)
                        {
                            Artifact NewArtifact = ConvertedTestResultDetailed.AddNewArtifact();
                            NewArtifact.Id   = InTestArtifact.id;
                            NewArtifact.Name = InTestArtifact.name;
                            NewArtifact.Type = InTestArtifact.type;
                            ComparisonFiles ArtifactFiles = NewArtifact.Files;
                            ArtifactFiles.Difference = Path.Combine(ReportPath, InTestArtifact.files.difference);
                            ArtifactFiles.Approved   = Path.Combine(ReportPath, InTestArtifact.files.approved);
                            ArtifactFiles.Unapproved = Path.Combine(ReportPath, InTestArtifact.files.unapproved);
                        }
                        foreach (UnrealAutomationEntry InTestEntry in InTestResult.entries)
                        {
                            Entry NewEntry = ConvertedTestResultDetailed.AddNewEntry();
                            NewEntry.Filename   = InTestEntry.filename;
                            NewEntry.LineNumber = InTestEntry.lineNumber;
                            NewEntry.Timestamp  = InTestEntry.timestamp;
                            Event EntryEvent = NewEntry.Event;
                            EntryEvent.Artifact = [email protected];
                            EntryEvent.Context  = [email protected];
                            EntryEvent.Message  = [email protected];
                            EntryEvent.Type     = [email protected];
                        }
                    }
                }
                return(OutTestPassResults);
            }
        /// <summary>
        /// Load Unreal Automated Test Results from json report
        /// </summary>
        /// <param name="FilePath"></param>
        public static UnrealAutomatedTestPassResults LoadFromJson(string FilePath)
        {
            UnrealAutomatedTestPassResults JsonTestPassResults = Json.Load <UnrealAutomatedTestPassResults>(new FileReference(FilePath));

            return(JsonTestPassResults);
        }