Represents a test result extracted from the trx file.
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="other">Source MSTestResult.</param>
 private MSTestResult(MSTestResult other)
     : this(other.Name, other.Outcome, other.Start, other.End, other.mSuits, other.InnerTests)
 {
     Owner       = other.Owner;
     ErrorInfo   = other.ErrorInfo; // ErrorInfo is immutable
     Description = other.Description;
 }
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="other">Source MSTestResult.</param>
 private MSTestResult(MSTestResult other)
     : this(other.Name, other.Outcome, other.Start, other.End, other.mSuits, other.InnerTests) 
 { 
     Owner = other.Owner;
     ErrorInfo = other.ErrorInfo; // ErrorInfo is immutable
     Description = other.Description;
 }
예제 #3
0
        private void HandleAllureTestCaseResult(string suitUid, MSTestResult testResult)
        {
            TestStarted(suitUid, testResult);

            HandleTestResult(testResult);

            TestFinished(testResult);
        }
예제 #4
0
        private string FormatDescription(MSTestResult testResult)
        {
            string description = testResult.Description;

            description += Environment.NewLine;
            description += "Test Owner: " + testResult.Owner;
            return(description);
        }
예제 #5
0
 protected virtual void HandleTestResult(MSTestResult testResult)
 {
     switch (testResult.Outcome)
     {
     case TestOutcome.Failed:
         TestFailed(testResult);
         break;
     }
 }
 protected virtual void HandleTestResult(MSTestResult testResult)
 {
     switch (testResult.Outcome)
     {
         case TestOutcome.Failed:
             TestFailed(testResult);
             break;
     }
 }
예제 #7
0
        protected virtual void TestStarted(string suitId, MSTestResult testResult)
        {
            TestCaseStartedWithTimeEvent testCase = new TestCaseStartedWithTimeEvent(suitId, testResult.Name, testResult.Start);

            if (testResult.Owner != null)
            {
                label ownerLabel = new label("Owner", testResult.Owner);

                testCase.Labels = new label[] { ownerLabel };

                // allure doesnt support custom labels so until issue #394 is solved
                // the test description is used.
                //
                // https://github.com/allure-framework/allure-core/issues/394

                string description = FormatDescription(testResult);

                testCase.Description = new description(descriptiontype.text, description);
            }

            Allure.Lifecycle.Fire(testCase);
        }
예제 #8
0
        private MSTestResult CreateMSTestResultInternal(UnitTestData unitTestData, XElement unitTestResult)
        {
            string dataRowInfo = unitTestResult.GetSafeAttributeValue("dataRowInfo");

            // in data driven tests this appends the input row number to the test name
            string unitTestName = unitTestData.Name;

            unitTestName += dataRowInfo;

            TestOutcome outcome = (TestOutcome)Enum.Parse(typeof(TestOutcome), unitTestResult.Attribute("outcome").Value);

            DateTime start = DateTime.Parse(unitTestResult.Attribute("startTime").Value);

            DateTime end = DateTime.Parse(unitTestResult.Attribute("endTime").Value);

            /*
             * if (categories.Length == 0)
             *  categories = new string[]{ DEFAULT_CATEGORY };
             */

            IEnumerable <MSTestResult> innerTestResults = ParseInnerTestResults(unitTestData, unitTestResult);

            MSTestResult testResult = new MSTestResult(unitTestName, outcome, start, end, unitTestData.Suits, innerTestResults);

            bool containsInnerTestResults = unitTestResult.Element(ns + "InnerResults") == null;

            if ((outcome == TestOutcome.Error || outcome == TestOutcome.Failed) && containsInnerTestResults)
            {
                testResult.ErrorInfo = ParseErrorInfo(unitTestResult);
            }

            testResult.Owner = unitTestData.Owner;

            testResult.Description = unitTestData.Description;

            return(testResult);
        }
예제 #9
0
 protected virtual void TestFailed(MSTestResult testResult)
 {
     Allure.Lifecycle.Fire(new TestCaseFailureWithErrorInfoEvent(testResult.ErrorInfo));
 }
예제 #10
0
 protected virtual void TestFinished(MSTestResult testResult)
 {
     Allure.Lifecycle.Fire(new TestCaseFinishedWithTimeEvent(testResult.End));
 }
 private void HandleAllureTestCaseResult(string suitUid, MSTestResult testResult)
 {
     TestStarted(suitUid, testResult);
     
     HandleTestResult(testResult);
     
     TestFinished(testResult);
 }
 private string FormatDescription(MSTestResult testResult)
 {
     string description = testResult.Description;
     description += Environment.NewLine;
     description += "Test Owner: " + testResult.Owner;
     return description;
 }
 protected virtual void TestFailed(MSTestResult testResult)
 {
     Allure.Lifecycle.Fire(new TestCaseFailureWithErrorInfoEvent(testResult.ErrorInfo));
 }
 protected virtual void TestFinished(MSTestResult testResult)
 {
     Allure.Lifecycle.Fire(new TestCaseFinishedWithTimeEvent(testResult.End));
 }
        protected virtual void TestStarted(string suitId, MSTestResult testResult)
        {
            TestCaseStartedWithTimeEvent testCase = new TestCaseStartedWithTimeEvent(suitId, testResult.Name, testResult.Start);

            if (testResult.Owner != null)
            {
                label ownerLabel = new label("Owner", testResult.Owner);

                testCase.Labels = new label[]{ ownerLabel };

                // allure doesnt support custom labels so until issue #394 is solved
                // the test description is used.
                //
                // https://github.com/allure-framework/allure-core/issues/394

                string description = FormatDescription(testResult);

                testCase.Description = new description(descriptiontype.text, description);
            }

            Allure.Lifecycle.Fire(testCase);
        }
        private MSTestResult CreateMSTestResultInternal(UnitTestData unitTestData, XElement unitTestResult)
        {
            string dataRowInfo = unitTestResult.GetSafeAttributeValue("dataRowInfo");

            // in data driven tests this appends the input row number to the test name
            string unitTestName = unitTestData.Name;
            
            unitTestName += dataRowInfo;

            TestOutcome outcome = (TestOutcome)Enum.Parse(typeof(TestOutcome), unitTestResult.Attribute("outcome").Value);

            DateTime start = DateTime.Parse(unitTestResult.Attribute("startTime").Value);

            DateTime end = DateTime.Parse(unitTestResult.Attribute("endTime").Value);

            /*
            if (categories.Length == 0)
                categories = new string[]{ DEFAULT_CATEGORY };
            */

            IEnumerable<MSTestResult> innerTestResults = ParseInnerTestResults(unitTestData, unitTestResult);

            MSTestResult testResult = new MSTestResult(unitTestName, outcome, start, end, unitTestData.Suits, innerTestResults);

            bool containsInnerTestResults = unitTestResult.Element(ns + "InnerResults") == null;
            if ((outcome == TestOutcome.Error || outcome == TestOutcome.Failed) && containsInnerTestResults)
            {
                testResult.ErrorInfo = ParseErrorInfo(unitTestResult);
            }

            testResult.Owner = unitTestData.Owner;

            testResult.Description = unitTestData.Description;
            
            return testResult;
        }