/// <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; }
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 HandleTestResult(MSTestResult testResult) { switch (testResult.Outcome) { case TestOutcome.Failed: TestFailed(testResult); break; } }
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); }
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)); }
private string FormatDescription(MSTestResult testResult) { string description = testResult.Description; description += Environment.NewLine; description += "Test Owner: " + testResult.Owner; return description; }
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; }