暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ITestResultAdaptor.cs 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. using System;
  2. using System.Collections.Generic;
  3. using NUnit.Framework.Interfaces;
  4. namespace UnityEditor.TestTools.TestRunner.Api
  5. {
  6. /// <summary>
  7. /// The `ITestResultAdaptor` is the representation of the test results for a node in the test tree implemented as a wrapper around the [NUnit](http://www.nunit.org/) [ITest](https://github.com/nunit/nunit/blob/master/src/NUnitFramework/framework/Interfaces/ITestResults.cs) interface.
  8. /// </summary>
  9. public interface ITestResultAdaptor
  10. {
  11. /// <summary>
  12. /// The test details of the test result tree node as a <see cref="TestAdaptor"/>
  13. /// </summary>
  14. ITestAdaptor Test { get; }
  15. ///<summary>
  16. ///The name of the test node.
  17. ///</summary>
  18. string Name { get; }
  19. /// <summary>
  20. /// Gets the full name of the test result
  21. /// </summary>
  22. ///<returns>
  23. ///The name of the test result.
  24. ///</returns>
  25. string FullName { get; }
  26. ///<summary>
  27. ///Gets the state of the result as a string.
  28. ///</summary>
  29. ///<returns>
  30. ///It returns one of these values: `Inconclusive`, `Skipped`, `Skipped:Ignored`, `Skipped:Explicit`, `Passed`, `Failed`, `Failed:Error`, `Failed:Cancelled`, `Failed:Invalid`
  31. ///</returns>
  32. string ResultState { get; }
  33. ///<summary>
  34. ///Gets the status of the test as an enum.
  35. ///</summary>
  36. ///<returns>
  37. ///It returns one of these values:`Inconclusive`, `Skipped`, `Passed`, or `Failed`
  38. ///</returns>
  39. TestStatus TestStatus { get; }
  40. /// <summary>
  41. /// Gets the elapsed time for running the test in seconds
  42. /// </summary>
  43. /// <returns>
  44. /// Time in seconds.
  45. /// </returns>
  46. double Duration { get; }
  47. /// <summary>
  48. /// Gets or sets the time the test started running.
  49. /// </summary>
  50. ///<returns>
  51. ///A DataTime object.
  52. ///</returns>
  53. DateTime StartTime { get; }
  54. ///<summary>
  55. ///Gets or sets the time the test finished running.
  56. ///</summary>
  57. ///<returns>
  58. ///A DataTime object.
  59. ///</returns>
  60. DateTime EndTime { get; }
  61. /// <summary>
  62. /// The message associated with a test failure or with not running the test
  63. /// </summary>
  64. string Message { get; }
  65. /// <summary>
  66. /// Any stacktrace associated with an error or failure. Not available in the Compact Framework 1.0.
  67. /// </summary>
  68. string StackTrace { get; }
  69. /// <summary>
  70. /// The number of asserts executed when running the test and all its children.
  71. /// </summary>
  72. int AssertCount { get; }
  73. /// <summary>
  74. /// The number of test cases that failed when running the test and all its children.
  75. /// </summary>
  76. int FailCount { get; }
  77. /// <summary>
  78. /// The number of test cases that passed when running the test and all its children.
  79. /// </summary>
  80. int PassCount { get; }
  81. /// <summary>
  82. /// The number of test cases that were skipped when running the test and all its children.
  83. /// </summary>
  84. int SkipCount { get; }
  85. /// <summary>
  86. ///The number of test cases that were inconclusive when running the test and all its children.
  87. /// </summary>
  88. int InconclusiveCount { get; }
  89. /// <summary>
  90. /// Accessing HasChildren should not force creation of the Children collection in classes implementing this interface.
  91. /// </summary>
  92. /// <returns>True if this result has any child results.</returns>
  93. bool HasChildren { get; }
  94. /// <summary>
  95. /// Gets the the collection of child results.
  96. /// </summary>
  97. IEnumerable<ITestResultAdaptor> Children { get; }
  98. /// <summary>
  99. /// Gets any text output written to this result.
  100. /// </summary>
  101. string Output { get; }
  102. /// <summary>
  103. /// Use this to save the results to an XML file
  104. /// </summary>
  105. /// <returns>
  106. /// The test results as an `NUnit` XML node.
  107. /// </returns>
  108. TNode ToXml();
  109. }
  110. }