示例#1
0
 public XElement CreateSuitesXElementWithParameters(
         IOrderedEnumerable<ITestSuite> suites,
         IOrderedEnumerable<ITestScenario> scenarios,
         IOrderedEnumerable<ITestResult> testResults,
         IXMLElementsStruct xmlStruct)
 {
     var suitesElement = 
         new XElement(xmlStruct.SuitesNode,
                      from suite in suites
                      select new XElement(xmlStruct.SuiteNode,
                                          new XAttribute("uniqueId", suite.UniqueId),
                                          new XAttribute("id", suite.Id),
                                          new XAttribute("name", suite.Name),
                                          new XAttribute("status", suite.Status),
                                          createXattribute(xmlStruct.TimeSpentAttribute, Convert.ToInt32(suite.Statistics.TimeSpent)),
                                          new XAttribute("all", suite.Statistics.All.ToString()),
                                          new XAttribute("passed", suite.Statistics.Passed.ToString()),
                                          createXattribute(xmlStruct.FailedAttribute, suite.Statistics.Failed.ToString()),
                                          new XAttribute("notTested", suite.Statistics.NotTested.ToString()),
                                          new XAttribute("knownIssue", suite.Statistics.PassedButWithBadSmell.ToString()),
                                          createXattribute("description", suite.Description),
                                          createXattribute("platformId", suite.PlatformId),
                                          createXattribute("platformUniqueId", suite.PlatformUniqueId),
                                          CreateScenariosXElementCommon(
                                              suite,
                                              // 20141122
                                              // scenarios.Where(scenario => scenario.SuiteId == suite.Id).OrderBy(scenario => scenario.Id),
                                              // testResults.Where(testResult => testResult.SuiteId == suite.Id).OrderBy(testResult => testResult.Id),
                                              scenarios.Where(scenario => scenario.SuiteId == suite.Id && scenario.SuiteUniqueId == suite.UniqueId).OrderBy(scenario => scenario.Id),
                                              testResults.Where(testResult => testResult.SuiteId == suite.Id && testResult.SuiteUniqueId == suite.UniqueId).OrderBy(testResult => testResult.Id),
                                              xmlStruct)
                                          )
                     );
     return suitesElement;
 }
示例#2
0
        XElement GetScenariosXElement(
            ITestSuite suite,
            ITestScenario scenario,
            IOrderedEnumerable <ITestResult> testResults,
            IXMLElementsStruct xmlStruct)
        {
            var scenariosElement =
                new XElement(xmlStruct.ScenarioNode,
                             new XAttribute("uniqueId", scenario.UniqueId),
                             new XAttribute("id", scenario.Id),
                             new XAttribute("name", scenario.Name),
                             new XAttribute("status", scenario.Status),
                             CreateXattribute(xmlStruct.TimeSpentAttribute, Convert.ToInt32(suite.Statistics.TimeSpent)),
                             new XAttribute("all", scenario.Statistics.All.ToString()),
                             new XAttribute("passed", scenario.Statistics.Passed.ToString()),
                             CreateXattribute(xmlStruct.FailedAttribute, scenario.Statistics.Failed.ToString()),
                             new XAttribute("notTested", scenario.Statistics.NotTested.ToString()),
                             new XAttribute("knownIssue", scenario.Statistics.PassedButWithBadSmell.ToString()),
                             CreateXattribute("description", scenario.Description),
                             CreateXattribute("platformId", scenario.PlatformId),
                             CreateXattribute("platformUniqueId", scenario.PlatformUniqueId),
                             CreateTestResultsXElementCommon(
                                 suite,
                                 scenario,
                                 testResults,
                                 xmlStruct)
                             );

            return(scenariosElement);
        }
示例#3
0
 XElement GetTestPlatformsAsXelement(IXMLElementsStruct xmlStruct, List<ITestPlatform> platforms)
 {
     var query = from platform in platforms
         select generateTestPlatformXelement(xmlStruct.PlatformNode, platform);
     var platformsElement = new XElement(xmlStruct.PlatformsNode, query);
     return platformsElement;
 }
