Description of TestResultsExporter.
コード例 #1
0
 protected override void BeginProcessing()
 {
     CheckCmdletParameters();
     
     var dataObject = new ImportExportCmdletBaseDataObject {
         As = As,
         Descending = Descending,
         ExcludeAutomatic = ExcludeAutomatic,
         FilterAll = FilterAll,
         FilterDescriptionContains = FilterDescriptionContains,
         FilterFailed = FilterFailed,
         FilterIdContains = FilterIdContains,
         FilterNameContains = FilterNameContains,
         FilterNone = FilterNone,
         FilterNotTested = FilterNotTested,
         FilterOutAutomaticAndTechnicalResults = FilterOutAutomaticAndTechnicalResults,
         FilterOutAutomaticResults = FilterOutAutomaticResults,
         FilterPassed = FilterPassed,
         FilterPassedWithBadSmell = FilterPassedWithBadSmell,
         Id = Id,
         Name = Name,
         OrderByDateTime = OrderByDateTime,
         OrderByFailRate = OrderByFailRate,
         OrderById = OrderById,
         OrderByName = OrderByName,
         OrderByPassRate = OrderByPassRate,
         OrderByTimeSpent = OrderByTimeSpent,
         Path = Path
     };
     
     string reportFormat = As.ToUpper();
     switch (reportFormat){
         case "XML":
             // 20141114
             // TmxHelper.ExportResultsToXML(dataObject, Path);
             var testResultsExporter = new TestResultsExporter();
             testResultsExporter.ExportResultsToXml(dataObject, Path, TestData.TestSuites, TestData.TestPlatforms);
             break;
         case "JUNIT":
         case "JUNITXML":
             TmxHelper.ExportResultsToJUnitXML(dataObject, Path);
             break;
         case "HTML":
             ExportResultsToHTML(this, Path);
             break;
         case "CSV":
             ExportResultsToCSV(Path);
             break;
         case "TEXT":
             ExportResultsToTEXT(Path);
             break;
         case "ZIP":
             ExportResultsToZIP(Path);
             break;
         default:
             
             break;
     }
     
 }
コード例 #2
0
        protected override void BeginProcessing()
        {
            CheckCmdletParameters();

            var cmdlet = new SearchCmdletBase {FilterAll = true};

            // 20140720
//            var dataObject = new SearchCmdletBaseDataObject {
//                FilterAll = true
//            };
            // 20140721
            var dataObject = new SearchCmdletBaseDataObject {
                Descending = cmdlet.Descending,
                FilterAll = cmdlet.FilterAll,
                FilterDescriptionContains = cmdlet.FilterDescriptionContains,
                FilterFailed = cmdlet.FilterFailed,
                FilterIdContains = cmdlet.FilterIdContains,
                FilterNameContains = cmdlet.FilterNameContains,
                FilterNone = cmdlet.FilterNone,
                FilterNotTested = cmdlet.FilterNotTested,
                FilterOutAutomaticAndTechnicalResults = cmdlet.FilterOutAutomaticAndTechnicalResults,
                FilterOutAutomaticResults = cmdlet.FilterOutAutomaticResults,
                FilterPassed = cmdlet.FilterPassed,
                FilterPassedWithBadSmell = cmdlet.FilterPassedWithBadSmell,
                Id = cmdlet.Id,
                Name = cmdlet.Name,
                OrderByDateTime = cmdlet.OrderByDateTime,
                OrderByFailRate = cmdlet.OrderByFailRate,
                OrderById = cmdlet.OrderById,
                OrderByName = cmdlet.OrderByName,
                OrderByPassRate = cmdlet.OrderByPassRate,
                OrderByTimeSpent = cmdlet.OrderByTimeSpent
            };
            // IOrderedEnumerable<TestSuite> suites =
            IOrderedEnumerable<ITestSuite> suites = TmxHelper.SearchForSuites(dataObject);
            
cmdlet.FilterNone = true;
            
            IOrderedEnumerable<ITestScenario> scenarios = TmxHelper.SearchForScenarios(dataObject);

            //cmdlet.FilterAll = false;
            //cmdlet.FilterPassedWithBadSmell = true;
//            cmdlet.FilterNone = true;
            
            IOrderedEnumerable<ITestResult> testResults = TmxHelper.SearchForTestResults(dataObject);
            
            // 20141124
//            XElement suitesElement = 
//                TmxHelper.CreateSuitesXElementWithParameters(
//                    suites,
//                    scenarios,
//                    testResults,
//                    (new XMLElementsNativeStruct()));
            
            var testResultsExporter = new TestResultsExporter();
            var suitesElement = testResultsExporter.CreateSuitesXElementWithParameters(
                suites,
                scenarios,
                testResults,
                (new XMLElementsNativeStruct()));
            
            WriteObject(this, suitesElement);

        }
コード例 #3
0
 XDocument GIVEN_exported_test_results_with_duplicates()
 {
     var listPlatforms = new List<ITestPlatform> {
         new TestPlatform { Id = "1", Name = "p1" },
         new TestPlatform { Id = "2", Name = "p2" }
     };
     var listSuites = new List<ITestSuite> {
         addTestSuiteWithTwoScenarios(listPlatforms[0]),
         addTestSuiteWithTwoScenarios(listPlatforms[1])
         };
     var testResultsExporter = new TestResultsExporter();
     return testResultsExporter.GetTestResultsAsXdocument(
         new SearchCmdletBaseDataObject {
             FilterAll = true
         },
         listSuites,
         listPlatforms);
 }
コード例 #4
0
ファイル: TMXHelper.cs プロジェクト: MatkoHanus/STUPS
        public static void ExportResultsToJUnitXML(ISearchCmdletBaseDataObject cmdlet, string path)
        {
            try {

                var gathered = new GatherTestResultsCollections();
                gathered.GatherCollections(cmdlet);
                
                var testResultsExporter = new TestResultsExporter();
                var suitesElement = testResultsExporter.CreateSuitesXElementWithParameters(
                    gathered.TestSuites,
                    gathered.TestScenarios,
                    gathered.TestResults,
                    (new XMLElementsJUnitStruct()));
                
                var document = new XDocument();
                document.Add(suitesElement);
                document.Save(path);
            }
            catch (Exception eCreateDocument) {
                // 20140720
//                cmdlet.WriteError(
//                    cmdlet,
//                    "Unable to save XML report to the file '" +
//                    path +
//                    "'. " + 
//                    eCreateDocument.Message,
//                    "FailedToSaveReport",
//                    ErrorCategory.InvalidOperation,
//                    true);
                throw new Exception(
                    "Unable to save XML report to the file '" +
                    path +
                    "'. " + 
                    eCreateDocument.Message);
            }
        }