No Description
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.

GenerateContextTask.cs 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using System.Collections;
  3. using System.Linq;
  4. using UnityEditor.TestTools.TestRunner.UnityTestProtocol;
  5. using UnityEngine;
  6. using UnityEngine.TestRunner.NUnitExtensions.Runner;
  7. using UnityEngine.TestTools;
  8. namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks
  9. {
  10. internal class GenerateContextTask : TestTaskBase
  11. {
  12. public GenerateContextTask()
  13. {
  14. RerunAfterResume = true;
  15. }
  16. public override IEnumerator Execute(TestJobData testJobData)
  17. {
  18. if (testJobData.taskInfoStack.Peek().taskMode == TaskMode.Normal)
  19. {
  20. testJobData.setUpTearDownState = new BeforeAfterTestCommandState();
  21. testJobData.outerUnityTestActionState = new BeforeAfterTestCommandState();
  22. testJobData.enumerableTestState = new EnumerableTestState();
  23. }
  24. testJobData.Context = new UnityTestExecutionContext()
  25. {
  26. SetUpTearDownState = testJobData.setUpTearDownState,
  27. OuterUnityTestActionState = testJobData.outerUnityTestActionState,
  28. EnumerableTestState = testJobData.enumerableTestState,
  29. Automated = UnityTestProtocolStarter.IsEnabled(),
  30. RetryCount = testJobData.executionSettings.retryCount,
  31. RepeatCount = testJobData.executionSettings.repeatCount,
  32. RetryRepeatState = testJobData.RetryRepeatState
  33. };
  34. if (testJobData.executionSettings.ignoreTests != null)
  35. {
  36. testJobData.Context.IgnoreTests = testJobData.executionSettings.ignoreTests.Select(ignoreTest => ignoreTest.ParseToEngine()).ToArray();
  37. }
  38. testJobData.Context.FeatureFlags = testJobData.executionSettings.featureFlags;
  39. UnityTestExecutionContext.CurrentContext = testJobData.Context;
  40. yield break;
  41. }
  42. }
  43. }