示例#4
0
        XElement GetTestResultsXElement(
            ITestResult testResult,
            IXMLElementsStruct xmlStruct)
        {
            var testResultsElement =
                new XElement(xmlStruct.TestResultNode,
                             new XAttribute("uniqueId", testResult.UniqueId),
                             new XAttribute("id", testResult.Id),
                             new XAttribute("name", testResult.Name),
                             new XAttribute("status", testResult.Status),
                             new XAttribute("origin", testResult.Origin),
                             CreateXattribute(xmlStruct.TimeSpentAttribute, Convert.ToInt32(testResult.TimeSpent)), // ??
                             CreateXelement(
                                 "source",
                                 CreateXattribute("scriptName", testResult.ScriptName),
                                 CreateXattribute("lineNumber", testResult.LineNumber),
                                 CreateXattribute("position", testResult.Position),
                                 CreateXattribute("code", testResult.Code)
                                 ),
                             CreateXattribute(xmlStruct.TimeStampAttribute, testResult.Timestamp),
                             CreateXelement(
                                 "error",
                                 CreateXattribute("error", testResult.Error)
                                 ),
                             CreateXattribute("screenshot", testResult.Screenshot),
                             CreateXattribute("description", testResult.Description),
                             CreateXattribute("platformId", testResult.PlatformId),
                             CreateXattribute("platformUniqueId", testResult.PlatformUniqueId),
                             CreateTestResultDetailsXElement(
                                 testResult,
                                 xmlStruct)
                             );

            return(testResultsElement);
        }
示例#5
0
        public XElement CreateTestResultsXElementCommon(
            ITestSuite suite,
            ITestScenario scenario,
            IOrderedEnumerable <ITestResult> testResults,
            IXMLElementsStruct xmlStruct)
        {
            var testResultsFiltered =
                from testResult in testResults
                where testResult.SuiteId == suite.Id &&
                testResult.ScenarioId == scenario.Id &&
                testResult.Id != null &&
                testResult.Name != null &&
                testResult.PlatformUniqueId == scenario.PlatformUniqueId
                select testResult;

            if (!testResultsFiltered.Any())
            {
                return(null);
            }

            var testResultsElement =
                new XElement(xmlStruct.TestResultsNode,
                             from testResult in testResultsFiltered
                             select GetTestResultsXElement(testResult, xmlStruct)
                             );

            return(testResultsElement);
        }
示例#6
0
        public XElement CreateScenariosXElementCommon(
            ITestSuite suite,
            IOrderedEnumerable <ITestScenario> scenarios,
            IOrderedEnumerable <ITestResult> testResults,
            IXMLElementsStruct xmlStruct)
        {
            var testScenariosFiltered =
                from scenario in scenarios
                where scenario.SuiteId == suite.Id && scenario.PlatformUniqueId == suite.PlatformUniqueId
                select scenario;

            if (!testScenariosFiltered.Any())
            {
                return(null);
            }

            var scenariosElement =
                new XElement(xmlStruct.ScenariosNode,
                             from scenario in testScenariosFiltered
                             select GetScenariosXElement(
                                 suite,
                                 scenario,
                                 // 20141122
                                 // testResults.Where(testResult => testResult.SuiteId == suite.Id && testResult.ScenarioId == scenario.Id).OrderBy(testResult => testResult.Id),
                                 testResults.Where(
                                     testResult => testResult.SuiteId == suite.Id &&
                                     testResult.SuiteUniqueId == suite.UniqueId &&
                                     testResult.ScenarioId == scenario.Id &&
                                     testResult.ScenarioUniqueId == scenario.UniqueId).OrderBy(testResult => testResult.Id),
                                 xmlStruct)
                             );

            return(scenariosElement);
        }
示例#7
0
        XElement GetTestPlatformsAsXelement(IXMLElementsStruct xmlStruct, List <ITestPlatform> platforms)
        {
            var query = from platform in platforms
                        select generateTestPlatformXelement(xmlStruct.PlatformNode, platform);

            var platformsElement = new XElement(xmlStruct.PlatformsNode, query);

            return(platformsElement);
        }
示例#8
0
        public XElement CreateTestResultDetailsXElement(
            ITestResult testResult,
            IXMLElementsStruct xmlStruct)
        {
            if (0 == testResult.Details.Count)
            {
                return(null);
            }

            var testResultDetailsElement =
                new XElement("details",
                             from testResultDetail in testResult.Details
                             select new XElement("detail",
                                                 CreateXattribute("name", testResultDetail.Name),
                                                 CreateXattribute(xmlStruct.TimeSpentAttribute, testResultDetail.Timestamp),
                                                 CreateXattribute("status", testResultDetail.DetailStatus)
                                                 )
                             );

            return(testResultDetailsElement);
        }
