Description of TestResultsImporter.
Exemplo n.º 1
0
 public void Should_import_exported_data()
 {
     var sourceTestPlatforms = new List<ITestPlatform>();
     var sourceTestSuites = new List<ITestSuite>();
     
     var xDoc = GIVEN_exported_test_results();
     var platforms = WHEN_importing_test_platforms(xDoc);
     var suites = WHEN_importing_test_results(xDoc);
     var testResultsImporter = new TestResultsImporter();
     testResultsImporter.MergeTestPlatforms(sourceTestPlatforms, platforms);
     testResultsImporter.MergeTestSuites(sourceTestSuites, suites);
     THEN_there_are_N_platforms_in_xdocument(2, sourceTestPlatforms);
     THEN_there_are_N_suites_in_xdocument(2, sourceTestSuites);
     
     THEN_test_result_N_status_is(suites, "1", TestResultStatuses.Passed);
     THEN_test_result_N_status_is(sourceTestSuites, "2", TestResultStatuses.Passed);
     THEN_test_result_N_status_is(sourceTestSuites, "3", TestResultStatuses.Failed);
     THEN_test_result_N_status_is(sourceTestSuites, "4", TestResultStatuses.KnownIssue);
     THEN_test_result_N_status_is(sourceTestSuites, "5", TestResultStatuses.NotTested);
 }
Exemplo n.º 2
0
 public void Should_import_exported_two_data_sets()
 {
     var sourceTestPlatforms = new List<ITestPlatform>();
     var sourceTestSuites = new List<ITestSuite>();
     
     var xDoc = GIVEN_exported_test_results();
     var platforms01 = WHEN_importing_test_platforms(xDoc);
     var suites01 = WHEN_importing_test_results(xDoc);
     var testResultsImporter = new TestResultsImporter();
     testResultsImporter.MergeTestPlatforms(sourceTestPlatforms, platforms01);
     testResultsImporter.MergeTestSuites(sourceTestSuites, suites01);
     
     xDoc = GIVEN_exported_test_results();
     var platforms02 = WHEN_importing_test_platforms(xDoc);
     var suites02 = WHEN_importing_test_results(xDoc);
     testResultsImporter.MergeTestPlatforms(sourceTestPlatforms, platforms02);
     testResultsImporter.MergeTestSuites(sourceTestSuites, suites02);
     
     THEN_there_are_N_platforms_in_xdocument(4, sourceTestPlatforms);
     THEN_there_are_N_suites_in_xdocument(4, sourceTestSuites);
 }
Exemplo n.º 3
0
 void WHEN_importing_test_results(object rootElement)
 {
     var xDoc = new XDocument(rootElement);
     var testResultsImporter = new TestResultsImporter();
     testResultsImporter.ImportTestPlatformFromXdocument(xDoc);
     _testSuites = testResultsImporter.ImportTestResultsFromXdocument(xDoc);
 }
Exemplo n.º 4
0
 public void Should_import_exported_data_twice_without_duplication()
 {
     var sourceTestPlatforms = new List<ITestPlatform>();
     var sourceTestSuites = new List<ITestSuite>();
     
     var xDoc = GIVEN_exported_test_results();
     var platforms = WHEN_importing_test_platforms(xDoc);
     var suites = WHEN_importing_test_results(xDoc);
     var testResultsImporter = new TestResultsImporter();
     testResultsImporter.MergeTestPlatforms(sourceTestPlatforms, platforms);
     testResultsImporter.MergeTestSuites(sourceTestSuites, suites);
     
     testResultsImporter.MergeTestPlatforms(sourceTestPlatforms, platforms);
     testResultsImporter.MergeTestSuites(sourceTestSuites, suites);
     
     THEN_there_are_N_platforms_in_xdocument(2, sourceTestPlatforms);
     THEN_there_are_N_suites_in_xdocument(2, sourceTestSuites);
 }
Exemplo n.º 5
0
 List<ITestSuite> WHEN_importing_test_results(XDocument xDoc)
 {
     var testResultsImporter = new TestResultsImporter();
     return testResultsImporter.ImportTestResultsFromXdocument(xDoc);
 }
Exemplo n.º 6
0
 List<ITestPlatform> WHEN_importing_test_platforms(XDocument xDoc)
 {
     var testResultsImporter = new TestResultsImporter();
     return testResultsImporter.ImportTestPlatformFromXdocument(xDoc);
 }
        protected override void BeginProcessing()
        {
            CheckCmdletParameters();
            
            var dataObject = new ImportExportCmdletBaseDataObject {
                As = this.As,
                Descending = this.Descending,
                ExcludeAutomatic = this.ExcludeAutomatic,
                FilterAll = this.FilterAll,
                FilterDescriptionContains = this.FilterDescriptionContains,
                FilterFailed = this.FilterFailed,
                FilterIdContains = this.FilterIdContains,
                FilterNameContains = this.FilterNameContains,
                FilterNone = this.FilterNone,
                FilterNotTested = this.FilterNotTested,
                FilterOutAutomaticAndTechnicalResults = this.FilterOutAutomaticAndTechnicalResults,
                FilterOutAutomaticResults = this.FilterOutAutomaticResults,
                FilterPassed = this.FilterPassed,
                FilterPassedWithBadSmell = this.FilterPassedWithBadSmell,
                Id = this.Id,
                Name = this.Name,
                OrderByDateTime = this.OrderByDateTime,
                OrderByFailRate = this.OrderByFailRate,
                OrderById = this.OrderById,
                OrderByName = this.OrderByName,
                OrderByPassRate = this.OrderByPassRate,
                OrderByTimeSpent = this.OrderByTimeSpent,
                Path = this.Path
            };
            
            string reportFormat = As.ToUpper();
            switch (reportFormat){
                case "XML":
                    // 20141112
                    // still the old way
                    // 20141114
                    // TmxHelper.ImportResultsFromXML(dataObject, Path);
                    var testResultsImporter = new TestResultsImporter();
                    // TestData.TestSuites.AddRange(testResultsImporter.ImportResultsFromXML(dataObject, Path));
                    if (testResultsImporter.LoadDocument(dataObject, Path)) {
                        testResultsImporter.MergeTestPlatforms(TestData.TestPlatforms, testResultsImporter.ImportTestPlatformFromXdocument(testResultsImporter.ImportedDocument));
                        testResultsImporter.MergeTestSuites(TestData.TestSuites, testResultsImporter.ImportTestResultsFromXdocument(testResultsImporter.ImportedDocument));
                    }
//                    testResultsImporter.MergeTestPlatforms(TestData.TestPlatforms, testResultsImporter.ImportPlatformsFromXML(dataObject, Path));
//                    testResultsImporter.MergeTestSuites(TestData.TestSuites, testResultsImporter.ImportResultsFromXML(dataObject, Path));
                    
                    break;
                case "JUNIT":
                case "JUNITXML":
                    TmxHelper.ImportResultsFromJUnitXML(dataObject, Path);
                    break;
                case "HTML":
                    
                    ImportResultsFromHTML(this, Path);
                    break;
                case "CSV":
                    ImportResultsFromCSV(Path);
                    break;
                case "TEXT":
                    ImportResultsFromTEXT(Path);
                    break;
                case "ZIP":
                    ImportResultsFromZIP(Path);
                    break;
                default:
                    
                    break;
            }
            
        }