コード例 #1
0
ファイル: TestResult.cs プロジェクト: pkelbern/OpenCover.UI
		/// <summary>
		/// Initializes a new instance of the <see cref="TestResult"/> class.
		/// </summary>
		/// <param name="methodName">Name of the method.</param>
		/// <param name="status">The test execution status.</param>
		/// <param name="executionTime">The test execution time.</param>
		/// <param name="failureMessages">The failure messages.</param>
		public TestResult(string methodName, TestExecutionStatus status, decimal? executionTime, string errorMessage, string stackTrace, List<TestResult> testCases)
		{
			MethodName = methodName;
			Status = status;
			ExecutionTime = executionTime;
			TestCases = testCases;

			if (errorMessage != null || stackTrace != null)
			{
				FailureMessages = new TestResultError(errorMessage, stackTrace);
			}
		}
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestResult"/> class.
        /// </summary>
        /// <param name="methodName">Name of the method.</param>
        /// <param name="status">The test execution status.</param>
        /// <param name="executionTime">The test execution time.</param>
        /// <param name="failureMessages">The failure messages.</param>
        public TestResult(string methodName, TestExecutionStatus status, decimal?executionTime, string errorMessage, string stackTrace, List <TestResult> testCases)
        {
            MethodName    = methodName;
            Status        = status;
            ExecutionTime = executionTime;
            TestCases     = testCases;

            if (errorMessage != null || stackTrace != null)
            {
                FailureMessages = new TestResultError(errorMessage, stackTrace);
            }
        }
コード例 #3
0
        /// <summary>
        /// Method that will be called when a test finishes executing
        /// </summary>
        /// <param name="exception">The object that represents a test cases run error</param>
        protected virtual void OnTestRunFinished(Exception exception)
        {
            if (exception != null)
            {
                TestExecutionStatus   = TestExecutionStatus.Failed;
                LastExecutionErrorMsg = exception.ToString();
            }
            else
            {
                TestExecutionStatus   = TestExecutionStatus.Passed;
                LastExecutionErrorMsg = string.Empty;
            }

            if (TestRunFinished != null)
            {
                TestRunFinished(this);
            }
        }
コード例 #4
0
        internal static string GetIcon(TestExecutionStatus status)
        {
            string icon = "Resources/{0}";

            switch (status)
            {
            case TestExecutionStatus.NotRun:
                return(string.Format(icon, "NotRun.png"));

            case TestExecutionStatus.Successful:
                return(string.Format(icon, "Successful.png"));

            case TestExecutionStatus.Error:
                return(string.Format(icon, "Failed.png"));

            case TestExecutionStatus.Inconclusive:
                return(string.Format(icon, "Inconclusive.png"));

            default:
                return(string.Format(icon, "NotRun.png"));
            }
        }
コード例 #5
0
        /// <summary>
        /// Converts Enum to its string equivalent.
        /// </summary>
        /// <param name="status">The status.</param>
        private string GetOutcomeText(TestExecutionStatus status)
        {
            // TODO: Find a better approach. It works for now!

            switch (status)
            {
            case TestExecutionStatus.NotRun:
                return("Not Run");

            case TestExecutionStatus.Successful:
                return("Successful");

            case TestExecutionStatus.Error:
                return("Error");

            case TestExecutionStatus.Inconclusive:
                return("Inconclusive");

            default:
                return("Not Run");
            }
        }
コード例 #6
0
 public void setStatus(TestExecutionStatus status)
 {
     this.status = status;
 }
コード例 #7
0
		/// <summary>
		/// Converts Enum to its string equivalent.
		/// </summary>
		/// <param name="status">The status.</param>
		private string GetOutcomeText(TestExecutionStatus status)
		{
			// TODO: Find a better approach. It works for now!

			switch (status)
			{
				case TestExecutionStatus.NotRun:
					return "Not Run";
				case TestExecutionStatus.Successful:
					return "Successful";
				case TestExecutionStatus.Error:
					return "Error";
				case TestExecutionStatus.Inconclusive:
					return "Inconclusive";
				default:
					return "Not Run";
			}
		}
コード例 #8
0
        private void ReadTestCaseRuns(TestSuiteRun testSuiteRun, XmlReader xmlReader)
        {
            if (xmlReader.IsEmptyElement)
            {
                xmlReader.Skip();
                return;
            }

            xmlReader.Read();

            while (xmlReader.NodeType != XmlNodeType.EndElement)
            {
                switch (xmlReader.Name)
                {
                case "case":
                    string gallioStatus        = ReadAttribute(xmlReader, "status");
                    TestExecutionStatus status = TestExecutionStatus.NotImplemented;

                    switch (gallioStatus)
                    {
                    case "passed":
                        status = TestExecutionStatus.Successful;
                        break;

                    case "failed":
                        status = TestExecutionStatus.Failed;
                        break;

                    case "pending":
                    case "skipped":
                    case "inconclusive":
                        status = TestExecutionStatus.NotImplemented;
                        break;

                    default:
                        throw new NotSupportedException(String.Format(CultureInfo.InvariantCulture, "Gallio test status '{0}' not supported", gallioStatus));
                    }

                    TestCaseRun testCaseRun = new TestCaseRun(
                        ReadAttribute(xmlReader, "id"),
                        status);

                    ReadTestCaseRun(testCaseRun, xmlReader);

                    testSuiteRun.AddTestCaseRun(testCaseRun);

                    break;

                default:
                {
                    throw new NotSupportedException(
                              string.Format(
                                  CultureInfo.InvariantCulture,
                                  "Unsupported xml node '{0}'",
                                  xmlReader.Name));
                }
                }
            }

            xmlReader.Read();
        }
コード例 #9
0
ファイル: TestCaseRun.cs プロジェクト: mohanak12/projectpilot
 public TestCaseRun(string testCaseId, TestExecutionStatus status)
 {
     this.testCaseId = testCaseId;
     this.status     = status;
 }