示例#9
0
        public XElement CreateSuitesXElementWithParameters(
            IOrderedEnumerable <ITestSuite> suites,
            IOrderedEnumerable <ITestScenario> scenarios,
            IOrderedEnumerable <ITestResult> testResults,
            IXMLElementsStruct xmlStruct)
        {
            var suitesElement =
                new XElement(xmlStruct.SuitesNode,
                             from suite in suites
                             select new XElement(xmlStruct.SuiteNode,
                                                 new XAttribute("uniqueId", suite.UniqueId),
                                                 new XAttribute("id", suite.Id),
                                                 new XAttribute("name", suite.Name),
                                                 new XAttribute("status", suite.Status),
                                                 CreateXattribute(xmlStruct.TimeSpentAttribute, Convert.ToInt32(suite.Statistics.TimeSpent)),
                                                 new XAttribute("all", suite.Statistics.All.ToString()),
                                                 new XAttribute("passed", suite.Statistics.Passed.ToString()),
                                                 CreateXattribute(xmlStruct.FailedAttribute, suite.Statistics.Failed.ToString()),
                                                 new XAttribute("notTested", suite.Statistics.NotTested.ToString()),
                                                 new XAttribute("knownIssue", suite.Statistics.PassedButWithBadSmell.ToString()),
                                                 CreateXattribute("description", suite.Description),
                                                 CreateXattribute("platformId", suite.PlatformId),
                                                 CreateXattribute("platformUniqueId", suite.PlatformUniqueId),
                                                 CreateScenariosXElementCommon(
                                                     suite,
                                                     // 20141122
                                                     // scenarios.Where(scenario => scenario.SuiteId == suite.Id).OrderBy(scenario => scenario.Id),
                                                     // testResults.Where(testResult => testResult.SuiteId == suite.Id).OrderBy(testResult => testResult.Id),
                                                     scenarios.Where(scenario => scenario.SuiteId == suite.Id && scenario.SuiteUniqueId == suite.UniqueId).OrderBy(scenario => scenario.Id),
                                                     testResults.Where(testResult => testResult.SuiteId == suite.Id && testResult.SuiteUniqueId == suite.UniqueId).OrderBy(testResult => testResult.Id),
                                                     xmlStruct)
                                                 )
                             );

            return(suitesElement);
        }
示例#10
0
 public static XElement CreateSuitesXElementWithParameters(
         IOrderedEnumerable<TestSuite> suites,
         IOrderedEnumerable<TestScenario> scenarios,
         IOrderedEnumerable<TestResult> testResults,
         IXMLElementsStruct xmlStruct)
 {
     XElement suitesElement =
         new XElement(xmlStruct.SuitesNode,
                      from suite in suites
                      select new XElement(xmlStruct.SuiteNode,
                                          new XAttribute("id", suite.Id),
                                          new XAttribute("name", suite.Name),
                                          new XAttribute("status", suite.Status),
                                          TMXHelper.CreateXAttribute(xmlStruct.TimeSpentAttribute, Convert.ToInt32(suite.Statistics.TimeSpent)),
                                          new XAttribute("all", suite.Statistics.All.ToString()),
                                          new XAttribute("passed", suite.Statistics.Passed.ToString()),
                                          TMXHelper.CreateXAttribute(xmlStruct.FailedAttribute, suite.Statistics.Failed.ToString()),
                                          new XAttribute("notTested", suite.Statistics.NotTested.ToString()),
                                          new XAttribute("knownIssue", suite.Statistics.PassedButWithBadSmell.ToString()),
                                          TMXHelper.CreateXAttribute("description", suite.Description),
                                          // 20130603
                                          TMXHelper.CreateXAttribute("platformId", suite.PlatformId),
                                          TMXHelper.CreateScenariosXElementCommon(
                                              suite,
                                              scenarios,
                                              testResults,
                                              xmlStruct)
                                          )
                     );
     return suitesElement;
 }
