RemoteTestData.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Linq;
  3. using NUnit.Framework.Interfaces;
  4. using NUnit.Framework.Internal;
  5. using UnityEngine.TestRunner.NUnitExtensions;
  6. namespace UnityEngine.TestRunner.TestLaunchers
  7. {
  8. [Serializable]
  9. internal class RemoteTestData
  10. {
  11. public string id;
  12. public string name;
  13. public string fullName;
  14. public int testCaseCount;
  15. public int ChildIndex;
  16. public bool hasChildren;
  17. public bool isSuite;
  18. public string[] childrenIds;
  19. public int testCaseTimeout;
  20. public string[] Categories;
  21. public bool IsTestAssembly;
  22. public RunState RunState;
  23. public string Description;
  24. public string SkipReason;
  25. public string ParentId;
  26. public string UniqueName;
  27. public string ParentUniqueName;
  28. public string ParentFullName;
  29. internal RemoteTestData(ITest test)
  30. {
  31. id = test.Id;
  32. name = test.Name;
  33. fullName = test.FullName;
  34. testCaseCount = test.TestCaseCount;
  35. ChildIndex = -1;
  36. if (test.Properties["childIndex"].Count > 0)
  37. {
  38. ChildIndex = (int)test.Properties["childIndex"][0];
  39. }
  40. hasChildren = test.HasChildren;
  41. isSuite = test.IsSuite;
  42. childrenIds = test.Tests.Select(t => t.Id).ToArray();
  43. Categories = test.GetAllCategoriesFromTest().ToArray();
  44. IsTestAssembly = test is TestAssembly;
  45. RunState = (RunState)Enum.Parse(typeof(RunState), test.RunState.ToString());
  46. Description = (string)test.Properties.Get(PropertyNames.Description);
  47. SkipReason = test.GetSkipReason();
  48. ParentId = test.GetParentId();
  49. UniqueName = test.GetUniqueName();
  50. ParentUniqueName = test.GetParentUniqueName();
  51. ParentFullName = test.GetParentFullName();
  52. }
  53. }
  54. }