示例#11
0
        public static XElement CreateScenariosXElementCommon(
                TMX.TestSuite suite,
                IOrderedEnumerable<TestScenario> scenarios,
                IOrderedEnumerable<TestResult> testResults,
                IXMLElementsStruct xmlStruct)
        {
            var testScenariosFiltered =
                from scenario in scenarios
                where scenario.SuiteId == suite.Id
                select scenario;

            if (0 == testScenariosFiltered.Count()) {
                return null;
            }

            XElement scenariosElement =
                 new XElement(xmlStruct.ScenariosNode,
                              from scenario in testScenariosFiltered
                              select getScenariosXElement(
                                  suite,
                                  scenario,
                                  testResults,
                                  xmlStruct)
                             );
            return scenariosElement;
        }
示例#12
0
        private static XElement getTestResultsXElement(
                TMX.TestResult testResult,
                IXMLElementsStruct xmlStruct)
        {
            XElement testResultsElement =
                new XElement(xmlStruct.TestResultNode,
                             new XAttribute("id", testResult.Id),
                             new XAttribute("name", testResult.Name),
                             new XAttribute("status", testResult.Status),
                             // 20130626
                             new XAttribute("origin", testResult.Origin),
                             TMXHelper.CreateXAttribute(xmlStruct.TimeSpentAttribute, Convert.ToInt32(testResult.TimeSpent)), // ??
                             TMXHelper.CreateXElement(
                                 "source",
                                 TMXHelper.CreateXAttribute("scriptName", testResult.ScriptName),
                                 TMXHelper.CreateXAttribute("lineNumber", testResult.LineNumber),
                                 TMXHelper.CreateXAttribute("position", testResult.Position),
                                 TMXHelper.CreateXAttribute("code", testResult.Code)
                                ),
                             TMXHelper.CreateXAttribute(xmlStruct.TimeStampAttribute, testResult.Timestamp),
                             TMXHelper.CreateXElement(
                                 "error",
                                 TMXHelper.CreateXAttribute("error", testResult.Error)
                                ),
                             TMXHelper.CreateXAttribute("screenshot", testResult.Screenshot),
                             TMXHelper.CreateXAttribute("description", testResult.Description),
                             // 20130603
                             TMXHelper.CreateXAttribute("platformId", testResult.PlatformId),
                             TMXHelper.CreateTestResultDetailsXElement(
                                 testResult,
                                 xmlStruct)
                            );

            return testResultsElement;
        }
示例#13
0
        private static XElement getScenariosXElement(
                TMX.TestSuite suite,
                TMX.TestScenario scenario,
                IOrderedEnumerable<TestResult> testResults,
                IXMLElementsStruct xmlStruct)
        {
            XElement scenariosElement =
                new XElement(xmlStruct.ScenarioNode,
                             new XAttribute("id", scenario.Id),
                             new XAttribute("name", scenario.Name),
                             new XAttribute("status", scenario.Status),
                             TMXHelper.CreateXAttribute(xmlStruct.TimeSpentAttribute, Convert.ToInt32(suite.Statistics.TimeSpent)),
                             new XAttribute("all", scenario.Statistics.All.ToString()),
                             new XAttribute("passed", scenario.Statistics.Passed.ToString()),
                             TMXHelper.CreateXAttribute(xmlStruct.FailedAttribute, scenario.Statistics.Failed.ToString()),
                             new XAttribute("notTested", scenario.Statistics.NotTested.ToString()),
                             new XAttribute("knownIssue", scenario.Statistics.PassedButWithBadSmell.ToString()),
                             TMXHelper.CreateXAttribute("description", scenario.Description),
                             // 20130603
                             TMXHelper.CreateXAttribute("platformId", scenario.PlatformId),
                             TMXHelper.CreateTestResultsXElementCommon(
                                 suite,
                                 scenario,
                                 testResults,
                                 xmlStruct)
                            );

            return scenariosElement;
        }
示例#14
0
        public XElement CreateTestResultsXElementCommon(
                ITestSuite suite,
                ITestScenario scenario,
                IOrderedEnumerable<ITestResult> testResults,
                IXMLElementsStruct xmlStruct)
        {
            var testResultsFiltered = 
                from testResult in testResults
                where testResult.SuiteId == suite.Id &&
                testResult.ScenarioId == scenario.Id &&
                testResult.Id != null &&
                testResult.Name != null &&
                testResult.PlatformUniqueId == scenario.PlatformUniqueId
                select testResult;

            if (!testResultsFiltered.Any()) {
                return null;
            }
            
            var testResultsElement =
                new XElement(xmlStruct.TestResultsNode,
                             from testResult in testResultsFiltered
                             select getTestResultsXElement(testResult, xmlStruct)
                            );

            return testResultsElement;
        }
示例#15
0
        public XElement CreateScenariosXElementCommon(
                ITestSuite suite,
                IOrderedEnumerable<ITestScenario> scenarios,
                IOrderedEnumerable<ITestResult> testResults,
                IXMLElementsStruct xmlStruct)
        {
            var testScenariosFiltered = 
                from scenario in scenarios
                where scenario.SuiteId == suite.Id && scenario.PlatformUniqueId == suite.PlatformUniqueId
                select scenario;

            if (!testScenariosFiltered.Any()) {
                return null;
            }
            
            var scenariosElement = 
                 new XElement(xmlStruct.ScenariosNode,
                              from scenario in testScenariosFiltered
                              select getScenariosXElement(
                                  suite, 
                                  scenario,
                                  // 20141122
                                  // testResults.Where(testResult => testResult.SuiteId == suite.Id && testResult.ScenarioId == scenario.Id).OrderBy(testResult => testResult.Id),
                                  testResults.Where(
                                      testResult => testResult.SuiteId == suite.Id && 
                                      testResult.SuiteUniqueId == suite.UniqueId && 
                                      testResult.ScenarioId == scenario.Id && 
                                      testResult.ScenarioUniqueId == scenario.UniqueId).OrderBy(testResult => testResult.Id),
                                  xmlStruct)
                             );
            return scenariosElement;
        }
示例#16
0
        public static XElement CreateTestResultDetailsXElement(
                TMX.TestResult testResult,
                IXMLElementsStruct xmlStruct)
        {
            if (0 == testResult.Details.Count) {
                return null;
            }

            XElement testResultDetailsElement =
                new XElement("details",
                             from testResultDetail in testResult.Details
                             select new XElement("detail",
                                                 TMXHelper.CreateXAttribute("name", testResultDetail.Name),
                                                 TMXHelper.CreateXAttribute(xmlStruct.TimeSpentAttribute, testResultDetail.Timestamp),
                                                 TMXHelper.CreateXAttribute("status", testResultDetail.DetailStatus)
                                                )
                            );

            return testResultDetailsElement;
        }
示例#17
0
        public static XElement CreateTestResultsXElementCommon(
                TMX.TestSuite suite,
                TMX.TestScenario scenario,
                IOrderedEnumerable<TestResult> testResults,
                IXMLElementsStruct xmlStruct)
        {
            var testResultsFiltered =
                from testResult in testResults
                where testResult.SuiteId == suite.Id &&
                testResult.ScenarioId == scenario.Id &&
                testResult.Id != null &&
                testResult.Name != null
                select testResult;

            if (0 == testResultsFiltered.Count()) {
                return null;
            }

            XElement testResultsElement =
                new XElement(xmlStruct.TestResultsNode,
                             from testResult in testResultsFiltered
                             select getTestResultsXElement(testResult, xmlStruct)
                            );

            return testResultsElement;
        }
示例#18
0
        XElement getTestResultsXElement(
                ITestResult testResult,
                IXMLElementsStruct xmlStruct)
        {
            var testResultsElement =
                new XElement(xmlStruct.TestResultNode,
                             new XAttribute("uniqueId", testResult.UniqueId),
                             new XAttribute("id", testResult.Id),
                             new XAttribute("name", testResult.Name),
                             new XAttribute("status", testResult.Status),
                             new XAttribute("origin", testResult.Origin),
                             createXattribute(xmlStruct.TimeSpentAttribute, Convert.ToInt32(testResult.TimeSpent)), // ??
                             createXelement(
                                 "source",
                                 createXattribute("scriptName", testResult.ScriptName),
                                 createXattribute("lineNumber", testResult.LineNumber),
                                 createXattribute("position", testResult.Position),
                                 createXattribute("code", testResult.Code)
                                ),
                             createXattribute(xmlStruct.TimeStampAttribute, testResult.Timestamp),
                             createXelement(
                                 "error",
                                 createXattribute("error", testResult.Error)
                                ),
                             createXattribute("screenshot", testResult.Screenshot),
                             createXattribute("description", testResult.Description),
                             createXattribute("platformId", testResult.PlatformId),
                             createXattribute("platformUniqueId", testResult.PlatformUniqueId),
                             CreateTestResultDetailsXElement(
                                 testResult,
                                 xmlStruct)
                            );

            return testResultsElement;
        }