From c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sun, 19 Apr 2020 17:19:32 -0400 Subject: Inital commit --- .../com.unity.test-framework@1.1.11/CHANGELOG.md | 112 +++++ .../CHANGELOG.md.meta | 7 + .../CONTRIBUTING.md | 9 + .../CONTRIBUTING.md.meta | 7 + .../Documentation~/TableOfContents.md | 66 +++ .../Documentation~/edit-mode-vs-play-mode-tests.md | 53 +++ .../Documentation~/extending.md | 10 + .../Documentation~/extension-get-test-results.md | 45 ++ .../Documentation~/extension-retrieve-test-list.md | 13 + .../Documentation~/extension-run-tests.md | 72 +++ .../Documentation~/getting-started.md | 18 + .../images/editmode-create-test-script.png | Bin 0 -> 17180 bytes .../Documentation~/images/editmode-run-test.png | Bin 0 -> 30337 bytes .../Documentation~/images/editmode-run-tests.png | Bin 0 -> 25209 bytes .../Documentation~/images/editmode-tab.png | Bin 0 -> 25740 bytes .../Documentation~/images/import-settings.png | Bin 0 -> 48913 bytes .../Documentation~/images/new-test-script.png | Bin 0 -> 25943 bytes .../Documentation~/images/playmode-enable-all.png | Bin 0 -> 43884 bytes .../images/playmode-results-standalone.png | Bin 0 -> 30034 bytes .../images/playmode-run-standalone.png | Bin 0 -> 17677 bytes .../Documentation~/images/playmode-tab.png | Bin 0 -> 42321 bytes .../Documentation~/images/test-runner-window.png | Bin 0 -> 84317 bytes .../Documentation~/images/test-templates.png | Bin 0 -> 28115 bytes .../images/tests-folder-assembly.png | Bin 0 -> 15397 bytes .../Documentation~/index.md | 54 +++ .../Documentation~/manual.md | 80 ++++ .../reference-actions-outside-tests.md | 98 ++++ .../reference-attribute-conditionalignore.md | 39 ++ .../reference-attribute-testmustexpectalllogs.md | 11 + .../reference-attribute-testplayerbuildmodifier.md | 105 +++++ .../reference-attribute-testruncallback.md | 46 ++ .../reference-attribute-unityplatform.md | 35 ++ .../reference-attribute-unitytest.md | 51 ++ .../Documentation~/reference-command-line.md | 116 +++++ .../Documentation~/reference-comparer-color.md | 47 ++ .../Documentation~/reference-comparer-equals.md | 27 ++ .../Documentation~/reference-comparer-float.md | 46 ++ .../reference-comparer-quaternion.md | 46 ++ .../Documentation~/reference-comparer-vector2.md | 47 ++ .../Documentation~/reference-comparer-vector3.md | 47 ++ .../Documentation~/reference-comparer-vector4.md | 47 ++ .../Documentation~/reference-custom-assertion.md | 66 +++ .../Documentation~/reference-custom-attributes.md | 15 + .../Documentation~/reference-custom-constraints.md | 31 ++ .../reference-custom-equality-comparers.md | 32 ++ .../reference-custom-yield-instructions.md | 60 +++ .../Documentation~/reference-execution-settings.md | 17 + .../Documentation~/reference-filter.md | 15 + .../Documentation~/reference-icallbacks.md | 48 ++ .../Documentation~/reference-ierror-callbacks.md | 9 + .../Documentation~/reference-itest-adaptor.md | 31 ++ .../reference-itest-result-adaptor.md | 25 + .../Documentation~/reference-itest-run-settings.md | 29 ++ .../Documentation~/reference-recompile-scripts.md | 22 + .../Documentation~/reference-setup-and-cleanup.md | 91 ++++ .../Documentation~/reference-test-runner-api.md | 23 + .../Documentation~/reference-test-utils.md | 40 ++ .../reference-tests-monobehaviour.md | 51 ++ .../reference-tests-parameterized.md | 18 + .../reference-wait-for-domain-reload.md | 19 + .../Documentation~/resources.md | 6 + .../workflow-create-playmode-test.md | 28 ++ .../workflow-create-test-assembly.md | 17 + .../Documentation~/workflow-create-test.md | 36 ++ .../workflow-run-playmode-test-standalone.md | 21 + .../Documentation~/workflow-run-test.md | 19 + .../com.unity.test-framework@1.1.11/LICENSE.md | 5 + .../LICENSE.md.meta | 7 + .../UnityEditor.TestRunner.meta | 8 + .../UnityEditor.TestRunner/Api.meta | 8 + .../Api/CallbacksDelegator.cs | 136 ++++++ .../Api/CallbacksDelegator.cs.meta | 11 + .../Api/CallbacksDelegatorListener.cs | 28 ++ .../Api/CallbacksDelegatorListener.cs.meta | 11 + .../UnityEditor.TestRunner/Api/CallbacksHolder.cs | 69 +++ .../Api/CallbacksHolder.cs.meta | 11 + .../Api/ExecutionSettings.cs | 57 +++ .../Api/ExecutionSettings.cs.meta | 11 + .../UnityEditor.TestRunner/Api/Filter.cs | 81 ++++ .../UnityEditor.TestRunner/Api/Filter.cs.meta | 11 + .../UnityEditor.TestRunner/Api/ICallbacks.cs | 10 + .../UnityEditor.TestRunner/Api/ICallbacks.cs.meta | 11 + .../Api/ICallbacksDelegator.cs | 18 + .../Api/ICallbacksDelegator.cs.meta | 11 + .../UnityEditor.TestRunner/Api/ICallbacksHolder.cs | 10 + .../Api/ICallbacksHolder.cs.meta | 11 + .../UnityEditor.TestRunner/Api/IErrorCallbacks.cs | 7 + .../Api/IErrorCallbacks.cs.meta | 11 + .../UnityEditor.TestRunner/Api/ITestAdaptor.cs | 31 ++ .../Api/ITestAdaptor.cs.meta | 11 + .../Api/ITestAdaptorFactory.cs | 18 + .../Api/ITestAdaptorFactory.cs.meta | 11 + .../Api/ITestResultAdaptor.cs | 86 ++++ .../Api/ITestResultAdaptor.cs.meta | 11 + .../UnityEditor.TestRunner/Api/ITestRunSettings.cs | 9 + .../Api/ITestRunSettings.cs.meta | 11 + .../UnityEditor.TestRunner/Api/ITestRunnerApi.cs | 12 + .../Api/ITestRunnerApi.cs.meta | 11 + .../Api/ITestTreeRebuildCallbacks.cs | 7 + .../Api/ITestTreeRebuildCallbacks.cs.meta | 11 + .../UnityEditor.TestRunner/Api/RunState.cs | 11 + .../UnityEditor.TestRunner/Api/RunState.cs.meta | 11 + .../UnityEditor.TestRunner/Api/TestAdaptor.cs | 142 ++++++ .../UnityEditor.TestRunner/Api/TestAdaptor.cs.meta | 11 + .../Api/TestAdaptorFactory.cs | 91 ++++ .../Api/TestAdaptorFactory.cs.meta | 11 + .../UnityEditor.TestRunner/Api/TestMode.cs | 11 + .../UnityEditor.TestRunner/Api/TestMode.cs.meta | 11 + .../Api/TestResultAdaptor.cs | 87 ++++ .../Api/TestResultAdaptor.cs.meta | 11 + .../UnityEditor.TestRunner/Api/TestRunnerApi.cs | 120 +++++ .../Api/TestRunnerApi.cs.meta | 11 + .../UnityEditor.TestRunner/Api/TestStatus.cs | 10 + .../UnityEditor.TestRunner/Api/TestStatus.cs.meta | 11 + .../UnityEditor.TestRunner/AssemblyInfo.cs | 15 + .../UnityEditor.TestRunner/AssemblyInfo.cs.meta | 11 + .../UnityEditor.TestRunner/CommandLineParser.meta | 8 + .../CommandLineParser/CommandLineOption.cs | 45 ++ .../CommandLineParser/CommandLineOption.cs.meta | 11 + .../CommandLineParser/CommandLineOptionSet.cs | 49 ++ .../CommandLineParser/CommandLineOptionSet.cs.meta | 11 + .../CommandLineParser/ICommandLineOption.cs | 8 + .../CommandLineParser/ICommandLineOption.cs.meta | 11 + .../UnityEditor.TestRunner/CommandLineTest.meta | 8 + .../CommandLineTest/Executer.cs | 134 ++++++ .../CommandLineTest/Executer.cs.meta | 11 + .../CommandLineTest/ExecutionSettings.cs | 11 + .../CommandLineTest/ExecutionSettings.cs.meta | 11 + .../CommandLineTest/ExitCallbacks.cs | 53 +++ .../CommandLineTest/ExitCallbacks.cs.meta | 11 + .../CommandLineTest/ISettingsBuilder.cs | 10 + .../CommandLineTest/ISettingsBuilder.cs.meta | 11 + .../CommandLineTest/LogSavingCallbacks.cs | 29 ++ .../CommandLineTest/LogSavingCallbacks.cs.meta | 11 + .../CommandLineTest/LogWriter.cs | 92 ++++ .../CommandLineTest/LogWriter.cs.meta | 11 + .../CommandLineTest/ResultsSavingCallbacks.cs | 50 ++ .../CommandLineTest/ResultsSavingCallbacks.cs.meta | 11 + .../CommandLineTest/ResultsWriter.cs | 103 ++++ .../CommandLineTest/ResultsWriter.cs.meta | 11 + .../CommandLineTest/RunData.cs | 8 + .../CommandLineTest/RunData.cs.meta | 11 + .../CommandLineTest/RunSettings.cs | 29 ++ .../CommandLineTest/RunSettings.cs.meta | 11 + .../CommandLineTest/SettingsBuilder.cs | 185 ++++++++ .../CommandLineTest/SettingsBuilder.cs.meta | 11 + .../CommandLineTest/SetupException.cs | 23 + .../CommandLineTest/SetupException.cs.meta | 11 + .../CommandLineTest/TestStarter.cs | 80 ++++ .../CommandLineTest/TestStarter.cs.meta | 11 + .../UnityEditor.TestRunner/GUI.meta | 8 + .../GUI/AssetsDatabaseHelper.cs | 11 + .../GUI/AssetsDatabaseHelper.cs.meta | 11 + .../UnityEditor.TestRunner/GUI/GuiHelper.cs | 101 ++++ .../UnityEditor.TestRunner/GUI/GuiHelper.cs.meta | 11 + .../GUI/IAssetsDatabaseHelper.cs | 7 + .../GUI/IAssetsDatabaseHelper.cs.meta | 11 + .../UnityEditor.TestRunner/GUI/IGuiHelper.cs | 13 + .../UnityEditor.TestRunner/GUI/IGuiHelper.cs.meta | 11 + .../GUI/TestListBuilder.meta | 8 + .../GUI/TestListBuilder/RenderingOptions.cs | 12 + .../GUI/TestListBuilder/RenderingOptions.cs.meta | 11 + .../GUI/TestListBuilder/ResultSummarizer.cs | 175 +++++++ .../GUI/TestListBuilder/ResultSummarizer.cs.meta | 11 + .../GUI/TestListBuilder/TestFilterSettings.cs | 105 +++++ .../GUI/TestListBuilder/TestFilterSettings.cs.meta | 11 + .../GUI/TestListBuilder/TestTreeViewBuilder.cs | 111 +++++ .../TestListBuilder/TestTreeViewBuilder.cs.meta | 11 + .../GUI/TestListGuiHelper.cs | 135 ++++++ .../GUI/TestListGuiHelper.cs.meta | 11 + .../GUI/TestListTreeView.meta | 8 + .../GUI/TestListTreeView/Icons.cs | 24 + .../GUI/TestListTreeView/Icons.cs.meta | 11 + .../TestListTreeView/TestListTreeViewDataSource.cs | 99 ++++ .../TestListTreeViewDataSource.cs.meta | 11 + .../GUI/TestListTreeView/TestListTreeViewGUI.cs | 11 + .../TestListTreeView/TestListTreeViewGUI.cs.meta | 11 + .../GUI/TestListTreeView/TestTreeViewItem.cs | 118 +++++ .../GUI/TestListTreeView/TestTreeViewItem.cs.meta | 11 + .../UnityEditor.TestRunner/GUI/TestRunnerResult.cs | 149 ++++++ .../GUI/TestRunnerResult.cs.meta | 11 + .../GUI/TestRunnerUIFilter.cs | 178 +++++++ .../GUI/TestRunnerUIFilter.cs.meta | 11 + .../UnityEditor.TestRunner/GUI/Views.meta | 8 + .../GUI/Views/EditModeTestListGUI.cs | 93 ++++ .../GUI/Views/EditModeTestListGUI.cs.meta | 11 + .../GUI/Views/PlayModeTestListGUI.cs | 111 +++++ .../GUI/Views/PlayModeTestListGUI.cs.meta | 11 + .../GUI/Views/TestListGUIBase.cs | 525 +++++++++++++++++++++ .../GUI/Views/TestListGUIBase.cs.meta | 11 + .../UnityEditor.TestRunner/NUnitExtension.meta | 8 + .../NUnitExtension/Attributes.meta | 8 + .../Attributes/AssetPipelineIgnore.cs | 63 +++ .../Attributes/AssetPipelineIgnore.cs.meta | 11 + .../Attributes/ITestPlayerBuildModifier.cs | 7 + .../Attributes/ITestPlayerBuildModifier.cs.meta | 11 + .../Attributes/TestPlayerBuildModifierAttribute.cs | 25 + .../TestPlayerBuildModifierAttribute.cs.meta | 11 + .../NUnitExtension/TestRunnerStateSerializer.cs | 162 +++++++ .../TestRunnerStateSerializer.cs.meta | 11 + .../RequireApiProfileAttribute.cs | 32 ++ .../RequireApiProfileAttribute.cs.meta | 11 + .../RequirePlatformSupportAttribute.cs | 33 ++ .../RequirePlatformSupportAttribute.cs.meta | 11 + .../TestBuildAssemblyFilter.cs | 22 + .../TestBuildAssemblyFilter.cs.meta | 11 + .../UnityEditor.TestRunner/TestLaunchers.meta | 8 + .../TestLaunchers/AttributeFinderBase.cs | 104 ++++ .../TestLaunchers/AttributeFinderBase.cs.meta | 11 + .../TestLaunchers/EditModeLauncher.cs | 160 +++++++ .../TestLaunchers/EditModeLauncher.cs.meta | 11 + .../EditModeLauncherContextSettings.cs | 31 ++ .../EditModeLauncherContextSettings.cs.meta | 11 + .../TestLaunchers/PlatformSetup.meta | 8 + .../PlatformSetup/AndroidPlatformSetup.cs | 66 +++ .../PlatformSetup/AndroidPlatformSetup.cs.meta | 11 + .../PlatformSetup/ApplePlatformSetup.cs | 42 ++ .../PlatformSetup/ApplePlatformSetup.cs.meta | 11 + .../TestLaunchers/PlatformSetup/IPlatformSetup.cs | 11 + .../PlatformSetup/IPlatformSetup.cs.meta | 11 + .../PlatformSetup/LuminPlatformSetup.cs | 50 ++ .../PlatformSetup/LuminPlatformSetup.cs.meta | 11 + .../PlatformSetup/PlatformSpecificSetup.cs | 117 +++++ .../PlatformSetup/PlatformSpecificSetup.cs.meta | 11 + .../PlatformSetup/SwitchPlatformSetup.cs | 41 ++ .../PlatformSetup/SwitchPlatformSetup.cs.meta | 11 + .../PlatformSetup/UwpPlatformSetup.cs | 52 ++ .../PlatformSetup/UwpPlatformSetup.cs.meta | 11 + .../PlatformSetup/XboxOnePlatformSetup.cs | 47 ++ .../PlatformSetup/XboxOnePlatformSetup.cs.meta | 11 + .../TestLaunchers/PlayerLauncher.cs | 216 +++++++++ .../TestLaunchers/PlayerLauncher.cs.meta | 11 + .../TestLaunchers/PlayerLauncherBuildOptions.cs | 23 + .../PlayerLauncherBuildOptions.cs.meta | 11 + .../TestLaunchers/PlayerLauncherContextSettings.cs | 112 +++++ .../PlayerLauncherContextSettings.cs.meta | 11 + .../TestLaunchers/PlaymodeLauncher.cs | 133 ++++++ .../TestLaunchers/PlaymodeLauncher.cs.meta | 11 + .../PostbuildCleanupAttributeFinder.cs | 9 + .../PostbuildCleanupAttributeFinder.cs.meta | 11 + .../TestLaunchers/PrebuildSetupAttributeFinder.cs | 9 + .../PrebuildSetupAttributeFinder.cs.meta | 11 + .../TestLaunchers/RemotePlayerLogController.cs | 83 ++++ .../RemotePlayerLogController.cs.meta | 11 + .../TestLaunchers/RemotePlayerTestController.cs | 110 +++++ .../RemotePlayerTestController.cs.meta | 11 + .../TestLaunchers/RemoteTestResultReciever.cs | 22 + .../TestLaunchers/RemoteTestResultReciever.cs.meta | 11 + .../TestLaunchers/RuntimeTestLauncherBase.cs | 92 ++++ .../TestLaunchers/RuntimeTestLauncherBase.cs.meta | 11 + .../TestLaunchers/TestLauncherBase.cs | 85 ++++ .../TestLaunchers/TestLauncherBase.cs.meta | 11 + .../UnityEditor.TestRunner/TestResultSerializer.cs | 71 +++ .../TestResultSerializer.cs.meta | 11 + .../UnityEditor.TestRunner/TestRun.meta | 8 + .../UnityEditor.TestRunner/TestRun/Tasks.meta | 8 + .../TestRun/Tasks/BuildActionTaskBase.cs | 86 ++++ .../TestRun/Tasks/BuildActionTaskBase.cs.meta | 11 + .../TestRun/Tasks/BuildTestTreeTask.cs | 61 +++ .../TestRun/Tasks/BuildTestTreeTask.cs.meta | 11 + .../TestRun/Tasks/CleanupVerificationTask.cs | 47 ++ .../TestRun/Tasks/CleanupVerificationTask.cs.meta | 11 + .../TestRun/Tasks/FileCleanupVerifierTaskBase.cs | 14 + .../Tasks/FileCleanupVerifierTaskBase.cs.meta | 11 + .../TestRun/Tasks/LegacyEditModeRunTask.cs | 26 + .../TestRun/Tasks/LegacyEditModeRunTask.cs.meta | 11 + .../TestRun/Tasks/LegacyPlayModeRunTask.cs | 26 + .../TestRun/Tasks/LegacyPlayModeRunTask.cs.meta | 11 + .../TestRun/Tasks/LegacyPlayerRunTask.cs | 18 + .../TestRun/Tasks/LegacyPlayerRunTask.cs.meta | 11 + .../TestRun/Tasks/PerformUndoTask.cs | 39 ++ .../TestRun/Tasks/PerformUndoTask.cs.meta | 11 + .../TestRun/Tasks/PrebuildSetupTask.cs | 20 + .../TestRun/Tasks/PrebuildSetupTask.cs.meta | 11 + .../RegisterFilesForCleanupVerificationTask.cs | 13 + ...RegisterFilesForCleanupVerificationTask.cs.meta | 11 + .../TestRun/Tasks/SaveModiedSceneTask.cs | 22 + .../TestRun/Tasks/SaveModiedSceneTask.cs.meta | 11 + .../TestRun/Tasks/SaveUndoIndexTask.cs | 15 + .../TestRun/Tasks/SaveUndoIndexTask.cs.meta | 11 + .../TestRun/Tasks/TestTaskBase.cs | 16 + .../TestRun/Tasks/TestTaskBase.cs.meta | 11 + .../UnityEditor.TestRunner/TestRun/TestJobData.cs | 49 ++ .../TestRun/TestJobData.cs.meta | 11 + .../TestRun/TestJobDataHolder.cs | 28 ++ .../TestRun/TestJobDataHolder.cs.meta | 11 + .../TestRun/TestJobRunner.cs | 166 +++++++ .../TestRun/TestJobRunner.cs.meta | 11 + .../TestRun/TestRunCanceledException.cs | 9 + .../TestRun/TestRunCanceledException.cs.meta | 11 + .../UnityEditor.TestRunner/TestRunner.meta | 8 + .../TestRunner/Callbacks.meta | 8 + .../TestRunner/Callbacks/EditModeRunnerCallback.cs | 178 +++++++ .../Callbacks/EditModeRunnerCallback.cs.meta | 11 + .../TestRunner/Callbacks/RerunCallback.cs | 86 ++++ .../TestRunner/Callbacks/RerunCallback.cs.meta | 11 + .../TestRunner/Callbacks/RerunCallbackData.cs | 15 + .../TestRunner/Callbacks/RerunCallbackData.cs.meta | 11 + .../Callbacks/RerunCallbackInitializer.cs | 17 + .../Callbacks/RerunCallbackInitializer.cs.meta | 11 + .../TestRunner/Callbacks/TestRunnerCallback.cs | 37 ++ .../Callbacks/TestRunnerCallback.cs.meta | 11 + .../TestRunner/Callbacks/WindowResultUpdater.cs | 44 ++ .../Callbacks/WindowResultUpdater.cs.meta | 11 + .../TestRunner/EditModePCHelper.cs | 32 ++ .../TestRunner/EditModePCHelper.cs.meta | 11 + .../TestRunner/EditModeRunner.cs | 438 +++++++++++++++++ .../TestRunner/EditModeRunner.cs.meta | 11 + .../TestRunner/EditmodeWorkItemFactory.cs | 14 + .../TestRunner/EditmodeWorkItemFactory.cs.meta | 11 + .../TestRunner/EditorEnumeratorTestWorkItem.cs | 179 +++++++ .../EditorEnumeratorTestWorkItem.cs.meta | 11 + .../TestRunner/EnumeratorStepHelper.cs | 51 ++ .../TestRunner/EnumeratorStepHelper.cs.meta | 11 + .../TestRunner/Messages.meta | 8 + .../TestRunner/Messages/EnterPlayMode.cs | 39 ++ .../TestRunner/Messages/EnterPlayMode.cs.meta | 11 + .../TestRunner/Messages/ExitPlayMode.cs | 32 ++ .../TestRunner/Messages/ExitPlayMode.cs.meta | 11 + .../TestRunner/Messages/RecompileScripts.cs | 63 +++ .../TestRunner/Messages/RecompileScripts.cs.meta | 11 + .../TestRunner/Messages/WaitForDomainReload.cs | 44 ++ .../Messages/WaitForDomainReload.cs.meta | 11 + .../UnityEditor.TestRunner/TestRunner/Utils.meta | 8 + .../TestRunner/Utils/CachingTestListProvider.cs | 48 ++ .../Utils/CachingTestListProvider.cs.meta | 11 + .../TestRunner/Utils/EditorAssembliesProxy.cs | 13 + .../TestRunner/Utils/EditorAssembliesProxy.cs.meta | 11 + .../TestRunner/Utils/EditorAssemblyWrapper.cs | 18 + .../TestRunner/Utils/EditorAssemblyWrapper.cs.meta | 11 + .../Utils/EditorCompilationInterfaceProxy.cs | 17 + .../Utils/EditorCompilationInterfaceProxy.cs.meta | 11 + .../Utils/EditorLoadedTestAssemblyProvider.cs | 69 +++ .../Utils/EditorLoadedTestAssemblyProvider.cs.meta | 11 + .../TestRunner/Utils/IEditorAssembliesProxy.cs | 9 + .../Utils/IEditorAssembliesProxy.cs.meta | 11 + .../Utils/IEditorCompilationInterfaceProxy.cs | 10 + .../Utils/IEditorCompilationInterfaceProxy.cs.meta | 11 + .../Utils/IEditorLoadedTestAssemblyProvider.cs | 12 + .../IEditorLoadedTestAssemblyProvider.cs.meta | 11 + .../TestRunner/Utils/ITestListCache.cs | 13 + .../TestRunner/Utils/ITestListCache.cs.meta | 11 + .../TestRunner/Utils/ITestListCacheData.cs | 13 + .../TestRunner/Utils/ITestListCacheData.cs.meta | 11 + .../TestRunner/Utils/ITestListProvider.cs | 11 + .../TestRunner/Utils/ITestListProvider.cs.meta | 11 + .../TestRunner/Utils/TestListCache.cs | 56 +++ .../TestRunner/Utils/TestListCache.cs.meta | 11 + .../TestRunner/Utils/TestListCacheData.cs | 27 ++ .../TestRunner/Utils/TestListCacheData.cs.meta | 11 + .../TestRunner/Utils/TestListJob.cs | 36 ++ .../TestRunner/Utils/TestListJob.cs.meta | 11 + .../TestRunner/Utils/TestListProvider.cs | 42 ++ .../TestRunner/Utils/TestListProvider.cs.meta | 11 + .../UnityEditor.TestRunner/TestRunnerWindow.cs | 263 +++++++++++ .../TestRunnerWindow.cs.meta | 11 + .../TestRunnerWindowSettings.cs | 26 + .../TestRunnerWindowSettings.cs.meta | 11 + .../UnityEditor.TestRunner/TestSettings.meta | 8 + .../TestSettings/ITestSettings.cs | 22 + .../TestSettings/ITestSettings.cs.meta | 11 + .../TestSettings/ITestSettingsDeserializer.cs | 7 + .../TestSettings/ITestSettingsDeserializer.cs.meta | 11 + .../TestSettings/TestSettings.cs | 160 +++++++ .../TestSettings/TestSettings.cs.meta | 11 + .../TestSettings/TestSettingsDeserializer.cs | 130 +++++ .../TestSettings/TestSettingsDeserializer.cs.meta | 11 + .../UnityEditor.TestRunner.asmdef | 21 + .../UnityEditor.TestRunner.asmdef.meta | 7 + .../UnityEditor.TestRunner/UnityTestProtocol.meta | 8 + .../AssemblyCompilationErrorsMessage.cs | 13 + .../AssemblyCompilationErrorsMessage.cs.meta | 11 + .../UnityTestProtocol/ITestRunnerApiMapper.cs | 15 + .../UnityTestProtocol/ITestRunnerApiMapper.cs.meta | 11 + .../UnityTestProtocol/IUtpLogger.cs | 7 + .../UnityTestProtocol/IUtpLogger.cs.meta | 11 + .../UnityTestProtocol/IUtpMessageReporter.cs | 14 + .../UnityTestProtocol/IUtpMessageReporter.cs.meta | 11 + .../UnityTestProtocol/Message.cs | 29 ++ .../UnityTestProtocol/Message.cs.meta | 11 + .../UnityTestProtocol/TestFinishedMessage.cs | 18 + .../UnityTestProtocol/TestFinishedMessage.cs.meta | 11 + .../UnityTestProtocol/TestPlanMessage.cs | 14 + .../UnityTestProtocol/TestPlanMessage.cs.meta | 11 + .../UnityTestProtocol/TestRunnerApiMapper.cs | 99 ++++ .../UnityTestProtocol/TestRunnerApiMapper.cs.meta | 11 + .../UnityTestProtocol/TestStartedMessage.cs | 15 + .../UnityTestProtocol/TestStartedMessage.cs.meta | 11 + .../UnityTestProtocol/TestState.cs | 13 + .../UnityTestProtocol/TestState.cs.meta | 11 + .../UnityTestProtocol/UnityTestProtocolListener.cs | 35 ++ .../UnityTestProtocolListener.cs.meta | 11 + .../UnityTestProtocol/UnityTestProtocolStarter.cs | 37 ++ .../UnityTestProtocolStarter.cs.meta | 11 + .../UnityTestProtocol/UtpDebuglogger.cs | 13 + .../UnityTestProtocol/UtpDebuglogger.cs.meta | 11 + .../UnityTestProtocol/UtpMessageReporter.cs | 57 +++ .../UnityTestProtocol/UtpMessageReporter.cs.meta | 11 + .../UnityEngine.TestRunner.meta | 8 + .../UnityEngine.TestRunner/AssemblyInfo.cs | 16 + .../UnityEngine.TestRunner/AssemblyInfo.cs.meta | 11 + .../UnityEngine.TestRunner/Assertions.meta | 8 + .../Assertions/AllocatingGCMemoryConstraint.cs | 83 ++++ .../AllocatingGCMemoryConstraint.cs.meta | 11 + .../Assertions/ConstraintsExtensions.cs | 14 + .../Assertions/ConstraintsExtensions.cs.meta | 11 + .../Assertions/InvalidSignatureException.cs | 18 + .../Assertions/InvalidSignatureException.cs.meta | 11 + .../UnityEngine.TestRunner/Assertions/Is.cs | 10 + .../UnityEngine.TestRunner/Assertions/Is.cs.meta | 11 + .../UnityEngine.TestRunner/Assertions/LogAssert.cs | 39 ++ .../Assertions/LogAssert.cs.meta | 11 + .../Assertions/LogScope.meta | 8 + .../Assertions/LogScope/ILogScope.cs | 22 + .../Assertions/LogScope/ILogScope.cs.meta | 11 + .../Assertions/LogScope/LogEvent.cs | 18 + .../Assertions/LogScope/LogEvent.cs.meta | 11 + .../Assertions/LogScope/LogMatch.cs | 103 ++++ .../Assertions/LogScope/LogMatch.cs.meta | 11 + .../Assertions/LogScope/LogScope.cs | 223 +++++++++ .../Assertions/LogScope/LogScope.cs.meta | 11 + .../Assertions/UnexpectedLogMessageException.cs | 29 ++ .../UnexpectedLogMessageException.cs.meta | 11 + .../Assertions/UnhandledLogMessageException.cs | 35 ++ .../UnhandledLogMessageException.cs.meta | 11 + .../Assertions/UnityTestTimeoutException.cs | 28 ++ .../Assertions/UnityTestTimeoutException.cs.meta | 11 + .../UnityEngine.TestRunner/NUnitExtensions.meta | 8 + .../NUnitExtensions/ActionDelegator.cs | 79 ++++ .../NUnitExtensions/ActionDelegator.cs.meta | 11 + .../NUnitExtensions/Attributes.meta | 8 + .../Attributes/ConditionalIgnoreAttribute.cs | 36 ++ .../Attributes/ConditionalIgnoreAttribute.cs.meta | 11 + .../NUnitExtensions/Attributes/TestEnumerator.cs | 52 ++ .../Attributes/TestEnumerator.cs.meta | 11 + .../Attributes/TestMustExpectAllLogsAttribute.cs | 28 ++ .../TestMustExpectAllLogsAttribute.cs.meta | 11 + .../Attributes/UnityCombinatorialStrategy.cs | 20 + .../Attributes/UnityCombinatorialStrategy.cs.meta | 11 + .../Attributes/UnityPlatformAttribute.cs | 56 +++ .../Attributes/UnityPlatformAttribute.cs.meta | 11 + .../Attributes/UnitySetUpAttribute.cs | 10 + .../Attributes/UnitySetUpAttribute.cs.meta | 11 + .../Attributes/UnityTearDownAttribute.cs | 10 + .../Attributes/UnityTearDownAttribute.cs.meta | 11 + .../Attributes/UnityTestAttribute.cs | 33 ++ .../Attributes/UnityTestAttribute.cs.meta | 11 + .../NUnitExtensions/BaseDelegator.cs | 58 +++ .../NUnitExtensions/BaseDelegator.cs.meta | 11 + .../NUnitExtensions/Commands.meta | 8 + .../Commands/BeforeAfterTestCommandBase.cs | 196 ++++++++ .../Commands/BeforeAfterTestCommandBase.cs.meta | 11 + .../Commands/BeforeAfterTestCommandState.cs | 49 ++ .../Commands/BeforeAfterTestCommandState.cs.meta | 11 + .../EnumerableApplyChangesToContextCommand.cs | 34 ++ .../EnumerableApplyChangesToContextCommand.cs.meta | 11 + .../Commands/EnumerableRepeatedTestCommand.cs | 60 +++ .../Commands/EnumerableRepeatedTestCommand.cs.meta | 11 + .../Commands/EnumerableRetryTestCommand.cs | 60 +++ .../Commands/EnumerableRetryTestCommand.cs.meta | 11 + .../Commands/EnumerableSetUpTearDownCommand.cs | 44 ++ .../EnumerableSetUpTearDownCommand.cs.meta | 11 + .../Commands/EnumerableTestMethodCommand.cs | 86 ++++ .../Commands/EnumerableTestMethodCommand.cs.meta | 11 + .../Commands/ImmediateEnumerableCommand.cs | 32 ++ .../Commands/ImmediateEnumerableCommand.cs.meta | 11 + .../Commands/OuterUnityTestActionCommand.cs | 49 ++ .../Commands/OuterUnityTestActionCommand.cs.meta | 11 + .../Commands/SetUpTearDownCommand.cs | 48 ++ .../Commands/SetUpTearDownCommand.cs.meta | 11 + .../NUnitExtensions/Commands/TestActionCommand.cs | 53 +++ .../Commands/TestActionCommand.cs.meta | 11 + .../Commands/TestCommandPcHelper.cs | 18 + .../Commands/TestCommandPcHelper.cs.meta | 11 + .../NUnitExtensions/ConstructDelegator.cs | 141 ++++++ .../NUnitExtensions/ConstructDelegator.cs.meta | 11 + .../NUnitExtensions/Filters.meta | 8 + .../NUnitExtensions/Filters/AssemblyNameFilter.cs | 25 + .../Filters/AssemblyNameFilter.cs.meta | 11 + .../Filters/CategoryFilterExtended.cs | 36 ++ .../Filters/CategoryFilterExtended.cs.meta | 11 + .../NUnitExtensions/IAsyncTestAssemblyBuilder.cs | 12 + .../IAsyncTestAssemblyBuilder.cs.meta | 11 + .../NUnitExtensions/IStateSerializer.cs | 12 + .../NUnitExtensions/IStateSerializer.cs.meta | 11 + .../NUnitExtensions/Runner.meta | 8 + .../NUnitExtensions/Runner/CompositeWorkItem.cs | 342 ++++++++++++++ .../Runner/CompositeWorkItem.cs.meta | 11 + .../Runner/CoroutineTestWorkItem.cs | 75 +++ .../Runner/CoroutineTestWorkItem.cs.meta | 11 + .../NUnitExtensions/Runner/DefaultTestWorkItem.cs | 96 ++++ .../Runner/DefaultTestWorkItem.cs.meta | 11 + .../NUnitExtensions/Runner/FailCommand.cs | 34 ++ .../NUnitExtensions/Runner/FailCommand.cs.meta | 11 + .../Runner/IEnumerableTestMethodCommand.cs | 10 + .../Runner/IEnumerableTestMethodCommand.cs.meta | 11 + .../Runner/PlaymodeWorkItemFactory.cs | 13 + .../Runner/PlaymodeWorkItemFactory.cs.meta | 11 + .../Runner/RestoreTestContextAfterDomainReload.cs | 4 + .../RestoreTestContextAfterDomainReload.cs.meta | 11 + .../NUnitExtensions/Runner/TestCommandBuilder.cs | 127 +++++ .../Runner/TestCommandBuilder.cs.meta | 11 + .../Runner/UnityLogCheckDelegatingCommand.cs | 143 ++++++ .../Runner/UnityLogCheckDelegatingCommand.cs.meta | 11 + .../Runner/UnityTestAssemblyRunner.cs | 98 ++++ .../Runner/UnityTestAssemblyRunner.cs.meta | 11 + .../Runner/UnityTestExecutionContext.cs | 130 +++++ .../Runner/UnityTestExecutionContext.cs.meta | 11 + .../NUnitExtensions/Runner/UnityWorkItem.cs | 113 +++++ .../NUnitExtensions/Runner/UnityWorkItem.cs.meta | 11 + .../Runner/UnityWorkItemDataHolder.cs | 10 + .../Runner/UnityWorkItemDataHolder.cs.meta | 11 + .../NUnitExtensions/Runner/WorkItemFactory.cs | 28 ++ .../NUnitExtensions/Runner/WorkItemFactory.cs.meta | 11 + .../NUnitExtensions/TestExtensions.cs | 146 ++++++ .../NUnitExtensions/TestExtensions.cs.meta | 11 + .../NUnitExtensions/TestResultExtensions.cs | 77 +++ .../NUnitExtensions/TestResultExtensions.cs.meta | 11 + .../NUnitExtensions/UnityTestAssemblyBuilder.cs | 58 +++ .../UnityTestAssemblyBuilder.cs.meta | 11 + .../UnityEngine.TestRunner/TestRunner.meta | 8 + .../TestRunner/Callbacks.meta | 8 + .../TestRunner/Callbacks/PlayModeRunnerCallback.cs | 47 ++ .../Callbacks/PlayModeRunnerCallback.cs.meta | 11 + .../TestRunner/Callbacks/RemoteTestResultSender.cs | 151 ++++++ .../Callbacks/RemoteTestResultSender.cs.meta | 11 + .../TestRunner/Callbacks/TestResultRenderer.cs | 97 ++++ .../Callbacks/TestResultRenderer.cs.meta | 11 + .../Callbacks/TestResultRendererCallback.cs | 36 ++ .../Callbacks/TestResultRendererCallback.cs.meta | 11 + .../TestRunner/ITestRunnerListener.cs | 26 + .../TestRunner/ITestRunnerListener.cs.meta | 11 + .../TestRunner/Messages.meta | 8 + .../Messages/IEditModeTestYieldInstruction.cs | 12 + .../Messages/IEditModeTestYieldInstruction.cs.meta | 11 + .../TestRunner/PlaymodeTestsController.cs | 129 +++++ .../TestRunner/PlaymodeTestsController.cs.meta | 11 + .../TestRunner/PlaymodeTestsControllerSettings.cs | 36 ++ .../PlaymodeTestsControllerSettings.cs.meta | 11 + .../TestRunner/RemoteHelpers.meta | 8 + .../RemoteHelpers/IRemoteTestResultDataFactory.cs | 11 + .../IRemoteTestResultDataFactory.cs.meta | 11 + .../RemoteHelpers/PlayerConnectionMessageIds.cs | 14 + .../PlayerConnectionMessageIds.cs.meta | 11 + .../TestRunner/RemoteHelpers/RemoteTestData.cs | 56 +++ .../RemoteHelpers/RemoteTestData.cs.meta | 11 + .../RemoteHelpers/RemoteTestResultData.cs | 54 +++ .../RemoteHelpers/RemoteTestResultData.cs.meta | 11 + .../RemoteHelpers/RemoteTestResultDataFactory.cs | 51 ++ .../RemoteTestResultDataFactory.cs.meta | 11 + .../RemoteTestResultDataWithTestData.cs | 15 + .../RemoteTestResultDataWithTestData.cs.meta | 11 + .../TestRunner/SynchronousFilter.cs | 51 ++ .../TestRunner/SynchronousFilter.cs.meta | 11 + .../TestRunner/TestEnumeratorWrapper.cs | 51 ++ .../TestRunner/TestEnumeratorWrapper.cs.meta | 11 + .../TestRunner/TestListenerWrapper.cs | 30 ++ .../TestRunner/TestListenerWrapper.cs.meta | 11 + .../TestRunner/TestPlatform.cs | 21 + .../TestRunner/TestPlatform.cs.meta | 11 + .../TestRunner/TestRunnerFilter.cs | 203 ++++++++ .../TestRunner/TestRunnerFilter.cs.meta | 11 + .../UnityEngine.TestRunner.asmdef | 13 + .../UnityEngine.TestRunner.asmdef.meta | 7 + .../UnityEngine.TestRunner/Utils.meta | 8 + .../Utils/AssemblyProvider.meta | 8 + .../Utils/AssemblyProvider/AssemblyLoadProxy.cs | 12 + .../AssemblyProvider/AssemblyLoadProxy.cs.meta | 11 + .../Utils/AssemblyProvider/AssemblyWrapper.cs | 30 ++ .../Utils/AssemblyProvider/AssemblyWrapper.cs.meta | 11 + .../Utils/AssemblyProvider/IAssemblyLoadProxy.cs | 7 + .../AssemblyProvider/IAssemblyLoadProxy.cs.meta | 11 + .../Utils/AssemblyProvider/IAssemblyWrapper.cs | 11 + .../AssemblyProvider/IAssemblyWrapper.cs.meta | 11 + .../AssemblyProvider/IScriptingRuntimeProxy.cs | 7 + .../IScriptingRuntimeProxy.cs.meta | 11 + .../AssemblyProvider/ITestAssemblyProvider.cs | 10 + .../AssemblyProvider/ITestAssemblyProvider.cs.meta | 11 + .../AssemblyProvider/PlayerTestAssemblyProvider.cs | 66 +++ .../PlayerTestAssemblyProvider.cs.meta | 11 + .../AssemblyProvider/ScriptingRuntimeProxy.cs | 10 + .../AssemblyProvider/ScriptingRuntimeProxy.cs.meta | 11 + .../Utils/AttributeHelper.cs | 45 ++ .../Utils/AttributeHelper.cs.meta | 11 + .../Utils/ColorEqualityComparer.cs | 36 ++ .../Utils/ColorEqualityComparer.cs.meta | 11 + .../Utils/CoroutineRunner.cs | 103 ++++ .../Utils/CoroutineRunner.cs.meta | 11 + .../Utils/FloatEqualityComparer.cs | 30 ++ .../Utils/FloatEqualityComparer.cs.meta | 11 + .../Utils/IOuterUnityTestAction.cs | 19 + .../Utils/IOuterUnityTestAction.cs.meta | 11 + .../Utils/IPostBuildCleanup.cs | 7 + .../Utils/IPostBuildCleanup.cs.meta | 11 + .../Utils/IPrebuildSceneSetup.cs | 7 + .../Utils/IPrebuildSceneSetup.cs.meta | 11 + .../Utils/ITestRunCallback.cs | 12 + .../Utils/ITestRunCallback.cs.meta | 11 + .../Utils/MonoBehaviourTest.meta | 8 + .../Utils/MonoBehaviourTest/IMonoBehaviourTest.cs | 7 + .../MonoBehaviourTest/IMonoBehaviourTest.cs.meta | 11 + .../Utils/MonoBehaviourTest/MonoBehaviourTest.cs | 23 + .../MonoBehaviourTest/MonoBehaviourTest.cs.meta | 11 + .../Utils/PostBuildCleanupAttribute.cs | 20 + .../Utils/PostBuildCleanupAttribute.cs.meta | 11 + .../Utils/PrebuildSceneSetupAttribute.cs | 20 + .../Utils/PrebuildSceneSetupAttribute.cs.meta | 11 + .../Utils/QuaternionEqualityComparer.cs | 31 ++ .../Utils/QuaternionEqualityComparer.cs.meta | 11 + .../Utils/StacktraceFilter.cs | 43 ++ .../Utils/StacktraceFilter.cs.meta | 11 + .../Utils/TestRunCallbackAttribute.cs | 24 + .../Utils/TestRunCallbackAttribute.cs.meta | 11 + .../Utils/TestRunCallbackListener.cs | 63 +++ .../Utils/TestRunCallbackListener.cs.meta | 11 + .../UnityEngine.TestRunner/Utils/Utils.cs | 40 ++ .../UnityEngine.TestRunner/Utils/Utils.cs.meta | 11 + .../Utils/Vector2ComparerWithEqualsOperator.cs | 22 + .../Vector2ComparerWithEqualsOperator.cs.meta | 11 + .../Utils/Vector2EqualityComparer.cs | 33 ++ .../Utils/Vector2EqualityComparer.cs.meta | 11 + .../Utils/Vector3ComparerWithEqualsOperator.cs | 22 + .../Vector3ComparerWithEqualsOperator.cs.meta | 11 + .../Utils/Vector3EqualityComparer.cs | 32 ++ .../Utils/Vector3EqualityComparer.cs.meta | 11 + .../Utils/Vector4ComparerWithEqualsOperator.cs | 22 + .../Vector4ComparerWithEqualsOperator.cs.meta | 11 + .../Utils/Vector4EqualityComparer.cs | 32 ++ .../Utils/Vector4EqualityComparer.cs.meta | 11 + .../com.unity.test-framework@1.1.11/package.json | 26 + .../package.json.meta | 7 + 631 files changed, 20071 insertions(+) create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/CHANGELOG.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/CHANGELOG.md.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/CONTRIBUTING.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/CONTRIBUTING.md.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/TableOfContents.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/edit-mode-vs-play-mode-tests.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/extending.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/extension-get-test-results.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/extension-retrieve-test-list.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/extension-run-tests.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/getting-started.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/editmode-create-test-script.png create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/editmode-run-test.png create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/editmode-run-tests.png create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/editmode-tab.png create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/import-settings.png create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/new-test-script.png create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/playmode-enable-all.png create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/playmode-results-standalone.png create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/playmode-run-standalone.png create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/playmode-tab.png create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/test-runner-window.png create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/test-templates.png create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/tests-folder-assembly.png create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/index.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/manual.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-actions-outside-tests.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-conditionalignore.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-testmustexpectalllogs.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-testplayerbuildmodifier.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-testruncallback.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-unityplatform.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-unitytest.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-command-line.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-color.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-equals.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-float.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-quaternion.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-vector2.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-vector3.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-vector4.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-assertion.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-attributes.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-constraints.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-equality-comparers.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-yield-instructions.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-execution-settings.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-filter.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-icallbacks.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-ierror-callbacks.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-itest-adaptor.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-itest-result-adaptor.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-itest-run-settings.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-recompile-scripts.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-setup-and-cleanup.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-test-runner-api.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-test-utils.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-tests-monobehaviour.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-tests-parameterized.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-wait-for-domain-reload.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/resources.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-create-playmode-test.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-create-test-assembly.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-create-test.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-run-playmode-test-standalone.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-run-test.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/LICENSE.md create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/LICENSE.md.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksDelegator.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksDelegator.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksDelegatorListener.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksDelegatorListener.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksHolder.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksHolder.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ExecutionSettings.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ExecutionSettings.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/Filter.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/Filter.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacks.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacks.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacksDelegator.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacksDelegator.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacksHolder.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacksHolder.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/IErrorCallbacks.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/IErrorCallbacks.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestAdaptor.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestAdaptor.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestAdaptorFactory.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestAdaptorFactory.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestResultAdaptor.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestResultAdaptor.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestRunSettings.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestRunSettings.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestRunnerApi.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestRunnerApi.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestTreeRebuildCallbacks.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestTreeRebuildCallbacks.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/RunState.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/RunState.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestAdaptor.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestAdaptor.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestAdaptorFactory.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestAdaptorFactory.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestMode.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestMode.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestResultAdaptor.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestResultAdaptor.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestRunnerApi.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestRunnerApi.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestStatus.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestStatus.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/AssemblyInfo.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/AssemblyInfo.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/CommandLineOption.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/CommandLineOption.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/CommandLineOptionSet.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/CommandLineOptionSet.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/ICommandLineOption.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/ICommandLineOption.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/Executer.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/Executer.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ExecutionSettings.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ExecutionSettings.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ExitCallbacks.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ExitCallbacks.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ISettingsBuilder.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ISettingsBuilder.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogSavingCallbacks.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogSavingCallbacks.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogWriter.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogWriter.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ResultsSavingCallbacks.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ResultsSavingCallbacks.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ResultsWriter.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ResultsWriter.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/RunData.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/RunData.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/RunSettings.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/RunSettings.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/SettingsBuilder.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/SettingsBuilder.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/SetupException.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/SetupException.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/TestStarter.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/TestStarter.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/AssetsDatabaseHelper.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/AssetsDatabaseHelper.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/GuiHelper.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/GuiHelper.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/IAssetsDatabaseHelper.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/IAssetsDatabaseHelper.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/IGuiHelper.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/IGuiHelper.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/RenderingOptions.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/RenderingOptions.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/ResultSummarizer.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/ResultSummarizer.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/TestFilterSettings.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/TestFilterSettings.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/TestTreeViewBuilder.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/TestTreeViewBuilder.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListGuiHelper.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListGuiHelper.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/Icons.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/Icons.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestListTreeViewDataSource.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestListTreeViewDataSource.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestListTreeViewGUI.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestListTreeViewGUI.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestTreeViewItem.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestTreeViewItem.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestRunnerResult.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestRunnerResult.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestRunnerUIFilter.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestRunnerUIFilter.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/EditModeTestListGUI.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/EditModeTestListGUI.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/PlayModeTestListGUI.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/PlayModeTestListGUI.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/TestListGUIBase.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/TestListGUIBase.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/AssetPipelineIgnore.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/AssetPipelineIgnore.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/ITestPlayerBuildModifier.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/ITestPlayerBuildModifier.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/TestPlayerBuildModifierAttribute.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/TestPlayerBuildModifierAttribute.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/TestRunnerStateSerializer.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/TestRunnerStateSerializer.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/RequireApiProfileAttribute.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/RequireApiProfileAttribute.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/RequirePlatformSupportAttribute.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/RequirePlatformSupportAttribute.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestBuildAssemblyFilter.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestBuildAssemblyFilter.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/AttributeFinderBase.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/AttributeFinderBase.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/EditModeLauncher.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/EditModeLauncher.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/EditModeLauncherContextSettings.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/EditModeLauncherContextSettings.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/AndroidPlatformSetup.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/AndroidPlatformSetup.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/ApplePlatformSetup.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/ApplePlatformSetup.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/IPlatformSetup.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/IPlatformSetup.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/LuminPlatformSetup.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/LuminPlatformSetup.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/PlatformSpecificSetup.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/PlatformSpecificSetup.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/SwitchPlatformSetup.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/SwitchPlatformSetup.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/UwpPlatformSetup.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/UwpPlatformSetup.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/XboxOnePlatformSetup.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/XboxOnePlatformSetup.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncher.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncher.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncherBuildOptions.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncherBuildOptions.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncherContextSettings.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncherContextSettings.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlaymodeLauncher.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlaymodeLauncher.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PostbuildCleanupAttributeFinder.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PostbuildCleanupAttributeFinder.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PrebuildSetupAttributeFinder.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PrebuildSetupAttributeFinder.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemotePlayerLogController.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemotePlayerLogController.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemotePlayerTestController.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemotePlayerTestController.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemoteTestResultReciever.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemoteTestResultReciever.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RuntimeTestLauncherBase.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RuntimeTestLauncherBase.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/TestLauncherBase.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/TestLauncherBase.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestResultSerializer.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestResultSerializer.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/BuildActionTaskBase.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/BuildActionTaskBase.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/BuildTestTreeTask.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/BuildTestTreeTask.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/CleanupVerificationTask.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/CleanupVerificationTask.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/FileCleanupVerifierTaskBase.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/FileCleanupVerifierTaskBase.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyEditModeRunTask.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyEditModeRunTask.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyPlayModeRunTask.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyPlayModeRunTask.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyPlayerRunTask.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyPlayerRunTask.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/PerformUndoTask.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/PerformUndoTask.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/PrebuildSetupTask.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/PrebuildSetupTask.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/RegisterFilesForCleanupVerificationTask.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/RegisterFilesForCleanupVerificationTask.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/SaveModiedSceneTask.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/SaveModiedSceneTask.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/SaveUndoIndexTask.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/SaveUndoIndexTask.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/TestTaskBase.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/TestTaskBase.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobData.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobData.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobDataHolder.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobDataHolder.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobRunner.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobRunner.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestRunCanceledException.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestRunCanceledException.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/EditModeRunnerCallback.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/EditModeRunnerCallback.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallback.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallback.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallbackData.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallbackData.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallbackInitializer.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallbackInitializer.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/TestRunnerCallback.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/TestRunnerCallback.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/WindowResultUpdater.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/WindowResultUpdater.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditModePCHelper.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditModePCHelper.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditModeRunner.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditModeRunner.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditmodeWorkItemFactory.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditmodeWorkItemFactory.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditorEnumeratorTestWorkItem.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditorEnumeratorTestWorkItem.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EnumeratorStepHelper.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EnumeratorStepHelper.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/ExitPlayMode.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/ExitPlayMode.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/RecompileScripts.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/RecompileScripts.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/WaitForDomainReload.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/WaitForDomainReload.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/CachingTestListProvider.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/CachingTestListProvider.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorAssembliesProxy.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorAssembliesProxy.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorAssemblyWrapper.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorAssemblyWrapper.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorCompilationInterfaceProxy.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorCompilationInterfaceProxy.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorLoadedTestAssemblyProvider.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorLoadedTestAssemblyProvider.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorAssembliesProxy.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorAssembliesProxy.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorCompilationInterfaceProxy.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorCompilationInterfaceProxy.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorLoadedTestAssemblyProvider.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorLoadedTestAssemblyProvider.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListCache.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListCache.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListCacheData.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListCacheData.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListProvider.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListProvider.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListCache.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListCache.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListCacheData.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListCacheData.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListJob.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListJob.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListProvider.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListProvider.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunnerWindow.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunnerWindow.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunnerWindowSettings.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunnerWindowSettings.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/ITestSettings.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/ITestSettings.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/ITestSettingsDeserializer.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/ITestSettingsDeserializer.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/TestSettings.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/TestSettings.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/TestSettingsDeserializer.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/TestSettingsDeserializer.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityEditor.TestRunner.asmdef create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityEditor.TestRunner.asmdef.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/AssemblyCompilationErrorsMessage.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/AssemblyCompilationErrorsMessage.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/ITestRunnerApiMapper.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/ITestRunnerApiMapper.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/IUtpLogger.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/IUtpLogger.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/IUtpMessageReporter.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/IUtpMessageReporter.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/Message.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/Message.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestFinishedMessage.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestFinishedMessage.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestPlanMessage.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestPlanMessage.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestRunnerApiMapper.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestRunnerApiMapper.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestStartedMessage.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestStartedMessage.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestState.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestState.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UnityTestProtocolListener.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UnityTestProtocolListener.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UnityTestProtocolStarter.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UnityTestProtocolStarter.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UtpDebuglogger.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UtpDebuglogger.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UtpMessageReporter.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UtpMessageReporter.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/AssemblyInfo.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/AssemblyInfo.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/AllocatingGCMemoryConstraint.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/AllocatingGCMemoryConstraint.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/ConstraintsExtensions.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/ConstraintsExtensions.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/InvalidSignatureException.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/InvalidSignatureException.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/Is.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/Is.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogAssert.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogAssert.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/ILogScope.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/ILogScope.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogEvent.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogEvent.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogMatch.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogMatch.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogScope.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogScope.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnexpectedLogMessageException.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnexpectedLogMessageException.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnhandledLogMessageException.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnhandledLogMessageException.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnityTestTimeoutException.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnityTestTimeoutException.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/ActionDelegator.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/ActionDelegator.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/ConditionalIgnoreAttribute.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/ConditionalIgnoreAttribute.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/TestEnumerator.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/TestEnumerator.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/TestMustExpectAllLogsAttribute.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/TestMustExpectAllLogsAttribute.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityCombinatorialStrategy.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityCombinatorialStrategy.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityPlatformAttribute.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityPlatformAttribute.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnitySetUpAttribute.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnitySetUpAttribute.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityTearDownAttribute.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityTearDownAttribute.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityTestAttribute.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityTestAttribute.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/BaseDelegator.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/BaseDelegator.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/BeforeAfterTestCommandBase.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/BeforeAfterTestCommandBase.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/BeforeAfterTestCommandState.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/BeforeAfterTestCommandState.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableApplyChangesToContextCommand.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableApplyChangesToContextCommand.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableRepeatedTestCommand.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableRepeatedTestCommand.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableRetryTestCommand.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableRetryTestCommand.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableSetUpTearDownCommand.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableSetUpTearDownCommand.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableTestMethodCommand.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableTestMethodCommand.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/ImmediateEnumerableCommand.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/ImmediateEnumerableCommand.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/OuterUnityTestActionCommand.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/OuterUnityTestActionCommand.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/SetUpTearDownCommand.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/SetUpTearDownCommand.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/TestActionCommand.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/TestActionCommand.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/TestCommandPcHelper.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/TestCommandPcHelper.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/ConstructDelegator.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/ConstructDelegator.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters/AssemblyNameFilter.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters/AssemblyNameFilter.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters/CategoryFilterExtended.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters/CategoryFilterExtended.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/IAsyncTestAssemblyBuilder.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/IAsyncTestAssemblyBuilder.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/IStateSerializer.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/IStateSerializer.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/CoroutineTestWorkItem.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/CoroutineTestWorkItem.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/DefaultTestWorkItem.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/DefaultTestWorkItem.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/FailCommand.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/FailCommand.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/IEnumerableTestMethodCommand.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/IEnumerableTestMethodCommand.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/PlaymodeWorkItemFactory.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/PlaymodeWorkItemFactory.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/RestoreTestContextAfterDomainReload.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/RestoreTestContextAfterDomainReload.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/TestCommandBuilder.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/TestCommandBuilder.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityLogCheckDelegatingCommand.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityLogCheckDelegatingCommand.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityTestAssemblyRunner.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityTestAssemblyRunner.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityTestExecutionContext.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityTestExecutionContext.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityWorkItem.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityWorkItem.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityWorkItemDataHolder.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityWorkItemDataHolder.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/WorkItemFactory.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/WorkItemFactory.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/TestExtensions.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/TestExtensions.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/TestResultExtensions.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/TestResultExtensions.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/UnityTestAssemblyBuilder.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/UnityTestAssemblyBuilder.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/PlayModeRunnerCallback.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/PlayModeRunnerCallback.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/RemoteTestResultSender.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/RemoteTestResultSender.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRenderer.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRenderer.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRendererCallback.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRendererCallback.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/ITestRunnerListener.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/ITestRunnerListener.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Messages.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Messages/IEditModeTestYieldInstruction.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Messages/IEditModeTestYieldInstruction.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/PlaymodeTestsController.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/PlaymodeTestsController.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/PlaymodeTestsControllerSettings.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/PlaymodeTestsControllerSettings.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/IRemoteTestResultDataFactory.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/IRemoteTestResultDataFactory.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/PlayerConnectionMessageIds.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/PlayerConnectionMessageIds.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestData.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestData.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultData.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultData.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultDataFactory.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultDataFactory.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultDataWithTestData.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultDataWithTestData.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/SynchronousFilter.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/SynchronousFilter.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestEnumeratorWrapper.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestEnumeratorWrapper.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestListenerWrapper.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestListenerWrapper.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestPlatform.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestPlatform.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestRunnerFilter.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestRunnerFilter.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/UnityEngine.TestRunner.asmdef create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/UnityEngine.TestRunner.asmdef.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/AssemblyLoadProxy.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/AssemblyLoadProxy.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/AssemblyWrapper.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/AssemblyWrapper.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IAssemblyLoadProxy.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IAssemblyLoadProxy.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IAssemblyWrapper.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IAssemblyWrapper.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IScriptingRuntimeProxy.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IScriptingRuntimeProxy.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/ITestAssemblyProvider.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/ITestAssemblyProvider.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/PlayerTestAssemblyProvider.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/PlayerTestAssemblyProvider.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/ScriptingRuntimeProxy.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/ScriptingRuntimeProxy.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AttributeHelper.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AttributeHelper.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/ColorEqualityComparer.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/ColorEqualityComparer.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/CoroutineRunner.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/CoroutineRunner.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/FloatEqualityComparer.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/FloatEqualityComparer.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IOuterUnityTestAction.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IOuterUnityTestAction.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IPostBuildCleanup.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IPostBuildCleanup.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IPrebuildSceneSetup.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IPrebuildSceneSetup.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/ITestRunCallback.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/ITestRunCallback.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest/IMonoBehaviourTest.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest/IMonoBehaviourTest.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest/MonoBehaviourTest.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest/MonoBehaviourTest.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/PostBuildCleanupAttribute.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/PostBuildCleanupAttribute.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/PrebuildSceneSetupAttribute.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/PrebuildSceneSetupAttribute.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/QuaternionEqualityComparer.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/QuaternionEqualityComparer.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/StacktraceFilter.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/StacktraceFilter.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/TestRunCallbackAttribute.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/TestRunCallbackAttribute.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/TestRunCallbackListener.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/TestRunCallbackListener.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Utils.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Utils.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector2ComparerWithEqualsOperator.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector2ComparerWithEqualsOperator.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector2EqualityComparer.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector2EqualityComparer.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector3ComparerWithEqualsOperator.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector3ComparerWithEqualsOperator.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector3EqualityComparer.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector3EqualityComparer.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector4ComparerWithEqualsOperator.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector4ComparerWithEqualsOperator.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector4EqualityComparer.cs create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector4EqualityComparer.cs.meta create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/package.json create mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/package.json.meta (limited to 'Library/PackageCache/com.unity.test-framework@1.1.11') diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/CHANGELOG.md b/Library/PackageCache/com.unity.test-framework@1.1.11/CHANGELOG.md new file mode 100644 index 0000000..65a980d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/CHANGELOG.md @@ -0,0 +1,112 @@ +# Changelog +## [1.1.11] - 2020-01-16 +- Fixed test runner dlls got included into player build (case 1211624) +- Passing a non-full-path of XML file for -testResults in Unity Batchmode issue resolved, now passing "result.xml" creates the result file in the project file directory (case 959078) +- Respect Script Debugging build setting when running tests + +## [1.1.10] - 2019-12-19 +- Introduced PostSuccessfulLaunchAction callback +- Fixed an issue where canceling a UnityTest while it was running would incorrectly mark it as passed instead of canceled. +- Added command line argument for running tests synchronously. +- The test search bar now handles null values correctly. +- The test output pane now retains its size on domain reloads. + +## [1.1.9] - 2019-12-12 +- Rolled back refactoring to the test run system, as it caused issues in some corner cases. + +## [1.1.8] - 2019-11-15 +- Ensured that a resumed test run is continued instantly. + +## [1.1.7] - 2019-11-14 +- Fixed an issue with test runs after domain reload. + +## [1.1.6] - 2019-11-12 +- Building a player for test will no longer look in unrelated assemblies for relevant attributes. + +## [1.1.5] - 2019-10-23 +- Fixed a regression to synchronous runs introduced in 1.1.4. + +## [1.1.4] - 2019-10-15 +- Running tests in batch mode now correctly returns error code 3 (RunError) when a timeout or a build error occurs. +- Fixed an issue where a test run in a player would time out, if the player takes longer than 10 minutes to run. +- Added command line argument and api setting for specifying custom heartbeat timeout for running on players. + +## [1.1.3] - 2019-09-23 +- Fixed a regression where tests in a player would report a timeout after a test run is finished. +- Made it possible for the ui to change its test items when the test tree changes without script compilation. +- Added synchronous runs as an option to the TestRunnerApi. + +## [1.1.2] - 2019-09-11 +- Fixed an issue where Run Selected would run all tests in the category, if a category filter was selected, regardless of what tests were selected. +- Unsupported attributes used in UnityTests now give an explicit error. +- Added support for the Repeat and Retry attributes in UnityTests (case 1131940). +- Tests with a explicit timeout higher than 10 minutes, no longer times out after running longer than 10 minutes when running from command line (case 1125991). +- Fixed a performance regression in the test runner api result reporting, introduced in 2018.3 (case 1109865). +- Fixed an issue where parameterized test fixtures would not run if selected in the test tree (case 1092244). +- Pressing Clear Results now also correctly clears the counters on the test list (case 1181763). +- Prebuild setup now handles errors logged with Debug.LogError and stops the run if any is logged (case 1115240). It now also supports LogAssert.Expect. + +## [1.1.1] - 2019-08-07 +- Tests retrieved as a test list with the test runner api incorrectly showed both mode as their TestMode. +- Fixed a compatibility issue with running tests from rider. + +## [1.1.0] - 2019-07-30 +- Introduced the TestRunnerApi for running tests programmatically from elsewhere inside the Editor. +- Introduced yield instructions for recompiling scripts and awaiting a domain reload in Edit Mode tests. +- Added a button to the Test Runner UI for clearing the results. + +## [1.0.18] - 2019-07-15 +- Included new full documentation of the test framework. + +## [1.0.17] - 2019-07-11 +- Fixed an issue where the Test Runner window wouldn’t frame selected items after search filter is cleared. +- Fixed a regression where playmode test application on the IOS platform would not quit after the tests are done. + +## [1.0.16] - 2019-06-20 +- Fixed an issue where the Test Runner window popped out if it was docked, or if something else was docked next to it, when re-opened (case 1158961) +- Fixed a regression where the running standalone playmode tests from the ui would result in an error. + +## [1.0.15] - 2019-06-18 +- Added new `[TestMustExpectAllLogs]` attribute, which automatically does `LogAssert.NoUnexpectedReceived()` at the end of affected tests. See docs for this attribute for more info on usage. +- Fixed a regression where no tests would be run if multiple filters are specified. E.g. selecting both a whole assembly and an individual test in the ui. +- Fixed an issue where performing `Run Selected` on a selected assembly would run all assemblies. +- Introduced the capability to do a split build and run, when running playmode tests on standalone devices. +- Fixed an error in ConditionalIgnore, if the condition were not set. + +## [1.0.14] - 2019-05-27 +- Fixed issue preventing scene creation in IPrebuildSetup.Setup callback when running standalone playmode tests. +- Fixed an issue where test assemblies would sometimes not be ordered alphabetically. +- Added module references to the package for the required modules: imgui and jsonserialize. +- Added a ConditionalIgnore attribute to help ignoring tests only under specific conditions. +- Fixed a typo in the player test window (case 1148671). + +## [1.0.13] - 2019-05-07 +- Fixed a regression where results from the player would no longer update correctly in the UI (case 1151147). + +## [1.0.12] - 2019-04-16 +- Added specific unity release to the package information. + +## [1.0.11] - 2019-04-10 +- Fixed a regression from 1.0.10 where test-started events were triggered multiple times after a domain reload. + +## [1.0.10] - 2019-04-08 +- Fixed an issue where test-started events would not be fired correctly after a test performing a domain reload (case 1141530). +- The UI should correctly run tests inside a nested class, when that class is selected. +- All actions should now correctly display a prefix when reporting test result. E.g. "TearDown :". +- Errors logged with Debug.LogError in TearDowns now append the error, rather than overwriting the existing result (case 1114306). +- Incorrect implementations of IWrapTestMethod and IWrapSetUpTearDown now gives a meaningful error. +- Fixed a regression where the Test Framework would run TearDown in a base class before the inheriting class (case 1142553). +- Fixed a regression introduced in 1.0.9 where tests with the Explicit attribute could no longer be executed. + +## [1.0.9] - 2019-03-27 +- Fixed an issue where a corrupt instance of the test runner window would block for a new being opened. +- Added the required modules to the list of package requirements. +- Fixed an issue where errors would happen if the test filter ui was clicked before the ui is done loading. +- Fix selecting items with duplicate names in test hierarchy of Test Runner window (case 987587). +- Fixed RecompileScripts instruction which we use in tests (case 1128994). +- Fixed an issue where using multiple filters on tests would sometimes give an incorrect result. + +## [1.0.7] - 2019-03-12 +### This is the first release of *Unity Package com.unity.test-framework*. + +- Migrated the test-framework from the current extension in unity. diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/CHANGELOG.md.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/CHANGELOG.md.meta new file mode 100644 index 0000000..097eb7e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/CHANGELOG.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d691174143fd3774ba63d7c493633b99 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/CONTRIBUTING.md b/Library/PackageCache/com.unity.test-framework@1.1.11/CONTRIBUTING.md new file mode 100644 index 0000000..4a67963 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/CONTRIBUTING.md @@ -0,0 +1,9 @@ +# Contributing + +## If you are interested in contributing, here are some ground rules: +* ... Define guidelines & rules for what contributors need to know to successfully make Pull requests against your repo ... + +## All contributions are subject to the [Unity Contribution Agreement(UCA)](https://unity3d.com/legal/licenses/Unity_Contribution_Agreement) +By making a pull request, you are confirming agreement to the terms and conditions of the UCA, including that your Contributions are your original creation and that you have complete right and authority to make your Contributions. + +## Once you have a change ready following these ground rules. Simply make a pull request diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/CONTRIBUTING.md.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/CONTRIBUTING.md.meta new file mode 100644 index 0000000..9d51b0b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/CONTRIBUTING.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 57d2ac5c7d5786e499d4794973fe0d4e +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/TableOfContents.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/TableOfContents.md new file mode 100644 index 0000000..3eed595 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/TableOfContents.md @@ -0,0 +1,66 @@ +* [Unity Test Framework overview](./index.md) +* [Edit Mode vs. Play Mode tests](./edit-mode-vs-play-mode-tests.md) +* [Getting started with UTF](./getting-started.md) + * [How to create a new test assembly](./workflow-create-test-assembly.md) + * [How to create a test](./workflow-create-test.md) + * [How to run a test](./workflow-run-test.md) + * [How to create a Play Mode test](./workflow-create-playmode-test.md) + * [How to run a Play Mode test as standalone](./workflow-run-playmode-test-standalone.md) +* [Resources](./resources.md) +* [Extending UTF](./extending.md) + * [How to split the build and run process for standalone Play Mode tests](./reference-attribute-testplayerbuildmodifier.md#split-build-and-run-for-player-mode-tests) + * [How to run tests programmatically](./extension-run-tests.md) + * [How to get test results](./extension-get-test-results.md) + * [How to retrieve the list of tests](./extension-retrieve-test-list.md) +* [Reference](./manual.md#reference) + * [Running tests from the command-line](./reference-command-line.md) + * [UnityTest attribute](./reference-attribute-unitytest.md) + * [Setup and cleanup at build time](./reference-setup-and-cleanup.md) + * [IPrebuildSetup](./reference-setup-and-cleanup.md#iprebuildsetup) + * [IPostBuildCleanup](./reference-setup-and-cleanup.md#ipostbuildcleanup) + * [Actions outside of tests](./reference-actions-outside-tests.md) + * [Action execution order](./reference-actions-outside-tests.md#action-execution-order) + * [UnitySetUp and UnityTearDown](./reference-actions-outside-tests.md#unitysetup-and-unityteardown) + * [OuterUnityTestAction](./reference-actions-outside-tests.md#outerunitytestaction) + * [Domain Reloads](./reference-actions-outside-tests.md#domain-reloads) + * [Custom attributes](./reference-custom-attributes.md) + * [ConditionalIgnore attribute](./reference-attribute-conditionalignore.md) + * [PostBuildCleanup attribute](./reference-setup-and-cleanup.md#prebuildsetup-and-postbuildcleanup) + * [PrebuildSetup attribute](./reference-setup-and-cleanup.md#prebuildsetup-and-postbuildcleanup) + * [TestMustExpectAllLogs attribute](./reference-attribute-testmustexpectalllogs.md) + * [TestPlayerBuildModifier attribute](./reference-attribute-testplayerbuildmodifier.md) + * [TestRunCallback attribute](./reference-attribute-testruncallback.md) + * [UnityPlatform attribute](./reference-attribute-unityplatform.md) + * [UnitySetUp attribute](./reference-actions-outside-tests.md#unitysetup-and-unityteardown) + * [UnityTearDown attribute](./reference-actions-outside-tests.md#unitysetup-and-unityteardown) + * [UnityTest attribute](./reference-attribute-unitytest.md) + * [Custom equality comparers](./reference-custom-equality-comparers.md) + * [ColorEqualityComparer](./reference-comparer-color.md) + * [FloatEqualityComparer](./reference-comparer-float.md) + * [QuaternionEqualityComparer](./reference-comparer-quaternion.md) + * [Vector2EqualityComparer](./reference-comparer-vector2.md) + * [Vector3EqualityComparer](./reference-comparer-vector3.md) + * [Vector4EqualityComparer](./reference-comparer-vector4.md) + * [Custom equality comparers with equals operator](./reference-comparer-equals.md) + * [Test Utils](./reference-test-utils.md) + * [Custom yield instructions](./reference-custom-yield-instructions.md) + * [IEditModeTestYieldInstruction](./reference-custom-yield-instructions.md#IEditModeTestYieldInstruction) + * [EnterPlayMode](./reference-custom-yield-instructions.md#enterplaymode) + * [ExitPlayMode](./reference-custom-yield-instructions.md#exitplaymode) + * [RecompileScripts](./reference-recompile-scripts.md) + * [WaitForDomainReload](./reference-wait-for-domain-reload.md) + * [Custom assertion](./reference-custom-assertion.md) + * [LogAssert](./reference-custom-assertion.md#logassert) + * [Custom constraints](./reference-custom-constraints.md) + * [Is](./reference-custom-constraints.md#is) + * [Parameterized tests](./reference-tests-parameterized.md) + * [MonoBehaviour tests](./reference-tests-monobehaviour.md) + * [MonoBehaviourTest<T>](./reference-tests-monobehaviour.md#monobehaviourtestt) + * [IMonoBehaviourTest](./reference-tests-monobehaviour.md#imonobehaviourtest) + * [TestRunnerApi](./reference-test-runner-api.md) + * [ExecutionSettings](./reference-execution-settings.md) + * [Filter](./reference-filter.md) + * [ITestRunSettings](./reference-itest-run-settings.md) + * [ICallbacks](./reference-icallbacks.md) + * [IErrorCallbacks](./reference-ierror-callbacks.md) + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/edit-mode-vs-play-mode-tests.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/edit-mode-vs-play-mode-tests.md new file mode 100644 index 0000000..7a10424 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/edit-mode-vs-play-mode-tests.md @@ -0,0 +1,53 @@ +# Edit Mode vs. Play Mode tests + +Let’s clarify a bit what Play Mode and Edit Mode test means from the Unity Test Framework perspective: + +## Edit Mode tests + +**Edit Mode** tests (also known as Editor tests) are only run in the Unity Editor and have access to the Editor code in addition to the game code. + +With Edit Mode tests it is possible to test any of your [Editor extensions](https://docs.unity3d.com/Manual/ExtendingTheEditor.html) using the [UnityTest](./reference-attribute-unitytest.md) attribute. For Edit Mode tests, your test code runs in the [EditorApplication.update](https://docs.unity3d.com/ScriptReference/EditorApplication-update.html) callback loop. + +> **Note**: You can also control entering and exiting Play Mode from your Edit Mode test. This allow your test to make changes before entering Play Mode. + +Edit Mode tests should meet one of the following conditions: + +* They should have an [assembly definition](./workflow-create-test-assembly.md) with reference to *nunit.framework.dll* and has only the Editor as a target platform: + +```assembly + "includePlatforms": [ + "Editor" + ], +``` + +* Legacy condition: put tests in the project’s [Editor](https://docs.unity3d.com/Manual/SpecialFolders.html) folder. + +## Play Mode tests + +You can run **Play Mode** tests as a [standalone in a Player](./workflow-run-playmode-test-standalone.md) or inside the Editor. Play Mode tests allow you to exercise your game code, as the tests run as [coroutines](https://docs.unity3d.com/ScriptReference/Coroutine.html) if marked with the `UnityTest` attribute. + +Play Mode tests should correspond to the following conditions: + +* Have an [assembly definition](./workflow-create-test-assembly.md) with reference to *nunit.framework.dll*. +* Have the test scripts located in a folder with the .asmdef file. +* The test assembly should reference an assembly within the code that you need to test. + +```assembly + "references": [ + "NewAssembly" + ], + "optionalUnityReferences": [ + "TestAssemblies" + ], + "includePlatforms": [], +``` + +## Recommendations + +### Attributes + +Use the [NUnit](http://www.nunit.org/) `Test` attribute instead of the `UnityTest` attribute, unless you need to [yield special instructions](./reference-custom-yield-instructions.md), in Edit Mode, or if you need to skip a frame or wait for a certain amount of time in Play Mode. + +### References + +It is possible for your Test Assemblies to reference the test tools in `UnityEngine.TestRunner` and `UnityEditor.TestRunner`. The latter is only available in Edit Mode. You can specify these references in the `Assembly Definition References` on the Assembly Definition. \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/extending.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/extending.md new file mode 100644 index 0000000..c28a2fd --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/extending.md @@ -0,0 +1,10 @@ +# Extending Unity Test Framework +It is possible to extend the Unity Test Framework (UTF) in many ways, for custom workflows for your projects and for other packages to build on top of UTF. + +These extensions are a supplement to the ones already offered by [NUnit](https://github.com/nunit/docs/wiki/Framework-Extensibility). + +Some workflows for extending UTF include: +* [How to split the build and run process for standalone Play Mode tests](./reference-attribute-testplayerbuildmodifier.md#split-build-and-run-for-player-mode-tests) +* [How to run tests programmatically](./extension-run-tests.md) +* [How to get test results](./extension-get-test-results.md) +* [How to retrieve the list of tests](./extension-retrieve-test-list.md)  \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/extension-get-test-results.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/extension-get-test-results.md new file mode 100644 index 0000000..e337ef9 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/extension-get-test-results.md @@ -0,0 +1,45 @@ +# How to get test results +You can receive callbacks when the active test run, or individual tests, starts and finishes. You can register callbacks by invoking `RegisterCallbacks` on the [TestRunnerApi](./reference-test-runner-api.md) with an instance of a class that implements [ICallbacks](./reference-icallbacks.md). There are four `ICallbacks` methods for the start and finish of both the whole run and each level of the test tree. + +## Example +An example of how listeners can be set up: + +> **Note**: Listeners receive callbacks from all test runs, regardless of the registered `TestRunnerApi` for that instance. + +``` C# +public void SetupListeners() +{ + var api = ScriptableObject.CreateInstance(); + api.RegisterCallbacks(new MyCallbacks()); +} + +private class MyCallbacks : ICallbacks +{ + public void RunStarted(ITestAdaptor testsToRun) + { + + } + + public void RunFinished(ITestResultAdaptor result) + { + + } + + public void TestStarted(ITestAdaptor test) + { + + } + + public void TestFinished(ITestResultAdaptor result) + { + if (!result.HasChildren && result.ResultState != "Success") + { + Debug.Log(string.Format("Test {0} {1}", result.Test.Name, result.ResultState)); + } + } +} +``` + +> **Note**: The registered callbacks are not persisted on domain reloads. So it is necessary to re-register the callback after a domain reloads, usually with [InitializeOnLoad](https://docs.unity3d.com/Manual/RunningEditorCodeOnLaunch.html). + +It is possible to provide a `priority` as an integer as the second argument when registering a callback. This influences the invocation order of different callbacks. The default value is zero. It is also possible to provide `RegisterCallbacks` with a class instance that implements [IErrorCallbacks](./reference-ierror-callbacks.md) that is an extended version of `ICallbacks`. `IErrorCallbacks` also has a callback method for `OnError` that invokes if the run fails to start, for example, due to compilation errors or if an [IPrebuildSetup](./reference-setup-and-cleanup.md) throws an exception. \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/extension-retrieve-test-list.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/extension-retrieve-test-list.md new file mode 100644 index 0000000..a2b9313 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/extension-retrieve-test-list.md @@ -0,0 +1,13 @@ +# How to retrieve the list of tests +It is possible to use the [TestRunnerApi](./reference-test-runner-api.md) to retrieve the test tree for a given test mode (**Edit Mode** or **Play Mode**). You can retrieve the test tree by invoking `RetrieveTestList` with the desired `TestMode` and a callback action, with an [ITestAdaptor](./reference-itest-adaptor.md) representing the test tree. + +## Example +The following example retrieves the test tree for Edit Mode tests and prints the number of total test cases: +``` C# +var api = ScriptableObject.CreateInstance(); +api.RetrieveTestList(TestMode.EditMode, (testRoot) => +{ + Debug.Log(string.Format("Tree contains {0} tests.", testRoot.TestCaseCount)); +}); +``` + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/extension-run-tests.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/extension-run-tests.md new file mode 100644 index 0000000..79f92d2 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/extension-run-tests.md @@ -0,0 +1,72 @@ +# How to run tests programmatically +## Filters + +Run tests by calling `Execute` on the [TestRunnerApi](./reference-test-runner-api.md), and provide some execution settings that consists of a [Filter](./reference-filter.md). The `Filter` specifies what tests to run. + +### Example + +The following is an example of how to run all **Play Mode** tests in a project: + +``` C# +var testRunnerApi = ScriptableObject.CreateInstance(); +var filter = new Filter() +{ + testMode = TestMode.PlayMode +}; +testRunnerApi.Execute(new ExecutionSettings(filter)); +``` +## Multiple filter values + +It is possible to specify a more specific filter by filling out the fields on the `Filter` class in more detail. + +Many of the fields allow for multiple values. The runner tries to match tests against at least one of the values provided and then runs any tests that match. + +### Example + +In this example, the API runs tests with full names that fit either of the two names provided: + +``` C# +var api = ScriptableObject.CreateInstance(); +api.Execute(new ExecutionSettings(new Filter() +{ + testNames = new[] {"MyTestClass.NameOfMyTest", "SpecificTestFixture.NameOfAnotherTest"} +})); +``` +## Multiple filter fields + +If using multiple different fields on the filter, then it matches against tests that fulfill all the different fields. + +### Example + +In this example, it runs any test that fits either of the two test names, and that also belongs to a test assembly that fits the given name. + +``` C# +var api = ScriptableObject.CreateInstance(); +api.Execute(new ExecutionSettings(new Filter() +{ + assemblyNames = new [] {"MyTestAssembly"}, + testNames = new [] {"MyTestClass.NameOfMyTest", "MyTestClass.AnotherNameOfATest"} +})); +``` +## Multiple constructor filters + +The execution settings take one or more filters in its constructor. If there is no filter provided, then it runs all **Edit Mode** tests by default. If there are multiple filters provided, then a test runs if it matches any of the filters. + +### Example + +In this example, it runs any tests that are either in the assembly named `MyTestAssembly` or if the full name of the test matches either of the two provided test names: + +``` C# +var api = ScriptableObject.CreateInstance(); +api.Execute(new ExecutionSettings( + new Filter() + { + assemblyNames = new[] {"MyTestAssembly"}, + }, + new Filter() + { + testNames = new[] {"MyTestClass.NameOfMyTest", "MyTestClass.AnotherNameOfATest"} + } +)); +``` +> **Note**: Specifying different test modes or platforms in each `Filter` is not currently supported. The test mode and platform is from the first `Filter` only and defaults to Edit Mode, if not supplied. \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/getting-started.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/getting-started.md new file mode 100644 index 0000000..b894e16 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/getting-started.md @@ -0,0 +1,18 @@ +# Getting started with Unity Test Framework + +To access the Unity Test Framework (UTF) in the Unity Editor, open the **Test Runner** window; go to **Window** > **General** > **Test Runner**. + +![Unity Test Runner window](./images/test-runner-window.png) + +To get started with UTF, follow the workflows below: + +* [How to create a new test assembly](./workflow-create-test-assembly.md) +* [How to create a test](./workflow-create-test.md) +* [How to run a test](./workflow-run-test.md) +* [How to create a Play Mode test](./workflow-create-playmode-test.md) +* [How to run a Play Mode test as standalone](./workflow-run-playmode-test-standalone.md) + + + +For further information, see the [resources](./resources.md) and [reference](./manual.md#reference) sections. + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/editmode-create-test-script.png b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/editmode-create-test-script.png new file mode 100644 index 0000000..fc9af55 Binary files /dev/null and b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/editmode-create-test-script.png differ diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/editmode-run-test.png b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/editmode-run-test.png new file mode 100644 index 0000000..df1b53c Binary files /dev/null and b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/editmode-run-test.png differ diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/editmode-run-tests.png b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/editmode-run-tests.png new file mode 100644 index 0000000..c890d81 Binary files /dev/null and b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/editmode-run-tests.png differ diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/editmode-tab.png b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/editmode-tab.png new file mode 100644 index 0000000..e1b00d7 Binary files /dev/null and b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/editmode-tab.png differ diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/import-settings.png b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/import-settings.png new file mode 100644 index 0000000..6a34e92 Binary files /dev/null and b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/import-settings.png differ diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/new-test-script.png b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/new-test-script.png new file mode 100644 index 0000000..21de081 Binary files /dev/null and b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/new-test-script.png differ diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/playmode-enable-all.png b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/playmode-enable-all.png new file mode 100644 index 0000000..961991a Binary files /dev/null and b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/playmode-enable-all.png differ diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/playmode-results-standalone.png b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/playmode-results-standalone.png new file mode 100644 index 0000000..de40c03 Binary files /dev/null and b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/playmode-results-standalone.png differ diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/playmode-run-standalone.png b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/playmode-run-standalone.png new file mode 100644 index 0000000..ded5792 Binary files /dev/null and b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/playmode-run-standalone.png differ diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/playmode-tab.png b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/playmode-tab.png new file mode 100644 index 0000000..9d315cb Binary files /dev/null and b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/playmode-tab.png differ diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/test-runner-window.png b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/test-runner-window.png new file mode 100644 index 0000000..f3023fb Binary files /dev/null and b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/test-runner-window.png differ diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/test-templates.png b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/test-templates.png new file mode 100644 index 0000000..753a155 Binary files /dev/null and b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/test-templates.png differ diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/tests-folder-assembly.png b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/tests-folder-assembly.png new file mode 100644 index 0000000..4e63751 Binary files /dev/null and b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/images/tests-folder-assembly.png differ diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/index.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/index.md new file mode 100644 index 0000000..79d623e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/index.md @@ -0,0 +1,54 @@ +# About Unity Test Framework + +The Unity Test Framework (UTF) enables Unity users to test their code in both **Edit Mode** and **Play Mode**, and also on target platforms such as [Standalone](https://docs.unity3d.com/Manual/Standalone.html), Android, iOS, etc. + +This package provides a standard test framework for users of Unity and developers at Unity so that both benefit from the same features and can write tests the same way. + +UTF uses a Unity integration of NUnit library, which is an open-source unit testing library for .Net languages. For more information about NUnit, see the [official NUnit website](http://www.nunit.org/) and the [NUnit documentation on GitHub](https://github.com/nunit/docs/wiki/NUnit-Documentation). + +> **Note**: UTF is not a new concept or toolset; it is an adjusted and more descriptive naming for the toolset otherwise known as Unity Test Runner, which is now available as this package. + +# Installing Unity Test Framework + +To install this package, follow the instructions in the [Package Manager documentation](https://docs.unity3d.com/Packages/com.unity.package-manager-ui@latest/index.html). + +> **Note**: Search for the Test Framework package. In Unity 2019.2 and higher, you may need to enable the package before use. + +# Using Unity Test Framework + +To learn how to use the Unity Test Framework package in your project, read the [manual](./manual.md). + +# Technical details + +## Requirements + +This version of the Unity Test Framework is compatible with the following versions of the Unity Editor: + +* 2019.2 and later. + +## Known limitations + +Unity Test Framework version 1.0.18 includes the following known limitations: + +* The `UnityTest` attribute does not support WebGL and WSA platforms. +* The `UnityTest` attribute does not support [Parameterized tests](https://github.com/nunit/docs/wiki/Parameterized-Tests) (except for `ValueSource`). +* The `UnityTest` attribute does not support the `NUnit` [Repeat](https://github.com/nunit/docs/wiki/Repeat-Attribute) attribute. +* Nested test fixture cannot run from the Editor UI. +* When using the `NUnit` [Retry](https://github.com/nunit/docs/wiki/Retry-Attribute) attribute in PlayMode tests, it throws `InvalidCastException`. + +## Package contents + +The following table indicates the root folders in the package where you can find useful resources: + +| Location | Description | +| :----------------------------------------- | :------------------------------------------ | +| _/com.unity.test-framework/Documentation~_ | Contains the documentation for the package. | + +## Document revision history + +| Date | Reason | +| :----------- | :---------------------------------------------------- | +| August 23, 2019 | Applied feedback to the documentation | +| July 25, 2019 | Documentation updated to include features in version 1.1.0 | +| July 11, 2019 | Documentation updated. Matches package version 1.0.18 | +| May 27, 2019 | Documentation created. Matches package version 1.0.14 | diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/manual.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/manual.md new file mode 100644 index 0000000..d634d4b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/manual.md @@ -0,0 +1,80 @@ +# Unity Test Framework manual + +This is the manual for the Unity Test Framework (UTF): + +## **Introduction** + +* [Unity Test Framework overview](./index.md) +* [Edit Mode vs. Play Mode tests](edit-mode-vs-play-mode-tests.md) + +## **Getting started** + +* [Getting started with UTF](./getting-started.md) + * Workflows: + * [How to create a new test assembly](./workflow-create-test-assembly.md) + * [How to create a test](./workflow-create-test.md) + * [How to run a test](workflow-run-test.md) + * [How to create a Play Mode test](./workflow-create-playmode-test.md) + * [How to run a Play Mode test in player](./workflow-run-playmode-test-standalone.md) +* [Resources](./resources.md) + +## Extending UTF + +* [Extending UTF](./extending.md) + * Workflows: + * [How to split the build and run process for standalone Play Mode tests](./reference-attribute-testplayerbuildmodifier.md#split-build-and-run) + * [How to run tests programmatically](./extension-run-tests.md) + * [How to get test results](./extension-get-test-results.md) + * [How to retrieve the list of tests](./extension-retrieve-test-list.md) + +## Reference + +* [Running tests from the command-line](./reference-command-line.md) +* [UnityTest attribute](./reference-attribute-unitytest.md) +* [Setup and cleanup at build time](./reference-setup-and-cleanup.md) + * [IPrebuildSetup](./reference-setup-and-cleanup.md#iprebuildsetup) + * [IPostBuildCleanup](./reference-setup-and-cleanup.md#ipostbuildcleanup) +* [Actions outside of tests](./reference-actions-outside-tests.md) + * [Action execution order](./reference-actions-outside-tests.md#action-execution-order) + * [UnitySetUp and UnityTearDown](./reference-actions-outside-tests.md#unitysetup-and-unityteardown) + * [OuterUnityTestAction](./reference-actions-outside-tests.md#outerunitytestaction) + * [Domain Reloads](./reference-actions-outside-tests.md#domain-reloads) +* [Custom attributes](./reference-custom-attributes.md) + * [ConditionalIgnore attribute](./reference-attribute-conditionalignore.md) + * [PostBuildCleanup attribute](./reference-setup-and-cleanup.md#prebuildsetup-and-postbuildcleanup) + * [PrebuildSetup attribute](./reference-setup-and-cleanup.md#prebuildsetup-and-postbuildcleanup) + * [TestMustExpectAllLogs attribute](./reference-attribute-testmustexpectalllogs.md) + * [TestPlayerBuildModifier attribute](./reference-attribute-testplayerbuildmodifier.md) + * [TestRunCallback attribute](./reference-attribute-testruncallback.md) + * [UnityPlatform attribute](./reference-attribute-unityplatform.md) + * [UnitySetUp attribute](./reference-actions-outside-tests.md#unitysetup-and-unityteardown) + * [UnityTearDown attribute](./reference-actions-outside-tests.md#unitysetup-and-unityteardown) + * [UnityTest attribute](./reference-attribute-unitytest.md) +* [Custom equality comparers](./reference-custom-equality-comparers.md) + * [ColorEqualityComparer](./reference-comparer-color.md) + * [FloatEqualityComparer](./reference-comparer-float.md) + * [QuaternionEqualityComparer](./reference-comparer-quaternion.md) + * [Vector2EqualityComparer](./reference-comparer-vector2.md) + * [Vector3EqualityComparer](./reference-comparer-vector3.md) + * [Vector4EqualityComparer](./reference-comparer-vector4.md) + * [Custom equality comparers with equals operator](./reference-comparer-equals.md) + * [Test Utils](./reference-test-utils.md) +* [Custom yield instructions](./reference-custom-yield-instructions.md) + * [IEditModeTestYieldInstruction](./reference-custom-yield-instructions.md#IEditModeTestYieldInstruction) + * [EnterPlayMode](./reference-custom-yield-instructions.md#enterplaymode) + * [ExitPlayMode](./reference-custom-yield-instructions.md#exitplaymode) +* [Custom assertion](./reference-custom-assertion.md) + * [LogAssert](./reference-custom-assertion.md#logassert) +* [Custom constraints](./reference-custom-constraints.md) + * [Is](./reference-custom-constraints.md#is) +* [Parameterized tests](./reference-tests-parameterized.md) +* [MonoBehaviour tests](./reference-tests-monobehaviour.md) + * [MonoBehaviourTest](./reference-tests-monobehaviour.md#monobehaviourtestt) + * [IMonoBehaviourTest](./reference-tests-monobehaviour.md#imonobehaviourtest) + +* [TestRunnerApi](./reference-test-runner-api.md) + * [ExecutionSettings](./reference-execution-settings.md) + * [Filter](./reference-filter.md) + * [ITestRunSettings](./reference-itest-run-settings.md) + * [ICallbacks](./reference-icallbacks.md) + * [IErrorCallbacks](./reference-ierror-callbacks.md) \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-actions-outside-tests.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-actions-outside-tests.md new file mode 100644 index 0000000..a999cfb --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-actions-outside-tests.md @@ -0,0 +1,98 @@ +# Actions outside of tests + +When writing tests, it is possible to avoid duplication of code by using the [SetUp and TearDown](https://github.com/nunit/docs/wiki/SetUp-and-TearDown) methods built into [NUnit](http://www.nunit.org/). The Unity Test Framework has extended these methods with extra functionality, which can yield commands and skip frames, in the same way as [UnityTest](./reference-attribute-unitytest.md). + +## Action execution order + +The actions related to a test run in the following order: + +* Attributes implementing [IApplyToContext](https://github.com/nunit/docs/wiki/IApplyToContext-Interface) +* Any attribute implementing [OuterUnityTestAction](#outerunitytestaction) has its `BeforeTest` invoked +* Tests with [UnitySetUp](#unitysetup-and-unityteardown) methods in their test class. +* Attributes implementing [IWrapSetUpTearDown](https://github.com/nunit/docs/wiki/ICommandWrapper-Interface) +* Any [SetUp](https://github.com/nunit/docs/wiki/SetUp-and-TearDown) attributes +* [Action attributes](https://nunit.org/docs/2.6/actionAttributes.html) have their `BeforeTest` method invoked +* Attributes implementing of [IWrapTestMethod](https://github.com/nunit/docs/wiki/ICommandWrapper-Interface) +* **The test itself runs** +* [Action attributes](https://nunit.org/docs/2.6/actionAttributes.html) have their `AfterTest` method invoked +* Any method with the [TearDown](https://github.com/nunit/docs/wiki/SetUp-and-TearDown) attribute +* Tests with [UnityTearDown](#unitysetup-and-unityteardown) methods in their test class +* Any [OuterUnityTestAction](#outerunitytestaction) has its `AfterTest` invoked + +The list of actions is the same for both `Test` and `UnityTest`. + +## UnitySetUp and UnityTearDown + +The `UnitySetUp` and `UnityTearDown` attributes are identical to the standard `SetUp` and `TearDown` attributes, with the exception that they allow for [yielding instructions](reference-custom-yield-instructions.md). The `UnitySetUp` and `UnityTearDown` attributes expect a return type of [IEnumerator](https://docs.microsoft.com/en-us/dotnet/api/system.collections.ienumerator?view=netframework-4.8). + +### Example + +```c# +public class SetUpTearDownExample +{ + [UnitySetUp] + public IEnumerator SetUp() + { + yield return new EnterPlayMode(); + } + + [Test] + public void MyTest() + { + Debug.Log("This runs inside playmode"); + } + + [UnitySetUp] + public IEnumerator TearDown() + { + + yield return new ExitPlayMode(); + } +} +``` + + + +## OuterUnityTestAction + +`OuterUnityTestAction` is a wrapper outside of the tests, which allows for any tests with this attribute to run code before and after the tests. This method allows for yielding commands in the same way as `UnityTest`. The attribute must inherit the `NUnit` attribute and implement `IOuterUnityTestAction`. + +### Example + +```c# +using System.Collections; +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using UnityEngine; +using UnityEngine.TestTools; + +public class MyTestClass +{ + [UnityTest, MyOuterActionAttribute] + public IEnumerator MyTestInsidePlaymode() + { + Assert.IsTrue(Application.isPlaying); + yield return null; + } +} + +public class MyOuterActionAttribute : NUnitAttribute, IOuterUnityTestAction +{ + public IEnumerator BeforeTest(ITest test) + { + yield return new EnterPlayMode(); + } + + public IEnumerator AfterTest(ITest test) + { + yield return new ExitPlayMode(); + } +} + +``` + + + +## Domain Reloads + +In **Edit Mode** tests it is possible to yield instructions that can result in a domain reload, such as entering or exiting **Play Mode** (see [Custom yield instructions](./reference-custom-yield-instructions.md)). When a domain reload happens, all non-Unity actions (such as `OneTimeSetup` and `Setup`) are rerun before the code, which initiated the domain reload, continues. Unity actions (such as `UnitySetup`) are not rerun. If the Unity action is the code that initiated the domain reload, then the rest of the code in the `UnitySetup` method runs after the domain reload. \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-conditionalignore.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-conditionalignore.md new file mode 100644 index 0000000..1d0d4ba --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-conditionalignore.md @@ -0,0 +1,39 @@ +# ConditionalIgnore attribute + +This attribute is an alternative to the standard `Ignore` attribute in [NUnit](http://www.nunit.org/). It allows for ignoring tests only under a specified condition. The condition evaluates during `OnLoad`, referenced by ID. + +## Example + +The following example shows a method to use the `ConditionalIgnore` attribute to ignore a test if the Unity Editor is running macOS: + +```C# +using UnityEditor; +using NUnit.Framework; +using UnityEngine.TestTools; + +[InitializeOnLoad] +public class OnLoad +{ + static OnLoad() + { + var editorIsOSX = false; + #if UNITY_EDITOR_OSX + editorIsOSX = true; + #endif + + ConditionalIgnoreAttribute.AddConditionalIgnoreMapping("IgnoreInMacEditor", editorIsOSX); + } +} + +public class MyTestClass +{ + [Test, ConditionalIgnore("IgnoreInMacEditor", "Ignored on Mac editor.")] + public void TestNeverRunningInMacEditor() + { + Assert.Pass(); + } +} + +``` + +> **Note**: You can only use `InitializeOnLoad` in **Edit Mode** tests. \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-testmustexpectalllogs.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-testmustexpectalllogs.md new file mode 100644 index 0000000..210cc10 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-testmustexpectalllogs.md @@ -0,0 +1,11 @@ +# TestMustExpectAllLogs attribute + +The presence of this attribute causes the **Test Runner** to expect every single log. By default, the Test Runner only fails on error logs, but `TestMustExpectAllLogs` fails on warnings and info level messages as well. It is the same as calling the method [LogAssert.NoUnexpectedReceived](./reference-custom-assertion.md#static-methods) at the bottom of every affected test. + +## Assembly-wide usage + +You can apply this attribute to test assemblies (that affects every test in the assembly), fixtures (affects every test in the fixture), or on individual test methods. It is also inherited from base fixtures. + +The `MustExpect` property (`true` by default) lets you enable or disable the higher level value. + +For example when migrating an assembly to this more strict checking method, you might attach `[assembly:TestMustExpectAllLogs]` to the assembly itself, but then whitelist failing fixtures and test methods with `[TestMustExpectAllLogs(MustExpect=false)]` until you have migrated them. This also means new tests in that assembly would have the more strict checking. \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-testplayerbuildmodifier.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-testplayerbuildmodifier.md new file mode 100644 index 0000000..e27b6c0 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-testplayerbuildmodifier.md @@ -0,0 +1,105 @@ +# TestPlayerBuildModifier attribute + +You can use the `TestPlayerBuildModifier` attribute to accomplish a couple of different scenarios: + +## Modify the Player build options for Play Mode tests + +It is possible to change the [BuildPlayerOptions](https://docs.unity3d.com/ScriptReference/BuildPlayerOptions.html) for the test **Player**, to achieve custom behavior when running **Play Mode** tests. Modifying the build options allows for changing the target location of the build as well as changing [BuildOptions](https://docs.unity3d.com/ScriptReference/BuildOptions.html). + +To modify the `BuildPlayerOptions`, do the following: + +* Implement the `ITestPlayerBuildModifier` +* Reference the implementation type in a `TestPlayerBuildModifier` attribute on an assembly level. + +### Example + +```c# +using UnityEditor; +using UnityEditor.TestTools; + +[assembly:TestPlayerBuildModifier(typeof(BuildModifier))] +public class BuildModifier : ITestPlayerBuildModifier +{ + public BuildPlayerOptions ModifyOptions(BuildPlayerOptions playerOptions) + { + if (playerOptions.target == BuildTarget.iOS) + { + playerOptions.options |= BuildOptions.SymlinkLibraries; // Enable symlink libraries when running on iOS + } + + playerOptions.options |= BuildOptions.AllowDebugging; // Enable allow Debugging flag on the test Player. + return playerOptions; + } +} +``` + +> **Note:** When building the Player, it includes all `TestPlayerBuildModifier` attributes across all loaded assemblies, independent of the currently used test filter. As the implementation references the `UnityEditor` namespace, the code is typically implemented in an Editor only assembly, as the `UnityEditor` namespace is not available otherwise. + +## Split build and run + +It is possible to use the Unity Editor for building the Player with tests, without [running the tests](./workflow-run-playmode-test-standalone.md). This allows for running the Player on e.g. another machine. In this case, it is necessary to modify the Player to build and implement a custom handling of the test result. + +By using `TestPlayerBuildModifier`, you can alter the `BuildOptions` to not start the Player after the build as well as build the Player at a specific location. Combined with [PostBuildCleanup](./reference-setup-and-cleanup.md#prebuildsetup-and-postbuildcleanup), you can automatically exit the Editor on completion of the build. + +### Example + +```c# +using System; +using System.IO; +using System.Linq; +using Tests; +using UnityEditor; +using UnityEditor.TestTools; +using UnityEngine; +using UnityEngine.TestTools; + +[assembly:TestPlayerBuildModifier(typeof(HeadlessPlayModeSetup))] +[assembly:PostBuildCleanup(typeof(HeadlessPlayModeSetup))] + +namespace Tests +{ + public class HeadlessPlayModeSetup : ITestPlayerBuildModifier, IPostBuildCleanup + { + private static bool s_RunningPlayerTests; + public BuildPlayerOptions ModifyOptions(BuildPlayerOptions playerOptions) + { + // Do not launch the player after the build completes. + playerOptions.options &= ~BuildOptions.AutoRunPlayer; + + // Set the headlessBuildLocation to the output directory you desire. It does not need to be inside the project. + var headlessBuildLocation = Path.GetFullPath(Path.Combine(Application.dataPath, ".//..//PlayModeTestPlayer")); + var fileName = Path.GetFileName(playerOptions.locationPathName); + if (!string.IsNullOrEmpty(fileName)) + { + headlessBuildLocation = Path.Combine(headlessBuildLocation, fileName); + } + playerOptions.locationPathName = headlessBuildLocation; + + // Instruct the cleanup to exit the Editor if the run came from the command line. + // The variable is static because the cleanup is being invoked in a new instance of the class. + s_RunningPlayerTests = true; + return playerOptions; + } + + public void Cleanup() + { + if (s_RunningPlayerTests && IsRunningTestsFromCommandLine()) + { + // Exit the Editor on the next update, allowing for other PostBuildCleanup steps to run. + EditorApplication.update += () => { EditorApplication.Exit(0); }; + } + } + + private static bool IsRunningTestsFromCommandLine() + { + var commandLineArgs = Environment.GetCommandLineArgs(); + return commandLineArgs.Any(value => value == "-runTests"); + } + } +} +``` + +If the Editor is still running after the Play Mode tests have run, the Player tries to report the results back, using [PlayerConnection](https://docs.unity3d.com/ScriptReference/Networking.PlayerConnection.PlayerConnection.html), which has a reference to the IP address of the Editor machine, when built. + +To implement a custom way of reporting the results of the test run, let one of the assemblies in the Player include a [TestRunCallback](./reference-attribute-testruncallback.md). At `RunFinished`, it is possible to get the full test report as XML from the [NUnit](http://www.nunit.org/) test result by calling `result.ToXml(true)`. You can save the result and then save it on the device or send it to another machine as needed. + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-testruncallback.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-testruncallback.md new file mode 100644 index 0000000..16cdfe6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-testruncallback.md @@ -0,0 +1,46 @@ +# TestRunCallback attribute + +It is possible for the test framework to invoke callbacks as the current test run progresses. To do this, there is a `TestRunCallback` attribute which takes the type of `ITestRunCallback` implementation. You can invoke the callbacks with [NUnit](http://www.nunit.org/) `ITest` and `ITestResult` classes. + +At the `RunStarted` and `RunFinished` methods, the test and test results are for the whole test tree. These methods invoke at each node in the test tree; first with the whole test assembly, then with the test class, and last with the test method. + +From these callbacks, it is possible to read the partial or the full results, and it is furthermore possible to save the XML version of the result for further processing or continuous integration. + +## Example + +```C# +using NUnit.Framework.Interfaces; +using UnityEngine; +using UnityEngine.TestRunner; + +[assembly:TestRunCallback(typeof(MyTestRunCallback))] + +public class MyTestRunCallback : ITestRunCallback +{ + public void RunStarted(ITest testsToRun) + { + + } + + public void RunFinished(ITestResult testResults) + { + + } + + public void TestStarted(ITest test) + { + + } + + public void TestFinished(ITestResult result) + { + if (!result.Test.IsSuite) + { + Debug.Log($"Result of {result.Name}: {result.ResultState.Status}"); + } + } +} + +``` + +> **Note:** The `TestRunCallback` does not need any references to the `UnityEditor` namespace and is thus able to run in standalone Players, on the **Player** side. \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-unityplatform.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-unityplatform.md new file mode 100644 index 0000000..4e08d1d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-unityplatform.md @@ -0,0 +1,35 @@ +# UnityPlatform attribute + +Use this attribute to define a specific set of platforms you want or do not want your test(s) to run on. + +You can use this attribute on the test method, test class, or test assembly level. Use the supported [RuntimePlatform](https://docs.unity3d.com/ScriptReference/RuntimePlatform.html) enumeration values to specify the platforms. You can also specify which platforms to test by passing one or more `RuntimePlatform` values along with or without the include or exclude properties as parameters to the [Platform](https://github.com/nunit/docs/wiki/Platform-Attribute) attribute constructor. + +The test(s) skips if the current target platform is: + +- Not explicitly specified in the included platforms list +- In the excluded platforms list + +```c# +using UnityEngine; +using UnityEngine.TestTools; +using NUnit.Framework; + +[TestFixture] +public class TestClass +{ + [Test] + [UnityPlatform(RuntimePlatform.WindowsPlayer)] + public void TestMethod() + { + Assert.AreEqual(Application.platform, RuntimePlatform.WindowsPlayer); + } +} +``` + +## Properties + +| Syntax | Description | +| --------------------------- | ------------------------------------------------------------ | +| `RuntimePlatform[] exclude` | List the platforms you do not want to have your tests run on. | +| `RuntimePlatform[] include` | A subset of platforms you need to have your tests run on. | + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-unitytest.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-unitytest.md new file mode 100644 index 0000000..3fcfbf1 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-attribute-unitytest.md @@ -0,0 +1,51 @@ +# UnityTest attribute + +`UnityTest` attribute is the main addition to the standard [NUnit](http://www.nunit.org/) library for the Unity Test Framework. This type of unit test allows you to skip a frame from within a test (so background tasks can finish) or give certain commands to the Unity **Editor**, such as performing a domain reload or entering **Play Mode** from an **Edit Mode** test. + +In Play Mode, the `UnityTest` attribute runs as a [coroutine](https://docs.unity3d.com/Manual/Coroutines.html). Whereas Edit Mode tests run in the [EditorApplication.update](https://docs.unity3d.com/ScriptReference/EditorApplication-update.html) callback loop. + +The `UnityTest` attribute is, in fact, an alternative to the `NUnit` [Test attribute](https://github.com/nunit/docs/wiki/Test-Attribute), which allows yielding instructions back to the framework. Once the instruction is complete, the test run continues. If you `yield return null`, you skip a frame. That might be necessary to ensure that some changes do happen on the next iteration of either the `EditorApplication.update` loop or the [game loop](https://docs.unity3d.com/Manual/ExecutionOrder.html). + +## Edit Mode example + +The most simple example of an Edit Mode test could be the one that yields `null` to skip the current frame and then continues to run: + +```C# +[UnityTest] +public IEnumerator EditorUtility_WhenExecuted_ReturnsSuccess() +{ + var utility = RunEditorUtilityInTheBackgroud(); + + while (utility.isRunning) + { + yield return null; + } + + Assert.IsTrue(utility.isSuccess); +} +``` + +## Play Mode example + +In Play Mode, a test runs as a coroutine attached to a [MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html). So all the yield instructions available in coroutines, are also available in your test. + +From a Play Mode test you can use one of Unity’s [Yield Instructions](https://docs.unity3d.com/ScriptReference/YieldInstruction.html): + +- [WaitForFixedUpdate](https://docs.unity3d.com/ScriptReference/WaitForFixedUpdate.html): to ensure changes expected within the next cycle of physics calculations. +- [WaitForSeconds](https://docs.unity3d.com/ScriptReference/WaitForSeconds.html): if you want to pause your test coroutine for a fixed amount of time. Be careful about creating long-running tests. + +The simplest example is to yield to `WaitForFixedUpdate`: + +```c# +[UnityTest] +public IEnumerator GameObject_WithRigidBody_WillBeAffectedByPhysics() +{ + var go = new GameObject(); + go.AddComponent(); + var originalPosition = go.transform.position.y; + + yield return new WaitForFixedUpdate(); + + Assert.AreNotEqual(originalPosition, go.transform.position.y); +} +``` diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-command-line.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-command-line.md new file mode 100644 index 0000000..90daa5c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-command-line.md @@ -0,0 +1,116 @@ +# Running tests from the command line + +It’s pretty simple to run a test project from the command line. Here is an example in Windows: + +```bash +Unity.exe -runTests -batchmode -projectPath PATH_TO_YOUR_PROJECT -testResults C:\temp\results.xml -testPlatform PS4 +``` + +For more information, see [Command line arguments](https://docs.unity3d.com/Manual/CommandLineArguments.html). + +## Commands + +### batchmode + +Runs Unity in batch mode and ensures no pop-up windows appear to eliminate the need for any human intervention. + +### forgetProjectPath + +Don't save your current **Project** into the Unity launcher/hub history. + +### runTests + +Runs tests in the Project. + +### testCategory + +A semicolon-separated list of test categories to include in the run. If using both `testFilter` and `testCategory`, then tests only run that matches both. + +### testFilter + +A semicolon-separated list of test names to run, or a regular expression pattern to match tests by their full name. + +### testPlatform + +The platform you want to run tests on. Available platforms are **EditMode** and **PlayMode**. + +> **Note**: If unspecified, tests run in Edit Mode by default. + +Platform/Type convention is from the [BuildTarget](https://docs.unity3d.com/ScriptReference/BuildTarget.html) enum. Supported platforms are: + +* StandaloneWindows +* StandaloneWindows64 +* StandaloneLinux64 +* StandaloneOSX +* iOS +* Android +* PS4 +* XboxOne + +### testResults + +The path where Unity should save the result file. By default, Unity saves it in the Project’s root folder. + +### playerHeartbeatTimeout + +The time, in seconds, the editor should wait for heartbeats after starting a test run on a player. This defaults to 10 minutes. + +### runSynchronously + +If included, the test run will run tests synchronously, guaranteeing that all tests runs in one editor update call. Note that this is only supported for EditMode tests, and that tests which take multiple frames (i.e. `[UnityTest]` tests, or tests with `[UnitySetUp]` or `[UnityTearDown]` scaffolding) will be filtered out. + +### testSettingsFile + +Path to a *TestSettings.json* file that allows you to set up extra options for your test run. An example of the *TestSettings.json* file could look like this: + +```json +{ + "scriptingBackend":2, + "Architecture":null, + "apiProfile":0 +} +``` + +#### apiProfile + +The .Net compatibility level. Set to one of the following values: + +- 1 - .Net 2.0 +- 2 - .Net 2.0 Subset +- 3 - .Net 4.6 +- 5 - .Net micro profile (used by Mono scripting backend if **Stripping Level** is set to **Use micro mscorlib**) +- 6 - .Net Standard 2.0 + +#### appleEnableAutomaticSigning + +Sets option for automatic signing of Apple devices. + +#### appleDeveloperTeamID + +Sets the team ID for the apple developer account. + +#### architecture + +Target architecture for Android. Set to one of the following values: + +* None = 0 +* ARMv7 = 1 +* ARM64 = 2 +* X86 = 4 +* All = 4294967295 + +#### iOSManualProvisioningProfileType + +Set to one of the following values: + +* 0 - Automatic +* 1 - Development +* 2 - Distribution iOSManualProvisioningProfileID + +#### scriptingBackend + + Set to one of the following values: + +- Mono2x = 0 +- IL2CPP = 1 +- WinRT DotNET = 2 \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-color.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-color.md new file mode 100644 index 0000000..0b2f911 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-color.md @@ -0,0 +1,47 @@ +# ColorEqualityComparer + +Use this class to compare two `Color` objects. `ColorEqualityComparer.Instance` has default calculation error value set to 0.01f. To set a test specific error value instantiate a comparer instance using the [one argument constructor](#constructors). + +## Static properties + +| Syntax | Description | +| ---------- | ------------------------------------------------------------ | +| `Instance` | A singleton instance of the comparer with a default error value set to 0.01f. | + +## Constructors + +| Syntax | Description | +| ------------------------------------ | ------------------------------------------------------------ | +| `ColorEqualityComparer(float error)` | Creates an instance of the comparer with a custom error value. | + +## Public methods + +| Syntax | Description | +| -------------------------------------------- | ------------------------------------------------------------ | +| `bool Equals(Color expected, Color actual);` | Compares the actual and expected `Color` objects for equality using `Utils.AreFloatsEqualAbsoluteError` to compare the `RGB` and `Alpha` attributes of `Color`. Returns `true` if expected and actual objects are equal otherwise, it returns `false`. | + +## Example + +```c# +[TestFixture] +public class ColorEqualityTest +{ + [Test] + public void GivenColorsAreEqual_WithAllowedCalculationError() + { + // Using default error + var firstColor = new Color(0f, 0f, 0f, 0f); + var secondColor = new Color(0f, 0f, 0f, 0f); + + Assert.That(firstColor, Is.EqualTo(secondColor).Using(ColorEqualityComparer.Instance)); + + // Allowed error 10e-5f + var comparer = new ColorEqualityComparer(10e-5f); + firstColor = new Color(0f, 0f, 0f, 1f); + secondColor = new Color(10e-6f, 0f, 0f, 1f); + + Assert.That(firstColor, Is.EqualTo(secondColor).Using(comparer)); + } +} +``` + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-equals.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-equals.md new file mode 100644 index 0000000..8ef8d85 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-equals.md @@ -0,0 +1,27 @@ +# Custom equality comparers with equals operator + +If you need to compare Vectors using the overloaded operator == (see [Vector2.operator ==](https://docs.unity3d.com/ScriptReference/Vector2-operator_eq.html), [Vector3.operator ==](https://docs.unity3d.com/ScriptReference/Vector3-operator_eq.html), and [Vector4.operator ==](https://docs.unity3d.com/ScriptReference/Vector4-operator_eq.html)) you should use the respective comparer implementations: + +- Vector2ComparerWithEqualsOperator +- Vector3ComparerWithEqualsOperator +- Vector4ComparerWithEqualsOperator + +The interface is the same as for other [equality comparers](./reference-custom-equality-comparers.md) except the public [constructor](./reference-custom-equality-comparers.md#constructors) `error` parameter is inapplicable in this case. + +## Example + +```c# +[TestFixture] +public class Vector3Test +{ + [Test] + public void VerifyThat_TwoVector3ObjectsAreEqual() + { + var actual = new Vector3(10e-7f, 10e-7f, 10e-7f); + var expected = new Vector3(0f, 0f, 0f); + + Assert.That(actual, Is.EqualTo(expected).Using(Vector3ComparerWithEqualsOperator.Instance)); + } +} +``` + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-float.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-float.md new file mode 100644 index 0000000..8118fd6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-float.md @@ -0,0 +1,46 @@ +# FloatEqualityComparer + +Use this class to compare two float values for equality with [NUnit](http://www.nunit.org/) constraints. Use `FloatEqualityComparer.Instance` comparer to have the default error value set to 0.0001f. For any other error, use the [one argument constructor](#constructors) to create a comparer. + +## Static Properties + +| Syntax | Description | +| ---------- | ------------------------------------------------------------ | +| `Instance` | A singleton instance of the comparer with a default error value set to 0.0001f. | + +## Constructors + +| Syntax | Description | +| ------------------------------------------- | ------------------------------------------------------------ | +| `FloatEqualityComparer(float allowedError)` | Creates an instance of the comparer with a custom error value. | + +## Public methods + +| Syntax | Description | +| -------------------------------------------- | ------------------------------------------------------------ | +| `bool Equals(float expected, float actual);` | Compares the `actual` and `expected` float values for equality using `Utils.AreFloatsEqual`. | + +## Example + +```c# +[TestFixture] +public class FloatsTest +{ + [Test] + public void VerifyThat_TwoFloatsAreEqual() + { + var comparer = new FloatEqualityComparer(10e-6f); + var actual = -0.00009f; + var expected = 0.00009f; + + Assert.That(actual, Is.EqualTo(expected).Using(comparer)); + + // Default relative error 0.0001f + actual = 10e-8f; + expected = 0f; + + Assert.That(actual, Is.EqualTo(expected).Using(FloatEqualityComparer.Instance)); + } +} +``` + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-quaternion.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-quaternion.md new file mode 100644 index 0000000..c55bb07 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-quaternion.md @@ -0,0 +1,46 @@ +# QuaternionEqualityComparer + +Use this utility to compare two [Quaternion](https://docs.unity3d.com/ScriptReference/Quaternion.html) objects for equality with [NUnit](http://www.nunit.org/) assertion constraints. Use the static instance `QuaternionEqualityComparer.Instance` to have the default calculation error value set to 0.00001f. For any other custom error value, use the [one argument constructor](#constructors). + +## Static properties + +| Syntax | Description | +| ---------- | ---------------------------------------------------------- | +| `Instance` | A comparer instance with the default error value 0.00001f. | + +## Constructors + +| Syntax | Description | +| ------------------------------------------------ | ------------------------------------------------------------ | +| `QuaternionEqualityComparer(float allowedError)` | Creates an instance of the comparer with a custom allowed error value. | + +## Public methods + +| Syntax | Description | +| ----------------------------------------------------- | ------------------------------------------------------------ | +| `bool Equals(Quaternion expected, Quaternion actual)` | Compares the `actual` and `expected` `Quaternion` objects for equality using the [Quaternion.Dot](https://docs.unity3d.com/ScriptReference/Quaternion.Dot.html) method. | + +## Example + +```c# +[TestFixture] +public class QuaternionTest +{ + [Test] + public void VerifyThat_TwoQuaternionsAreEqual() + { + var actual = new Quaternion(10f, 0f, 0f, 0f); + var expected = new Quaternion(1f, 10f, 0f, 0f); + var comparer = new QuaternionEqualityComparer(10e-6f); + + Assert.That(actual, Is.EqualTo(expected).Using(comparer)); + + //Using default error 0.00001f + actual = new Quaternion(10f, 0f, 0.1f, 0f); + expected = new Quaternion(1f, 10f, 0.1f, 0f); + + Assert.That(actual, Is.EqualTo(expected).Using(QuaternionEqualityComparer.Instance)); + } +} +``` + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-vector2.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-vector2.md new file mode 100644 index 0000000..ae091a6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-vector2.md @@ -0,0 +1,47 @@ +# Vector2EqualityComparer + +Use this class to compare two [Vector2](https://docs.unity3d.com/ScriptReference/Vector2.html) objects for equality with [NUnit](http://www.nunit.org/) constraints. Use the static `Vector2EqualityComparer.Instance` to have the calculation error value set to default 0.0001f. For any other error value, instantiate a new comparer object with the [one argument constructor](#constructors). + +## Static properties + +| Syntax | Description | +| ---------- | ------------------------------------------------------------ | +| `Instance` | A comparer instance with the default error value set to 0.0001f. | + +## Constructors + +| Syntax | Description | +| -------------------------------------- | ---------------------------------------------- | +| `Vector2EqualityComparer(float error)` | Creates an instance with a custom error value. | + +## Public methods + +| Syntax | Description | +| ------------------------------------------ | ------------------------------------------------------------ | +| `Equals(Vector2 expected, Vector2 actual)` | Compares the `actual` and `expected` `Vector2` objects for equality using the [Utils.AreFloatsEqual](./reference-test-utils.md) method. | + +## Example + +```c# +[TestFixture] +public class Vector2Test +{ + [Test] + public void VerifyThat_TwoVector2ObjectsAreEqual() + { + // Custom calculation error + var actual = new Vector2(10e-7f, 10e-7f); + var expected = new Vector2(0f, 0f); + var comparer = new Vector2EqualityComparer(10e-6f); + + Assert.That(actual, Is.EqualTo(expected).Using(comparer)); + + //Default error 0.0001f + actual = new Vector2(0.01f, 0.01f); + expected = new Vector2(0.01f, 0.01f); + + Assert.That(actual, Is.EqualTo(expected).Using(Vector2EqualityComparer.Instance)); + } +} +``` + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-vector3.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-vector3.md new file mode 100644 index 0000000..6160db6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-vector3.md @@ -0,0 +1,47 @@ +# Vector3EqualityComparer + +Use this class to compare two [Vector3](https://docs.unity3d.com/ScriptReference/Vector3.html) objects for equality with `NUnit` constraints. Call `Vector3EqualityComparer.Instance` comparer to perform a comparison with the default calculation error value 0.0001f. To specify a different error value, use the [one argument constructor](#constructors) to instantiate a new comparer. + +## Static properties + +| Syntax | Description | +| ---------- | ------------------------------------------------------------ | +| `Instance` | A comparer instance with the default calculation error value equal to 0.0001f. | + +## Constructors + +| Syntax | Description | +| --------------------------------------------- | ---------------------------------------------- | +| `Vector3EqualityComparer(float allowedError)` | Creates an instance with a custom error value. | + +## Public methods + +| Syntax | Description | +| ----------------------------------------------- | ------------------------------------------------------------ | +| `bool Equals(Vector3 expected, Vector3 actual)` | Compares the `actual` and `expected` `Vector3` objects for equality using [Utils.AreFloatsEqual](http://todo) to compare the `x`, `y`, and `z` attributes of `Vector3`. | + +## Example + +```c# +[TestFixture] +public class Vector3Test +{ + [Test] + public void VerifyThat_TwoVector3ObjectsAreEqual() + { + // Custom error 10e-6f + var actual = new Vector3(10e-8f, 10e-8f, 10e-8f); + var expected = new Vector3(0f, 0f, 0f); + var comparer = new Vector3EqualityComparer(10e-6f); + + Assert.That(actual, Is.EqualTo(expected).Using(comparer)); + + //Default error 0.0001f + actual = new Vector3(0.01f, 0.01f, 0f); + expected = new Vector3(0.01f, 0.01f, 0f); + + Assert.That(actual, Is.EqualTo(expected).Using(Vector3EqualityComparer.Instance)); + } +} +``` + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-vector4.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-vector4.md new file mode 100644 index 0000000..371e06b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-comparer-vector4.md @@ -0,0 +1,47 @@ +# Vector4EqualityComparer + +Use this class to compare two [Vector4](https://docs.unity3d.com/ScriptReference/Vector4.html) objects for equality with [NUnit](http://www.nunit.org/) constraints. Call `Vector4EqualityComparer.Instance` to perform comparisons using default calculation error value 0.0001f. To set a custom test value, instantiate a new comparer using the [one argument constructor](#constructor). + +## Static Properties + +| Syntax | Description | +| ---------------------------------- | ------------------------------------------------------------ | +| `Vector4EqualityComparer Instance` | A comparer instance with the default calculation error value set to 0.0001f. | + +## Constructors + +| Syntax | Description | +| --------------------------------------------- | ---------------------------------------------- | +| `Vector4EqualityComparer(float allowedError)` | Creates an instance with a custom error value. | + +## Public methods + +| Syntax | Description | +| ------------------------------------------------ | ------------------------------------------------------------ | +| `bool Equals(Vector4 expected, Vector4 actual);` | Compares the `actual` and `expected` `Vector4` objects for equality using [Utils.AreFloatsEqual](http://todo) to compare the `x`, `y`, `z`, and `w` attributes of `Vector4`. | + +## Example + +```c# +[TestFixture] +public class Vector4Test +{ + [Test] + public void VerifyThat_TwoVector4ObjectsAreEqual() + { + // Custom error 10e-6f + var actual = new Vector4(0, 0, 1e-6f, 1e-6f); + var expected = new Vector4(1e-6f, 0f, 0f, 0f); + var comparer = new Vector4EqualityComparer(10e-6f); + + Assert.That(actual, Is.EqualTo(expected).Using(comparer)); + + // Default error 0.0001f + actual = new Vector4(0.01f, 0.01f, 0f, 0f); + expected = new Vector4(0.01f, 0.01f, 0f, 0f); + + Assert.That(actual, Is.EqualTo(expected).Using(Vector4EqualityComparer.Instance)); + } +} +``` + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-assertion.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-assertion.md new file mode 100644 index 0000000..3ed9a25 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-assertion.md @@ -0,0 +1,66 @@ +# Custom assertion + +A test fails if Unity logs a message other than a regular log or warning message. Use [LogAssert](#logassert) to check for an expected message in the log so that the test does not fail when Unity logs the message. + +Use `LogAssert.Expect` before running the code under test, as the check for expected logs runs at the end of each frame. + +A test also reports a failure, if an expected message does not appear, or if Unity does not log any regular log or warning messages. + +## Example + +```c# +[Test] +public void LogAssertExample() +{ + // Expect a regular log message + LogAssert.Expect(LogType.Log, "Log message"); + + // The test fails without the following expected log message + Debug.Log("Log message"); + + // An error log + Debug.LogError("Error message"); + + // Without expecting an error log, the test would fail + LogAssert.Expect(LogType.Error, "Error message"); +} +``` + +## LogAssert + +`LogAssert` lets you expect Unity log messages that would otherwise cause the test to fail. + +### Static properties + +| Syntax | Description | +| ---------------------------- | ------------------------------------------------------------ | +| `bool ignoreFailingMessages` | Set this property to `true` to prevent unexpected error log messages from triggering an assertion. By default, it is `false`. | + +### Static Methods + +| Syntax | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| `void Expect(LogType type, string message);` `void Expect(LogType type, Regex message);` | Verifies that a log message of a specified type appears in the log. A test won’t fail from an expected error, assertion, or exception log message. It does fail if an expected message does not appear in the log. | +| `void NoUnexpectedReceived();` | Triggers an assertion when receiving any log messages and fails the test if some are unexpected messages. If multiple tests need to check for no received unexpected logs, consider using the [TestMustExpectAllLogs](./reference-attribute-testmustexpectalllogs.md) attribute instead. | + +### Expect string message + +`void Expect(LogType type, string message);` + +#### Parameters + +| Syntax | Description | +| ---------------- | ------------------------------------------------------------ | +| `LogType type` | A type of log to expect. It can take one of the [LogType enum](https://docs.unity3d.com/ScriptReference/LogType.html) values. | +| `string message` | A string value that should equate to the expected message. | + +### Expect Regex message + +`void Expect(LogType type, Regex message);` + +#### Parameters + +| Syntax | Description | +| --------------- | ------------------------------------------------------------ | +| `LogType type` | A type of log to expect. It can take one of the [LogType enum](https://docs.unity3d.com/ScriptReference/LogType.html) values. | +| `Regex message` | A regular expression pattern to match the expected message. | \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-attributes.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-attributes.md new file mode 100644 index 0000000..051de36 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-attributes.md @@ -0,0 +1,15 @@ +# Custom attributes + +As a part of UTF’s public API we provide the following attributes: + +* [ConditionalIgnore attribute](./reference-attribute-conditionalignore.md) +* [PostBuildCleanup attribute](./reference-setup-and-cleanup.md#prebuildsetup-and-postbuildcleanup) +* [PrebuildSetup attribute](./reference-setup-and-cleanup.md#prebuildsetup-and-postbuildcleanup) +* [TestMustExpectAllLogs attribute](./reference-attribute-testmustexpectalllogs.md) +* [TestPlayerBuildModifier attribute](./reference-attribute-testplayerbuildmodifier.md) +* [TestRunCallback attribute](./reference-attribute-testruncallback.md) +* [UnityPlatform attribute](./reference-attribute-unityplatform.md) +* [UnitySetUp attribute](./reference-actions-outside-tests.md#unitysetup-and-unityteardown) +* [UnityTearDown attribute](./reference-actions-outside-tests.md#unitysetup-and-unityteardown) +* [UnityTest attribute](./reference-attribute-unitytest.md) + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-constraints.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-constraints.md new file mode 100644 index 0000000..bbf4bbb --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-constraints.md @@ -0,0 +1,31 @@ +# Custom constraints + +`NUnit` allows you to write test assertions in a more descriptive and human readable way using the [Assert.That](https://github.com/nunit/docs/wiki/Assertions) mechanism, where the first parameter is an object under test and the second parameter describes conditions that the object has to meet. + +## Is + +We’ve extended `NUnit` API with a custom constraint type and declared an overlay `Is` class. To resolve ambiguity between the original implementation and the custom one you must explicitly declare it with a using statement or via addressing through the full type name `UnityEngine.TestTools.Constraints.Is`. + +### Static Methods + +| Syntax | Description | +| -------------------- | ------------------------------------------------------------ | +| `AllocatingGCMemory` | A constraint type that invokes the delegate you provide as the parameter of `Assert.That` and checks whether it causes any GC memory allocations. It passes if any GC memory is allocated and fails if not. | + +## Example + +```c# +using Is = UnityEngine.TestTools.Constraints.Is; + +class MyTestClass +{ + [Test] + public void MyTest() + { + Assert.That(() => { + var i = new int[500]; + }, Is.AllocatingGCMemory()); + } +} +``` + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-equality-comparers.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-equality-comparers.md new file mode 100644 index 0000000..15224f9 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-equality-comparers.md @@ -0,0 +1,32 @@ +# Custom equality comparers + +To enable easier verification of custom Unity type values in your tests we provide you with some custom equality comparers: + +* [ColorEqualityComparer](./reference-comparer-color.md) +* [FloatEqualityComparer](./reference-comparer-float.md) +* [QuaternionEqualityComparer](./reference-comparer-quaternion.md) +* [Vector2EqualityComparer](./reference-comparer-vector2.md) +* [Vector3EqualityComparer](./reference-comparer-vector3.md) +* [Vector4EqualityComparer](./reference-comparer-vector4.md) + +Use these classes to compare two objects of the same type for equality within the range of a given tolerance using [NUnit ](https://github.com/nunit/docs/wiki/Constraints)or [custom constraints](./reference-custom-constraints.md) . Call Instance to apply the default calculation error value to the comparison. To set a specific error value, instantiate a new comparer object using a one argument constructor `ctor(float error)`. + +## Static properties + +| Syntax | Description | +| ---------- | ------------------------------------------------------------ | +| `Instance` | A singleton instance of the comparer with a predefined default error value. | + +## Constructors + +| Syntax | Description | +| ------------------- | ------------------------------------------------------------ | +| `ctor(float error)` | Creates an instance of comparer with a custom error `value.allowedError`. The relative error to be considered while comparing two values. | + +## Public methods + +| Syntax | Description | +| ------------------------------------ | ------------------------------------------------------------ | +| `bool Equals(T expected, T actual);` | Compares the actual and expected objects for equality using a custom comparison mechanism. Returns `true` if expected and actual objects are equal, otherwise it returns `false`. | + + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-yield-instructions.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-yield-instructions.md new file mode 100644 index 0000000..60f22e4 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-custom-yield-instructions.md @@ -0,0 +1,60 @@ +# Custom yield instructions + +By implementing this interface below, you can define custom yield instructions in **Edit Mode** tests. + +## IEditModeTestYieldInstruction + +In an Edit Mode test, you can use `IEditModeTestYieldInstruction` interface to implement your own instruction. There are also a couple of commonly used implementations available: + +- [EnterPlayMode](#enterplaymode) +- [ExitPlayMode](#exitplaymode) +- [RecompileScripts](./reference-recompile-scripts.md) +- [WaitForDomainReload](./reference-wait-for-domain-reload.md) + +## Example + +```c# +[UnityTest] + +public IEnumerator PlayOnAwakeDisabled_DoesntPlayWhenEnteringPlayMode() + +{ + var videoPlayer = PrefabUtility.InstantiatePrefab(m_VideoPlayerPrefab.GetComponent()) as VideoPlayer; + + videoPlayer.playOnAwake = false; + + yield return new EnterPlayMode(); + + var videoPlayerGO = GameObject.Find(m_VideoPlayerPrefab.name); + + Assert.IsFalse(videoPlayerGO.GetComponent().isPlaying); + + yield return new ExitPlayMode(); + + Object.DestroyImmediate(GameObject.Find(m_VideoPlayerPrefab.name)); +} +``` + +## Properties + +| Syntax | Description | +| ---------------------------- | ------------------------------------------------------------ | +| `bool ExpectDomainReload` | Returns `true` if the instruction expects a domain reload to occur. | +| `bool ExpectedPlaymodeState` | Returns `true` if the instruction expects the Unity Editor to be in **Play Mode**. | + +## Methods + +| Syntax | Description | +| ----------------------- | ------------------------------------------------------------ | +| `IEnumerator Perform()` | Used to define multi-frame operations performed when instantiating a yield instruction. | + +## EnterPlayMode + +* Implements `IEditModeTestYieldInstruction`. Creates a yield instruction to enter Play Mode. +* When creating an Editor test that uses the `UnityTest` attribute, use this to trigger the Editor to enter Play Mode. +* Throws an exception if the Editor is already in Play Mode or if there is a [script compilation error](https://support.unity3d.com/hc/en-us/articles/205930539-How-do-I-interpret-a-compiler-error-). + +## ExitPlayMode + +* Implements `IEditModeTestYieldInstruction`. A new instance of the class is a yield instruction to exit Play Mode. +* Throws an exception if the Editor is not in Play Mode. diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-execution-settings.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-execution-settings.md new file mode 100644 index 0000000..752e936 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-execution-settings.md @@ -0,0 +1,17 @@ +# ExecutionSettings +The `ExecutionSettings` is a set of filters and other settings provided when running a set of tests from the [TestRunnerApi](./reference-test-runner-api.md). + +## Constructors + +| Syntax | Description | +| ----------------------------------------------------- | -------------------------------------------------------- | +| `ExecutionSettings(params Filter[] filtersToExecute)` | Creates an instance with a given set of filters, if any. | + +## Fields + +| Syntax | Description | +| ---------------------------- | ------------------------------------------------------------ | +| `Filter[] filters` | A collection of [Filters](./reference-filter.md) to execute tests on. | +| `ITestRunSettings overloadTestRunSettings` | An instance of [ITestRunSettings](./reference-itest-run-settings.md) to set up before running tests on a Player. | +| `bool runSynchronously` | If true, the call to `Execute()` will run tests synchronously, guaranteeing that all tests have finished running by the time the call returns. Note that this is only supported for EditMode tests, and that tests which take multiple frames (i.e. `[UnityTest]` tests, or tests with `[UnitySetUp]` or `[UnityTearDown]` scaffolding) will be filtered out. | +| 'int playerHeartbeatTimeout' | The time, in seconds, the editor should wait for heartbeats after starting a test run on a player. This defaults to 10 minutes. | \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-filter.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-filter.md new file mode 100644 index 0000000..5f6b535 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-filter.md @@ -0,0 +1,15 @@ +# Filter +The filter class provides the [TestRunnerApi](./reference-test-runner-api.md) with a specification of what tests to run when [running tests programmatically](./extension-run-tests.md). + +## Fields + +| Syntax | Description | +| ----------------------------- | ------------------------------------------------------------ | +| `TestMode testMode` | An enum flag that specifies if **Edit Mode** or **Play Mode** tests should run. Applying both Edit Mode and Play Mode is currently not supported when running tests from the API. | +| `string[] testNames` | The full name of the tests to match the filter. This is usually in the format `FixtureName.TestName`. If the test has test arguments, then include them in parenthesis. E.g. `MyTestClass2.MyTestWithMultipleValues(1)`. | +| `string[] groupNames` | The same as `testNames`, except that it allows for Regex. This is useful for running specific fixtures or namespaces. E.g. `"^MyNamespace\\."` Runs any tests where the top namespace is `MyNamespace`. | +| `string[] categoryNames` | The name of a [Category](https://nunit.org/docs/2.2.7/category.html) to include in the run. Any test or fixtures runs that have a `Category` matching the string. | +| `string[] assemblyNames` | The name of assemblies included in the run. That is the assembly name, without the .dll file extension. E.g., `MyTestAssembly`. | +| `BuildTarget? targetPlatform` | The [BuildTarget](https://docs.unity3d.com/ScriptReference/BuildTarget.html) platform to run the test on. If set to `null`, then the Editor is the target for the tests. | + + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-icallbacks.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-icallbacks.md new file mode 100644 index 0000000..fb907e7 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-icallbacks.md @@ -0,0 +1,48 @@ +# ICallbacks +An interface for receiving callbacks when running tests. All test runs invoke the callbacks until the next domain reload. + +The `RunStarted` method runs when the whole test run starts. Then the `TestStarted` method runs with information about the tests it is about to run on an assembly level. Afterward, it runs on a test fixture level and then on the individual test. If the test is a [parameterized test](./https://github.com/nunit/docs/wiki/Parameterized-Tests), then it is also invoked for each parameter combination. After each part of the test tree have completed running, the corresponding `TestFinished` method runs with the test result. At the end of the run, the `RunFinished` event runs with the test result. + +An extended version of the callback, [IErrorCallbacks](./reference-ierror-callbacks.md), extends this `ICallbacks` to receive calls when a run fails due to a build error. + +## Public methods + +| Syntax | Description | +| ---------------------------------------------- | ------------------------------------------------------------ | +| `void RunStarted(ITestAdaptor testsToRun)` | Invoked when the test run starts. The [ITestAdaptor](./reference-itest-adaptor.md) represents the tree of tests to run. | +| `void RunFinished(ITestResultAdaptor result)` | Invoked when the test run finishes. The [ITestResultAdaptor](./reference-itest-result-adaptor.md) represents the results of the set of tests that have run. | +| `void TestStarted(ITestAdaptor test)` | Invoked on each node of the test tree, as that part of the tree starts to run. | +| `void TestFinished(ITestResultAdaptor result)` | Invoked on each node of the test tree once that part of the test tree has finished running. The [ITestResultAdaptor](./reference-itest-result-adaptor.md) represents the results of the current node of the test tree. | + +## Example +An example that sets up a listener on the API. The listener prints the number of failed tests after the run has finished: +``` C# +public void SetupListeners() +{ + var api = ScriptableObject.CreateInstance(); + api.RegisterCallbacks(new MyCallbacks()); +} + +private class MyCallbacks : ICallbacks +{ + public void RunStarted(ITestAdaptor testsToRun) + { + + } + + public void RunFinished(ITestResultAdaptor result) + { + Debug.Log(string.Format("Run finished {0} test(s) failed.", result.FailCount)); + } + + public void TestStarted(ITestAdaptor test) + { + + } + + public void TestFinished(ITestResultAdaptor result) + { + + } +} +``` \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-ierror-callbacks.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-ierror-callbacks.md new file mode 100644 index 0000000..6924164 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-ierror-callbacks.md @@ -0,0 +1,9 @@ +# IErrorCallbacks +An extended version of the [ICallbacks](./reference-icallbacks.md), which get invoked if the test run fails due to a build error or if any [IPrebuildSetup](./reference-setup-and-cleanup.md) has a failure. + +## Public methods + +| Syntax | Description | +| ---------------------------- | ------------------------------------------------------------------- | +| void OnError(string message) | The error message detailing the reason for the run to fail. | + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-itest-adaptor.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-itest-adaptor.md new file mode 100644 index 0000000..77232be --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-itest-adaptor.md @@ -0,0 +1,31 @@ +# ITestAdaptor +`ITestAdaptor` is a representation of 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/ITest.cs) interface. + +## Properties + +| Syntax | Description | +| ---------- | ------------------------------------------------------------ | +| `string Id` | The ID of the test tree node. The ID can change if you add new tests to the suite. Use `UniqueName`, if you want to have a more permanent point of reference. | +| `string Name` | The name of the test. E.g., `MyTest`. | +| `string FullName` | The full name of the test. E.g., `MyNamespace.MyTestClass.MyTest`. | +| `int TestCaseCount` | The total number of test cases in the node and all sub-nodes. | +| `bool HasChildren` | Whether the node has any children. | +| `bool IsSuite` | Whether the node is a test suite/fixture. | +| `IEnumerable Children` | The child nodes. | +| `ITestAdaptor Parent` | The parent node, if any. | +| `int TestCaseTimeout` | The test case timeout in milliseconds. Note that this value is only available on TestFinished. | +| `ITypeInfo TypeInfo` | The type of test class as an `NUnit` [ITypeInfo](https://github.com/nunit/nunit/blob/master/src/NUnitFramework/framework/Interfaces/ITypeInfo.cs). If the node is not a test class, then the value is `null`. | +| `IMethodInfo Method` | The [Nunit IMethodInfo](https://github.com/nunit/nunit/blob/master/src/NUnitFramework/framework/Interfaces/IMethodInfo.cs) of the test method. If the node is not a test method, then the value is `null`. | +| `string[] Categories` | An array of the categories applied to the test or fixture. | +| `bool IsTestAssembly` | Whether the node represents a test assembly. | +| `RunState RunState` | The run state of the test node. Either `NotRunnable`, `Runnable`, `Explicit`, `Skipped`, or `Ignored`. | +| `string Description` | The description of the test. | +| `string SkipReason` | The skip reason. E.g., if ignoring the test. | +| `string ParentId` | The ID of the parent node. | +| `string ParentFullName` | The full name of the parent node. | +| `string UniqueName` | A unique generated name for the test node. E.g., `Tests.dll/MyNamespace/MyTestClass/[Tests][MyNamespace.MyTestClass.MyTest]`. | +| `string ParentUniqueName` | A unique name of the parent node. E.g., `Tests.dll/MyNamespace/[Tests][MyNamespace.MyTestClass][suite]`. | +| `int ChildIndex` | The child index of the node in its parent. | +| `TestMode TestMode` | The mode of the test. Either **Edit Mode** or **Play Mode**. | + +> **Note**: Some properties are not available when receiving the test tree as a part of a test result coming from a standalone Player, such as `TypeInfo` and `Method`. \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-itest-result-adaptor.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-itest-result-adaptor.md new file mode 100644 index 0000000..78ee231 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-itest-result-adaptor.md @@ -0,0 +1,25 @@ +# ITestResultAdaptor +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. +## Properties + +| Syntax | Description | +| ---------- | ------------------------------------------------------------ | +| `ITestAdaptor Test` | The test details of the test result tree node as a [TestAdaptor](./reference-itest-adaptor.md). | +| `string Name` | The name of the test node. | +| `string FullName` | Gets the full name of the test result | +| `string ResultState` | The state of the result as a string. E.g., `Success`, `Skipped`, `Failure`, `Explicit`, `Cancelled`. | +| `TestStatus TestStatus` | The status of the test as an enum. Either `Inconclusive`, `Skipped`, `Passed`, or `Failed`. | +| `double Duration` | Gets the elapsed time for running the test in seconds. | +| `DateTime StartTime` | Gets or sets the time the test started running. | +| `DateTime EndTime` | Gets or sets the time the test finished running. | +| `string Message` | Gets the message associated with a test failure or with not running the test | +| `string StackTrace` | Gets any stack trace associated with an error or failure. Not available in the [Compact Framework](https://en.wikipedia.org/wiki/.NET_Compact_Framework) 1.0. | +| `int AssertCount` | Gets the number of asserts that ran during the test and all its children. | +| `int FailCount` | Gets the number of test cases that failed when running the test and all its children. | +| `int PassCount` | Gets the number of test cases that passed when running the test and all its children. | +| `int SkipCount` | Gets the number of test cases skipped when running the test and all its children. | +| `int InconclusiveCount` | Gets the number of test cases that were inconclusive when running the test and all its children. | +| `bool HasChildren` | Indicates whether this result has any child results. Accessing HasChildren should not force the creation of the Children collection in classes implementing this interface. | +| `IEnumerable Children` | Gets the collection of child results. | +| `string Output` | Gets any text output written to this result. | +| `TNode ToXml` | Gets the test results as an `NUnit` XML node. Use this to save the results to an XML file. | diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-itest-run-settings.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-itest-run-settings.md new file mode 100644 index 0000000..7f7b06e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-itest-run-settings.md @@ -0,0 +1,29 @@ +# ITestRunSettings +`ITestRunSettings` lets you set any of the global settings right before building a Player for a test run and then reverts the settings afterward. +`ITestRunSettings` implements [IDisposable](https://docs.microsoft.com/en-us/dotnet/api/system.idisposable), and runs after building the Player with tests. + +## Public methods + +| Syntax | Description | +| ---------------- | ------------------------------------------------------------ | +| `void Apply()` | A method called before building the Player. | +| `void Dispose()` | A method called after building the Player or if the build failed. | + +## Example +The following example sets the iOS SDK version to be the simulator SDK and resets it to the original value after the run. +``` C# +public class MyTestSettings : ITestRunSettings +{ + private iOSSdkVersion originalSdkVersion; + public void Apply() + { + originalSdkVersion = PlayerSettings.iOS.sdkVersion; + PlayerSettings.iOS.sdkVersion = iOSSdkVersion.SimulatorSDK; + } + + public void Dispose() + { + PlayerSettings.iOS.sdkVersion = originalSdkVersion; + } +} +``` \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-recompile-scripts.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-recompile-scripts.md new file mode 100644 index 0000000..adead8e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-recompile-scripts.md @@ -0,0 +1,22 @@ +# RecompileScripts +`RecompileScripts` is an [IEditModeTestYieldInstruction](./reference-custom-yield-instructions.md) that you can yield in Edit Mode tests. It lets you trigger a recompilation of scripts in the Unity Editor. + +## Constructors + +| Syntax | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| `RecompileScripts(bool expectScriptCompilation = true, bool expectScriptCompilationSuccess = true)` | Creates a new instance of the `RecompileScripts` yield instruction. The parameter `expectScriptCompilation` indicates if you expect a script compilation to start (defaults to true). If a script compilation does not start and `expectScriptCompilation` is `true`, then it throws an exception. | + +## Example +``` C@ +[UnitySetUp] +public IEnumerator SetUp() +{ + using (var file = File.CreateText("Assets/temp/myScript.cs")) + { + file.Write("public class ATempClass { }"); + } + AssetDatabase.Refresh(); + yield return new RecompileScripts(); +} +``` \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-setup-and-cleanup.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-setup-and-cleanup.md new file mode 100644 index 0000000..1b8c862 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-setup-and-cleanup.md @@ -0,0 +1,91 @@ +# Setup and cleanup at build time + +In some cases, it is relevant to perform changes to Unity or the file system before building the tests. In the same way, it may be necessary to clean up such changes after the test run. In response to such needs, you can incorporate the pre-build setup and post-build cleanup concepts into your tests in one of the following ways: + +1. Via implementation of `IPrebuildSetup` and `IPostBuildCleanup` interfaces by a test class. +2. Via applying the `PrebuildSetup` attribute and `PostBuildCleanup` attribute on your test class, one of the tests or the test assembly, providing a class name that implements the corresponding interface as an argument (fx `[PrebuildSetup("MyTestSceneSetup")]`). + +## Execution order + +All setups run in a deterministic order one after another. The first to run are the setups defined with attributes. Then any test class implementing the interface runs, in alphabetical order inside their namespace, which is the same order as the tests run. + +> **Note**: Cleanup runs right away for a standalone test run, but only after related tests run in the Unity Editor. + +## PrebuildSetup and PostBuildCleanup + +Both `PrebuildSetup` and `PostBuildCleanup` attributes run if the respective test or test class is in the current test run. The test is included either by running all tests or setting a [filter](./workflow-create-test.md#filters) that includes the test. If multiple tests reference the same pre-built setup or post-build cleanup, then it only runs once. + +## IPrebuildSetup + +Implement this interface if you want to define a set of actions to run as a pre-build step. + +### Public methods + +| Syntax | Description | +| -------------- | ------------------------------------------------------------ | +| `void Setup()` | Implement this method to call actions automatically before the build process. | + +## IPostBuildCleanup + +Implement this interface if you want to define a set of actions to execute as a post-build step. Cleanup runs right away for a standalone test run, but only after all the tests run within the Editor. + +### Public methods + +| Syntax | Description | +| ---------------- | ------------------------------------------------------------ | +| `void Cleanup()` | Implement this method to specify actions that should run as a post-build cleanup step. | + +## Example + +```c# +[TestFixture] +public class CreateSpriteTest : IPrebuildSetup +{ + Texture2D m_Texture; + Sprite m_Sprite; + + public void Setup() + { + +#if UNITY_EDITOR + + var spritePath = "Assets/Resources/Circle.png"; + + var ti = UnityEditor.AssetImporter.GetAtPath(spritePath) as UnityEditor.TextureImporter; + + ti.textureCompression = UnityEditor.TextureImporterCompression.Uncompressed; + + ti.SaveAndReimport(); + +#endif + } + + [SetUp] + public void SetUpTest() + { + m_Texture = Resources.Load("Circle"); + } + + [Test] + public void WhenNullTextureIsPassed_CreateShouldReturnNullSprite() + { + + // Check with Valid Texture. + + LogAssert.Expect(LogType.Log, "Circle Sprite Created"); + + Sprite.Create(m_Texture, new Rect(0, 0, m_Texture.width, m_Texture.height), new Vector2(0.5f, 0.5f)); + + Debug.Log("Circle Sprite Created"); + + // Check with NULL Texture. Should return NULL Sprite. + + m_Sprite = Sprite.Create(null, new Rect(0, 0, m_Texture.width, m_Texture.heig`t), new Vector2(0.5f, 0.5f)); + + Assert.That(m_Sprite, Is.Null, "Sprite created with null texture should be null"); + + } +} +``` + +> **Tip**: Use `#if UNITY_EDITOR` if you want to access Editor only APIs, but the setup/cleanup is inside a **Play Mode** assembly. diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-test-runner-api.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-test-runner-api.md new file mode 100644 index 0000000..176530f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-test-runner-api.md @@ -0,0 +1,23 @@ +# TestRunnerApi +The `TestRunnerApi` retrieves and runs tests programmatically from code inside the project, or inside other packages. `TestRunnerApi` is a [ScriptableObject](https://docs.unity3d.com/ScriptReference/ScriptableObject.html). + +You can initialize the API like this: + +```c# +var testRunnerApi = ScriptableObject.CreateInstance(); +``` +> **Note**: You can subscribe and receive test results in one instance of the API, even if the run starts from another instance. + +The `TestRunnerApi` supports the following workflows: +* [How to run tests programmatically](./extension-run-tests.md) +* [How to get test results](./extension-get-test-results.md) +* [How to retrieve the list of tests](./extension-retrieve-test-list.md) + +## Public methods + +| Syntax | Description | +| ------------------------------------------ | ------------------------------------------------------------ | +| `void Execute(ExecutionSettings executionSettings)` | Starts a test run with a given set of [ExecutionSettings](./reference-execution-settings.md). | +| `void RegisterCallbacks(ICallbacks testCallbacks, int priority = 0)` | Sets up a given instance of [ICallbacks](./reference-icallbacks.md) to be invoked on test runs. | +| `void UnregisterCallbacks(ICallbacks testCallbacks)` | Unregisters an instance of ICallbacks to no longer receive callbacks from test runs. | +| `void RetrieveTestList(TestMode testMode, Action callback)` | Retrieve the full test tree as [ITestAdaptor](./reference-itest-adaptor.md) for a given test mode. | \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-test-utils.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-test-utils.md new file mode 100644 index 0000000..b73e02d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-test-utils.md @@ -0,0 +1,40 @@ +# Test Utils + +This contains test utility functions for float value comparison and creating primitives. + +## Static Methods + +| Syntax | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| `bool AreFloatsEqual(float expected, float actual, float allowedRelativeError)` | Relative epsilon comparison of two float values for equality. `allowedRelativeError` is the relative error to be used in relative epsilon comparison. The relative error is the absolute error divided by the magnitude of the exact value. Returns `true` if the actual value is equivalent to the expected value. | +| `bool AreFloatsEqualAbsoluteError(float expected, float actual, float allowedAbsoluteError)` | Compares two floating point numbers for equality under the given absolute tolerance. `allowedAbsoluteError` is the permitted error tolerance. Returns `true` if the actual value is equivalent to the expected value under the given tolerance. | +| `GameObject CreatePrimitive( type)` | Creates a [GameObject](https://docs.unity3d.com/ScriptReference/GameObject.html) with a primitive [MeshRenderer](https://docs.unity3d.com/ScriptReference/MeshRenderer.html). This is an analogue to the [GameObject.CreatePrimitive](https://docs.unity3d.com/ScriptReference/GameObject.CreatePrimitive.html), but creates a primitive `MeshRenderer` with a fast [Shader](https://docs.unity3d.com/ScriptReference/Shader.html) instead of the default built-in `Shader`, optimized for testing performance. `type` is the [primitive type](https://docs.unity3d.com/ScriptReference/PrimitiveType.html) of the required `GameObject`. Returns a `GameObject` with primitive `MeshRenderer` and [Collider](https://docs.unity3d.com/ScriptReference/Collider.html). | + +## Example + +```c# +[TestFixture] +class UtilsTests +{ + [Test] + public void ChechThat_FloatsAreEqual() + { + float expected = 10e-8f; + float actual = 0f; + float allowedRelativeError = 10e-6f; + + Assert.That(Utils.AreFloatsEqual(expected, actual, allowedRelativeError), Is.True); + } + + [Test] + public void ChechThat_FloatsAreAbsoluteEqual() + { + float expected = 0f; + float actual = 10e-6f; + float error = 10e-5f; + + Assert.That(Utils.AreFloatsEqualAbsoluteError(expected, actual, error), Is.True); + } +} +``` + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-tests-monobehaviour.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-tests-monobehaviour.md new file mode 100644 index 0000000..13959d5 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-tests-monobehaviour.md @@ -0,0 +1,51 @@ +# MonoBehaviour tests + +`MonoBehaviourTest` is a [coroutine](https://docs.unity3d.com/ScriptReference/Coroutine.html) and a helper for writing [MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html) tests. + +Yield a `MonoBehaviourTest` when using the `UnityTest` attribute to instantiate the `MonoBehaviour` you wish to test and wait for it to finish running. Implement the `IMonoBehaviourTest` interface on the `MonoBehaviour` to state when the test completes. + +## Example + +```c# +[UnityTest] +public IEnumerator MonoBehaviourTest_Works() +{ + yield return new MonoBehaviourTest(); +} + +public class MyMonoBehaviourTest : MonoBehaviour, IMonoBehaviourTest +{ + private int frameCount; + public bool IsTestFinished + { + get { return frameCount > 10; } + } + + void Update() + { + frameCount++; + } +} +``` + +## MonoBehaviourTest<T> + +This is a wrapper that allows running tests on `MonoBehaviour` scripts. Inherits from [CustomYieldInstruction](https://docs.unity3d.com/ScriptReference/CustomYieldInstruction.html). + +### Properties + +| Syntax | Description | +| ----------------------- | ------------------------------------------------------------ | +| `T component` | A `MonoBehaviour` component created for the test and attached to the test’s [GameObject](https://docs.unity3d.com/ScriptReference/GameObject.html). | +| `GameObject gameObject` | A `GameObject` created as a container for the test component. | +| `bool keepWaiting` | (Inherited) Returns `true` if the test is not finished yet, which keeps the coroutine suspended. | + +## IMonoBehaviourTest + +An interface implemented by a `MonoBehaviour` test. + +### Properties + +| Syntax | Description | +| --------------------- | ----------------------------------------------- | +| `bool IsTestFinished` | Indicates when the test is considered finished. | \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-tests-parameterized.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-tests-parameterized.md new file mode 100644 index 0000000..48173d8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-tests-parameterized.md @@ -0,0 +1,18 @@ +# Parameterized tests + +For data-driven testing, you may want to have your tests parameterized. You may use both the [NUnit](http://www.nunit.org/) attributes [TestCase](https://github.com/nunit/docs/wiki/TestCase-Attribute) and [ValueSource](https://github.com/nunit/docs/wiki/ValueSource-Attribute) with a unit test. + +> **Note**: With `UnityTest` it is recommended to use `ValueSource` since `TestCase` is not supported. + +## Example + +```c# +static int[] values = new int[] { 1, 5, 6 }; + +[UnityTest] +public IEnumerator MyTestWithMultipleValues([ValueSource("values")] int value) +{ + yield return null; +} +``` + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-wait-for-domain-reload.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-wait-for-domain-reload.md new file mode 100644 index 0000000..002ee82 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/reference-wait-for-domain-reload.md @@ -0,0 +1,19 @@ +# WaitForDomainReload +`WaitForDomainReload` is an [IEditModeTestYieldInstruction](./reference-custom-yield-instructions.md) that you can yield in Edit Mode tests. It delays the execution of scripts until after an incoming domain reload. If the domain reload results in a script compilation failure, then it throws an exception. + +## Constructors + +| Syntax | Description | +| ---------------------------- | ------------------------------------------------------------ | +| `WaitForDomainReload()` | Create a new instance of the `WaitForDomainReload` yield instruction. | + +## Example +``` C@ +[UnitySetUp] +public IEnumerator SetUp() +{ + File.Copy("Resources/MyDll.dll", @"Assets/MyDll.dll", true); // Trigger a domain reload. + AssetDatabase.Refresh(); + yield return new WaitForDomainReload(); +} +``` \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/resources.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/resources.md new file mode 100644 index 0000000..6cb3200 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/resources.md @@ -0,0 +1,6 @@ +# Resources + +Here you can find other related resources to the Unity Test Framework: + +* [Performance Benchmarking in Unity: How to Get Started](https://blogs.unity3d.com/2018/09/25/performance-benchmarking-in-unity-how-to-get-started/) [Blog] +* [Testing Test-Driven Development with the Unity Test Runner](https://blogs.unity3d.com/2018/11/02/testing-test-driven-development-with-the-unity-test-runner/) [Blog] \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-create-playmode-test.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-create-playmode-test.md new file mode 100644 index 0000000..d5fb3eb --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-create-playmode-test.md @@ -0,0 +1,28 @@ +# Workflow: How to create a Play Mode test + +To create a **Play Mode** test, you can follow a similar process as when you want to create an **Edit Mode** test. + +1. Start with switching to the **PlayMode** tab in the **Test Runner** window. +2. Create a test assembly folder (see [How to create a new test assembly)](./workflow-create-test-assembly.md). The folder name is *Tests* by default (or *Tests 1*, *Tests 2*, etc. if the preceding name is already in use). + +![PlayMode tab](./images/playmode-tab.png) + +> **Note**: If you don’t see the **Create Play Mode Test Assembly Folder** button enabled, make sure that in the Project window you navigate out of a folder with another .asmdef (such as one for Edit Mode tests). + +3. When you have your Play Mode test assembly folder ready, then [create your Play Mode test](./workflow-create-test.md). + +> **Note**: [Pre-defined Unity assemblies](https://docs.unity3d.com/Manual/ScriptCompileOrderFolders.html) (such as _Assembly-CSharp.dll_) do not reference your new assembly. + +## References and builds + +Unity Test Framework adds a reference to `TestAssemblies` in the [Assembly Definition](https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html) file, but it won't include any other references (e.g., to other scripting assemblies within the Unity project). So you need to add other assemblies yourself if you want to test them too. + +Unity does not include `TestAssemblies` in Player builds, but in the Test Runner window, we have such an option. If you need to test code in pre-defined assemblies, you can reference `TestAssemblies` from other assemblies. You must remove these tests after the test run so that Unity does not add them to the final Player build. + +To do this, in the Test Runner window choose **Enable playmode tests for all assemblies** option from the drop-down menu (to expand, click on the small list item in the top right corner). In the dialog box, click **OK** to manually restart the Editor. + +![Enable Play Mode tests for all assemblies](./images/playmode-enable-all.png) + +> **Note**: **Enabling Play Mode tests for all assemblies** includes additional assemblies in your project build, which can increase the project’s size as well as the build time. + +For more information, see [Edit Mode vs. Play Mode tests](./edit-mode-vs-play-mode-tests.md). \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-create-test-assembly.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-create-test-assembly.md new file mode 100644 index 0000000..778a4d6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-create-test-assembly.md @@ -0,0 +1,17 @@ +# Workflow: **How to create a new test assembly** + +Unity Test Framework looks for a test inside any assembly that references [NUnit](http://www.nunit.org/). We refer to such assemblies as `TestAssemblies`. The [Test Runner](./getting-started.md) UI can help you set up `TestAssemblies`. **Play Mode** and **Edit Mode** tests need to be in separate assemblies. + +In the **Test Runner** window, you will see an **EditMode** tab enabled by default, as well as a **Create EditMode Test Assembly Folder** button. + +![Test Runner window EditMode tab](./images/editmode-tab.png) + +Click the button to create a *Tests* folder with a respective .asmdef file by default. Change the name of the new [Assembly Definition](https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html), if necessary, and press Enter to accept it. + +![New Test folder and assembly file](./images/tests-folder-assembly.png) + +In the Inspector window, it should have references to **nunit.framework.dll***,* **UnityEngine.TestRunner,** and **UnityEditor.TestRunner** assemblies, as well as **Editor** preselected as a target platform. + +> **Note**: The **UnityEditor.TestRunner** reference is only available for [Edit Mode tests](./edit-mode-vs-play-mode-tests.md#edit-mode-tests). + +![Assembly definition import settings](./images/import-settings.png) diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-create-test.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-create-test.md new file mode 100644 index 0000000..94f992a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-create-test.md @@ -0,0 +1,36 @@ +# Workflow: How to create a test + +To create a test, do the following: + +1. Create your *Test* [assembly folder](./workflow-create-test-assembly.md) and select it in the **Project** window. +2. Click the button **Create Test Script in current folder** option in the **Test Runner** window. + +![EditMode create test script](./images/editmode-create-test-script.png) + +3. It creates a *NewTestScript.cs* file in the *Tests* folder. Change the name of the script, if necessary, and press Enter to accept it. + +![NewTestScript.cs](./images/new-test-script.png) + +Now you’ll see two sample tests in the Test Runner window: + +![Test templates](./images/test-templates.png) + +Now you can open the tests in your favorite script editor. + +You can also create test scripts by navigating to **Assets** > **Create > Testing** > **C# Test Script**, unless adding a test script would result in a compilation error. + +> **Note**: Unity does not include `TestAssemblies` ([NUnit](http://www.nunit.org/), Unity Test Framework, and user script assemblies) when using the normal build pipeline, but does include them when using **Run on <Platform>** in the Test Runner window. + +## Filters + +If you have a lot of tests, and you only want to view/run a sub-set of them, you can filter them in three ways (see image above): + +* Type in the search box in the top left + +* Click a test class or fixture (such as **NewTestScript** in the image above) + +* Click one of the test result icon buttons in the top right + + + +For more information, see [Edit Mode vs. Play Mode tests](./edit-mode-vs-play-mode-tests.md). diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-run-playmode-test-standalone.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-run-playmode-test-standalone.md new file mode 100644 index 0000000..13f620c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-run-playmode-test-standalone.md @@ -0,0 +1,21 @@ +# Workflow: How to run a Play Mode test in player + +If you run a **Play Mode** test in the same way as an [Editor test](./workflow-run-test.md), it runs inside the Unity Editor. You can also run Play Mode tests on specific platforms. Click **Run all in the player** to build and run your tests on the currently active target platform. + +![Run PlayMode test in player](./images/playmode-run-standalone.png) + +> **Note**: Your current platform displays in brackets on the button. For example, in the image above, the button reads **Run all in player (StandaloneWindows)**, because the current platform is Windows. The target platform is always the current Platform selected in [Build Settings](https://docs.unity3d.com/Manual/BuildSettings.html) (menu: **File** > **Build Settings**). + +The test result displays in the build once the test completes: + +![Results of PlayMode in player test run](./images/playmode-results-standalone.png) + +The application running on the platform reports back the test results to the Editor UI then displays the executed tests and shuts down. To make sure you receive the test results from the Player on your target platform back into the Editor that’s running the test, both should be on the same network. + +> **Note:** Some platforms do not support shutting down the application with `Application.Quit`, so it will continue running after reporting the test results. + +If Unity cannot instantiate the connection, you can see the tests succeed in the running application. Running tests on platforms with arguments, in this state, does not provide XML test results. + + + +For more information, see [Edit Mode vs Play Mode tests](./edit-mode-vs-play-mode-tests.md). \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-run-test.md b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-run-test.md new file mode 100644 index 0000000..87b7650 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/Documentation~/workflow-run-test.md @@ -0,0 +1,19 @@ +# Workflow: How to run a test + +To run a test, you need to double-click on the test or test fixture name in the **Test Runner** window. + +You can also use one of the buttons on the top bar, **Run All** or **Run Selected**. As a result, you’ll see the test status icon changed and a counter in the top right corner updated: + +![EditMode Run Test](./images/editmode-run-test.png) + +You may also use a context menu option **Run**, right-click on any item in the test tree to have it (with all its children if any) run. + +![EditMode Run Tests](./images/editmode-run-tests.png) + + + +## Run tests within Rider + +It is possible to run unit tests in the Unity Test Framework directly from [JetBrains Rider](https://www.jetbrains.com/rider/). + +For more information, see the [JetBrains official documentation](https://www.jetbrains.com/help/rider/Running_and_Debugging_Unity_Tests.html) and their blog post [Run Unity tests in Rider 2018.1](https://blog.jetbrains.com/dotnet/2018/04/18/run-unity-tests-rider-2018-1/). \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/LICENSE.md b/Library/PackageCache/com.unity.test-framework@1.1.11/LICENSE.md new file mode 100644 index 0000000..1819021 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/LICENSE.md @@ -0,0 +1,5 @@ +Test Framework copyright © 2020 Unity Technologies ApS + +Licensed under the Unity Companion License for Unity-dependent projects--see [Unity Companion License](http://www.unity3d.com/legal/licenses/Unity_Companion_License). + +Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the license for details on these and other terms and conditions. diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/LICENSE.md.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/LICENSE.md.meta new file mode 100644 index 0000000..5ab3061 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/LICENSE.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3ec7596410385054a9e0bc90377fbe63 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner.meta new file mode 100644 index 0000000..9cfa638 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 95cdf27b47eb82747ba9e51f41e72a35 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api.meta new file mode 100644 index 0000000..ea66e70 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fa423365b1ce06a4dbdc6fb4a8597bfa +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksDelegator.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksDelegator.cs new file mode 100644 index 0000000..9418464 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksDelegator.cs @@ -0,0 +1,136 @@ +using System; +using System.Linq; +using System.Text; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using UnityEngine; +using UnityEngine.TestRunner.TestLaunchers; + +namespace UnityEditor.TestTools.TestRunner.Api +{ + internal class CallbacksDelegator : ICallbacksDelegator + { + private static CallbacksDelegator s_instance; + public static CallbacksDelegator instance + { + get + { + if (s_instance == null) + { + s_instance = new CallbacksDelegator(CallbacksHolder.instance.GetAll, new TestAdaptorFactory()); + } + return s_instance; + } + } + + private readonly Func m_CallbacksProvider; + private readonly ITestAdaptorFactory m_AdaptorFactory; + + public CallbacksDelegator(Func callbacksProvider, ITestAdaptorFactory adaptorFactory) + { + m_CallbacksProvider = callbacksProvider; + m_AdaptorFactory = adaptorFactory; + } + + public void RunStarted(ITest testsToRun) + { + m_AdaptorFactory.ClearResultsCache(); + var testRunnerTestsToRun = m_AdaptorFactory.Create(testsToRun); + TryInvokeAllCallbacks(callbacks => callbacks.RunStarted(testRunnerTestsToRun)); + } + + public void RunStartedRemotely(byte[] testsToRunData) + { + var testData = Deserialize(testsToRunData); + var testsToRun = m_AdaptorFactory.BuildTree(testData); + TryInvokeAllCallbacks(callbacks => callbacks.RunStarted(testsToRun)); + } + + public void RunFinished(ITestResult testResults) + { + var testResult = m_AdaptorFactory.Create(testResults); + TryInvokeAllCallbacks(callbacks => callbacks.RunFinished(testResult)); + } + + public void RunFinishedRemotely(byte[] testResultsData) + { + var remoteTestResult = Deserialize(testResultsData); + var testResult = m_AdaptorFactory.Create(remoteTestResult.results.First(), remoteTestResult); + TryInvokeAllCallbacks(callbacks => callbacks.RunFinished(testResult)); + } + + public void RunFailed(string failureMessage) + { + Debug.LogError(failureMessage); + TryInvokeAllCallbacks(callbacks => + { + var errorCallback = callbacks as IErrorCallbacks; + if (errorCallback != null) + { + errorCallback.OnError(failureMessage); + } + }); + } + + public void TestStarted(ITest test) + { + var testRunnerTest = m_AdaptorFactory.Create(test); + TryInvokeAllCallbacks(callbacks => callbacks.TestStarted(testRunnerTest)); + } + + public void TestStartedRemotely(byte[] testStartedData) + { + var testData = Deserialize(testStartedData); + var testsToRun = m_AdaptorFactory.BuildTree(testData); + + TryInvokeAllCallbacks(callbacks => callbacks.TestStarted(testsToRun)); + } + + public void TestFinished(ITestResult result) + { + var testResult = m_AdaptorFactory.Create(result); + TryInvokeAllCallbacks(callbacks => callbacks.TestFinished(testResult)); + } + + public void TestFinishedRemotely(byte[] testResultsData) + { + var remoteTestResult = Deserialize(testResultsData); + var testResult = m_AdaptorFactory.Create(remoteTestResult.results.First(), remoteTestResult); + TryInvokeAllCallbacks(callbacks => callbacks.TestFinished(testResult)); + } + + public void TestTreeRebuild(ITest test) + { + m_AdaptorFactory.ClearTestsCache(); + var testAdaptor = m_AdaptorFactory.Create(test); + TryInvokeAllCallbacks(callbacks => + { + var rebuildCallbacks = callbacks as ITestTreeRebuildCallbacks; + if (rebuildCallbacks != null) + { + rebuildCallbacks.TestTreeRebuild(testAdaptor); + } + }); + } + + private void TryInvokeAllCallbacks(Action callbackAction) + { + foreach (var testRunnerApiCallback in m_CallbacksProvider()) + { + try + { + callbackAction(testRunnerApiCallback); + } + catch (Exception ex) + { + Debug.LogException(ex); + } + } + } + + private static T Deserialize(byte[] data) + { + return JsonUtility.FromJson(Encoding.UTF8.GetString(data)); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksDelegator.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksDelegator.cs.meta new file mode 100644 index 0000000..5225c54 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksDelegator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0de03ebd74e2b474fa23d05ab42d0cd8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksDelegatorListener.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksDelegatorListener.cs new file mode 100644 index 0000000..b3cb5b8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksDelegatorListener.cs @@ -0,0 +1,28 @@ +using UnityEngine; +using UnityEngine.TestTools.TestRunner; + +namespace UnityEditor.TestTools.TestRunner.Api +{ + internal class CallbacksDelegatorListener : ScriptableObject, ITestRunnerListener + { + public void RunStarted(NUnit.Framework.Interfaces.ITest testsToRun) + { + CallbacksDelegator.instance.RunStarted(testsToRun); + } + + public void RunFinished(NUnit.Framework.Interfaces.ITestResult testResults) + { + CallbacksDelegator.instance.RunFinished(testResults); + } + + public void TestStarted(NUnit.Framework.Interfaces.ITest test) + { + CallbacksDelegator.instance.TestStarted(test); + } + + public void TestFinished(NUnit.Framework.Interfaces.ITestResult result) + { + CallbacksDelegator.instance.TestFinished(result); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksDelegatorListener.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksDelegatorListener.cs.meta new file mode 100644 index 0000000..7bed372 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksDelegatorListener.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f3e1b3cbf3fac6a459b1a602167ad311 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksHolder.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksHolder.cs new file mode 100644 index 0000000..91acb8c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksHolder.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace UnityEditor.TestTools.TestRunner.Api +{ + internal class CallbacksHolder : ScriptableSingleton, ICallbacksHolder + { + private List m_Callbacks = new List(); + public void Add(ICallbacks callback, int priority) + { + m_Callbacks.Add(new CallbackWithPriority(callback, priority)); + } + + public void Remove(ICallbacks callback) + { + m_Callbacks.RemoveAll(callbackWithPriority => callbackWithPriority.Callback == callback); + } + + public ICallbacks[] GetAll() + { + return m_Callbacks.OrderByDescending(callback => callback.Priority).Select(callback => callback.Callback).ToArray(); + } + + public void Clear() + { + m_Callbacks.Clear(); + } + + private struct CallbackWithPriority + { + public ICallbacks Callback; + public int Priority; + public CallbackWithPriority(ICallbacks callback, int priority) + { + Callback = callback; + Priority = priority; + } + } + + // Sometimes - such as when we want to test the test framework itself - it's necessary to launch a test run from + // inside a test. Because callbacks are registered globally, this can cause a lot of confusion (e.g. the in-test + // run will emit UTP messages, utterly confusing UTR). In such circumstances the safest thing to do is to + // temporarily suppress all registered callbacks for the duration of the in-test run. This method can be called + // to set up a using() block which will suppress the callbacks for the scope. + public IDisposable TemporarilySuppressCallbacks() + { + return new Suppressor(this); + } + + private sealed class Suppressor : IDisposable + { + private readonly CallbacksHolder _instance; + private readonly List _suppressed; + + public Suppressor(CallbacksHolder instance) + { + _instance = instance; + _suppressed = new List(instance.m_Callbacks); + instance.m_Callbacks.Clear(); + } + + public void Dispose() + { + _instance.m_Callbacks.AddRange(_suppressed); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksHolder.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksHolder.cs.meta new file mode 100644 index 0000000..1896ba8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksHolder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4884ccc3528cb2e40a0e6f0a19a2b35b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ExecutionSettings.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ExecutionSettings.cs new file mode 100644 index 0000000..2dd115a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ExecutionSettings.cs @@ -0,0 +1,57 @@ +using System; +using System.Linq; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal.Filters; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner.Api +{ + [Serializable] + public class ExecutionSettings + { + public ExecutionSettings(params Filter[] filtersToExecute) + { + filters = filtersToExecute; + } + + [SerializeField] + internal BuildTarget? targetPlatform; + + // Note: Is not available after serialization + public ITestRunSettings overloadTestRunSettings; + + [SerializeField] + internal Filter filter; + [SerializeField] + public Filter[] filters; + [SerializeField] + public bool runSynchronously; + [SerializeField] + public int playerHeartbeatTimeout = 60*10; + + internal bool EditModeIncluded() + { + return filters.Any(f => IncludesTestMode(f.testMode, TestMode.EditMode)); + } + + internal bool PlayModeInEditorIncluded() + { + return filters.Any(f => IncludesTestMode(f.testMode, TestMode.PlayMode) && targetPlatform == null); + } + + internal bool PlayerIncluded() + { + return filters.Any(f => IncludesTestMode(f.testMode, TestMode.PlayMode) && targetPlatform != null); + } + + private static bool IncludesTestMode(TestMode testMode, TestMode modeToCheckFor) + { + return (testMode & modeToCheckFor) == modeToCheckFor; + } + + internal ITestFilter BuildNUnitFilter() + { + return new OrFilter(filters.Select(f => f.BuildNUnitFilter(runSynchronously)).ToArray()); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ExecutionSettings.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ExecutionSettings.cs.meta new file mode 100644 index 0000000..7036257 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ExecutionSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eea34a28297f9bc4c9f4c573bc8d5d1c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/Filter.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/Filter.cs new file mode 100644 index 0000000..bc10b01 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/Filter.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Filters; +using UnityEngine; +using UnityEngine.TestRunner.NUnitExtensions.Filters; +using UnityEngine.TestTools.TestRunner.GUI; + +namespace UnityEditor.TestTools.TestRunner.Api +{ + [Serializable] + public class Filter + { + [SerializeField] + public TestMode testMode; + [SerializeField] + public string[] testNames; + [SerializeField] + public string[] groupNames; + [SerializeField] + public string[] categoryNames; + [SerializeField] + public string[] assemblyNames; + [SerializeField] + public BuildTarget? targetPlatform; + + internal TestRunnerFilter ToTestRunnerFilter() + { + return new TestRunnerFilter() + { + testNames = testNames, + categoryNames = categoryNames, + groupNames = groupNames, + assemblyNames = assemblyNames + }; + } + + internal ITestFilter BuildNUnitFilter(bool synchronousOnly) + { + var filters = new List(); + + if (testNames != null && testNames.Length != 0) + { + var nameFilter = new OrFilter(testNames.Select(n => new FullNameFilter(n)).ToArray()); + filters.Add(nameFilter); + } + + if (groupNames != null && groupNames.Length != 0) + { + var exactNamesFilter = new OrFilter(groupNames.Select(n => + { + var f = new FullNameFilter(n); + f.IsRegex = true; + return f; + }).ToArray()); + filters.Add(exactNamesFilter); + } + + if (assemblyNames != null && assemblyNames.Length != 0) + { + var assemblyFilter = new OrFilter(assemblyNames.Select(c => new AssemblyNameFilter(c)).ToArray()); + filters.Add(assemblyFilter); + } + + if (categoryNames != null && categoryNames.Length != 0) + { + var categoryFilter = new OrFilter(categoryNames.Select(c => new CategoryFilterExtended(c) {IsRegex = true}).ToArray()); + filters.Add(categoryFilter); + } + + if (synchronousOnly) + { + filters.Add(new SynchronousFilter()); + } + + return filters.Count == 0 ? TestFilter.Empty : new AndFilter(filters.ToArray()); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/Filter.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/Filter.cs.meta new file mode 100644 index 0000000..cec8610 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/Filter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 05f92e4a2414cb144a92157752dfa324 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacks.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacks.cs new file mode 100644 index 0000000..269dbbf --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacks.cs @@ -0,0 +1,10 @@ +namespace UnityEditor.TestTools.TestRunner.Api +{ + public interface ICallbacks + { + void RunStarted(ITestAdaptor testsToRun); + void RunFinished(ITestResultAdaptor result); + void TestStarted(ITestAdaptor test); + void TestFinished(ITestResultAdaptor result); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacks.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacks.cs.meta new file mode 100644 index 0000000..ab0ac56 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacks.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 93eea84e53d0226479c9a584f19427b5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacksDelegator.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacksDelegator.cs new file mode 100644 index 0000000..5622c82 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacksDelegator.cs @@ -0,0 +1,18 @@ +using NUnit.Framework.Interfaces; + +namespace UnityEditor.TestTools.TestRunner.Api +{ + internal interface ICallbacksDelegator + { + void RunStarted(ITest testsToRun); + void RunStartedRemotely(byte[] testsToRunData); + void RunFinished(ITestResult testResults); + void RunFinishedRemotely(byte[] testResultsData); + void RunFailed(string failureMessage); + void TestStarted(ITest test); + void TestStartedRemotely(byte[] testStartedData); + void TestFinished(ITestResult result); + void TestFinishedRemotely(byte[] testResultsData); + void TestTreeRebuild(ITest test); + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacksDelegator.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacksDelegator.cs.meta new file mode 100644 index 0000000..fd5aae8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacksDelegator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8f8f74fe8e363da42875d9cab025d3b2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacksHolder.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacksHolder.cs new file mode 100644 index 0000000..5d3a652 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacksHolder.cs @@ -0,0 +1,10 @@ +namespace UnityEditor.TestTools.TestRunner.Api +{ + internal interface ICallbacksHolder + { + void Add(ICallbacks callback, int priority); + void Remove(ICallbacks callback); + ICallbacks[] GetAll(); + void Clear(); + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacksHolder.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacksHolder.cs.meta new file mode 100644 index 0000000..dd53319 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ICallbacksHolder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d742f2caefd9f934d9f19dad07a08e6f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/IErrorCallbacks.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/IErrorCallbacks.cs new file mode 100644 index 0000000..4599e16 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/IErrorCallbacks.cs @@ -0,0 +1,7 @@ +namespace UnityEditor.TestTools.TestRunner.Api +{ + public interface IErrorCallbacks : ICallbacks + { + void OnError(string message); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/IErrorCallbacks.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/IErrorCallbacks.cs.meta new file mode 100644 index 0000000..082ebbd --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/IErrorCallbacks.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1a06c562b0c5eb046bcb876a29f93c98 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestAdaptor.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestAdaptor.cs new file mode 100644 index 0000000..4fa05fd --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestAdaptor.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using NUnit.Framework.Interfaces; + +namespace UnityEditor.TestTools.TestRunner.Api +{ + public interface ITestAdaptor + { + string Id { get; } + string Name { get; } + string FullName { get; } + int TestCaseCount { get; } + bool HasChildren { get; } + bool IsSuite { get; } + IEnumerable Children { get; } + ITestAdaptor Parent { get; } + int TestCaseTimeout { get; } + ITypeInfo TypeInfo { get; } + IMethodInfo Method { get; } + string[] Categories { get; } + bool IsTestAssembly { get; } + RunState RunState { get; } + string Description { get; } + string SkipReason { get; } + string ParentId { get; } + string ParentFullName { get; } + string UniqueName { get; } + string ParentUniqueName { get; } + int ChildIndex { get; } + TestMode TestMode { get; } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestAdaptor.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestAdaptor.cs.meta new file mode 100644 index 0000000..a372e43 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestAdaptor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 85dd7af03f02aea4aae13a3945e3b313 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestAdaptorFactory.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestAdaptorFactory.cs new file mode 100644 index 0000000..578c053 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestAdaptorFactory.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using NUnit.Framework.Interfaces; +using UnityEngine.TestRunner.TestLaunchers; + +namespace UnityEditor.TestTools.TestRunner.Api +{ + internal interface ITestAdaptorFactory + { + ITestAdaptor Create(ITest test); + ITestAdaptor Create(RemoteTestData testData); + ITestResultAdaptor Create(ITestResult testResult); + ITestResultAdaptor Create(RemoteTestResultData testResult, RemoteTestResultDataWithTestData allData); + ITestAdaptor BuildTree(RemoteTestResultDataWithTestData data); + IEnumerator BuildTreeAsync(RemoteTestResultDataWithTestData data); + void ClearResultsCache(); + void ClearTestsCache(); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestAdaptorFactory.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestAdaptorFactory.cs.meta new file mode 100644 index 0000000..b75d48c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestAdaptorFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 803abab0f7e17044db56f8760186dbd1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestResultAdaptor.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestResultAdaptor.cs new file mode 100644 index 0000000..f2249f2 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestResultAdaptor.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework.Interfaces; + +namespace UnityEditor.TestTools.TestRunner.Api +{ + public interface ITestResultAdaptor + { + ITestAdaptor Test { get; } + string Name { get; } + + /// Gets the full name of the test result + string FullName { get; } + + string ResultState { get; } + + TestStatus TestStatus { get; } + + /// Gets the elapsed time for running the test in seconds + double Duration { get; } + + /// Gets or sets the time the test started running. + DateTime StartTime { get; } + + /// Gets or sets the time the test finished running. + DateTime EndTime { get; } + + /// + /// Gets the message associated with a test + /// failure or with not running the test + /// + string Message { get; } + + /// + /// Gets any stacktrace associated with an + /// error or failure. Not available in + /// the Compact Framework 1.0. + /// + string StackTrace { get; } + + /// + /// Gets the number of asserts executed + /// when running the test and all its children. + /// + int AssertCount { get; } + + /// + /// Gets the number of test cases that failed + /// when running the test and all its children. + /// + int FailCount { get; } + + /// + /// Gets the number of test cases that passed + /// when running the test and all its children. + /// + int PassCount { get; } + + /// + /// Gets the number of test cases that were skipped + /// when running the test and all its children. + /// + int SkipCount { get; } + + /// + /// Gets the number of test cases that were inconclusive + /// when running the test and all its children. + /// + int InconclusiveCount { get; } + + /// + /// Indicates whether this result has any child results. + /// Accessing HasChildren should not force creation of the + /// Children collection in classes implementing this interface. + /// + bool HasChildren { get; } + + /// Gets the the collection of child results. + IEnumerable Children { get; } + + /// Gets any text output written to this result. + string Output { get; } + + TNode ToXml(); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestResultAdaptor.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestResultAdaptor.cs.meta new file mode 100644 index 0000000..991d6f6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestResultAdaptor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4f90cfe4bf5cfb44f84a5b11387f2a42 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestRunSettings.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestRunSettings.cs new file mode 100644 index 0000000..ea30021 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestRunSettings.cs @@ -0,0 +1,9 @@ +using System; + +namespace UnityEditor.TestTools.TestRunner.Api +{ + public interface ITestRunSettings : IDisposable + { + void Apply(); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestRunSettings.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestRunSettings.cs.meta new file mode 100644 index 0000000..0151bee --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestRunSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2ae2ce6274819484fa8747a28cebdf3a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestRunnerApi.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestRunnerApi.cs new file mode 100644 index 0000000..3a2388d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestRunnerApi.cs @@ -0,0 +1,12 @@ +using System; + +namespace UnityEditor.TestTools.TestRunner.Api +{ + internal interface ITestRunnerApi + { + string Execute(ExecutionSettings executionSettings); + void RegisterCallbacks(T testCallbacks, int priority = 0) where T : ICallbacks; + void UnregisterCallbacks(T testCallbacks) where T : ICallbacks; + void RetrieveTestList(TestMode testMode, Action callback); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestRunnerApi.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestRunnerApi.cs.meta new file mode 100644 index 0000000..7679b0a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestRunnerApi.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a7842a837a4b13e41ae16193db753418 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestTreeRebuildCallbacks.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestTreeRebuildCallbacks.cs new file mode 100644 index 0000000..e71d026 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestTreeRebuildCallbacks.cs @@ -0,0 +1,7 @@ +namespace UnityEditor.TestTools.TestRunner.Api +{ + internal interface ITestTreeRebuildCallbacks : ICallbacks + { + void TestTreeRebuild(ITestAdaptor test); + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestTreeRebuildCallbacks.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestTreeRebuildCallbacks.cs.meta new file mode 100644 index 0000000..1e6ead2 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/ITestTreeRebuildCallbacks.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4230e406313f1db43a4b548e7a3ad2e2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/RunState.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/RunState.cs new file mode 100644 index 0000000..937e39e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/RunState.cs @@ -0,0 +1,11 @@ +namespace UnityEditor.TestTools.TestRunner.Api +{ + public enum RunState + { + NotRunnable, + Runnable, + Explicit, + Skipped, + Ignored, + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/RunState.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/RunState.cs.meta new file mode 100644 index 0000000..031239f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/RunState.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8bb59cb2f66d156418ca1bd1e2703233 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestAdaptor.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestAdaptor.cs new file mode 100644 index 0000000..89274dc --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestAdaptor.cs @@ -0,0 +1,142 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using UnityEngine.TestRunner.NUnitExtensions; +using UnityEngine.TestRunner.NUnitExtensions.Runner; +using UnityEngine.TestRunner.TestLaunchers; +using UnityEngine.TestTools.Utils; + +namespace UnityEditor.TestTools.TestRunner.Api +{ + internal class TestAdaptor : ITestAdaptor + { + internal TestAdaptor(ITest test, ITestAdaptor[] children = null) + { + Id = test.Id; + Name = test.Name; + var childIndex = -1; + if (test.Properties["childIndex"].Count > 0) + { + childIndex = (int)test.Properties["childIndex"][0]; + } + FullName = childIndex != -1 ? GetIndexedTestCaseName(test.FullName, childIndex) : test.FullName; + TestCaseCount = test.TestCaseCount; + HasChildren = test.HasChildren; + IsSuite = test.IsSuite; + if (UnityTestExecutionContext.CurrentContext != null) + { + TestCaseTimeout = UnityTestExecutionContext.CurrentContext.TestCaseTimeout; + } + else + { + TestCaseTimeout = CoroutineRunner.k_DefaultTimeout; + } + + TypeInfo = test.TypeInfo; + Method = test.Method; + Categories = test.GetAllCategoriesFromTest().Distinct().ToArray(); + IsTestAssembly = test is TestAssembly; + RunState = (RunState)Enum.Parse(typeof(RunState), test.RunState.ToString()); + Description = (string)test.Properties.Get(PropertyNames.Description); + SkipReason = test.GetSkipReason(); + ParentId = test.GetParentId(); + ParentFullName = test.GetParentFullName(); + UniqueName = test.GetUniqueName(); + ParentUniqueName = test.GetParentUniqueName(); + ChildIndex = childIndex; + + if (test.Parent != null) + { + if (test.Parent.Parent == null) // Assembly level + { + TestMode = (TestMode)Enum.Parse(typeof(TestMode),test.Properties.Get("platform").ToString()); + } + } + + Children = children; + } + + public void SetParent(ITestAdaptor parent) + { + Parent = parent; + if (parent != null) + { + TestMode = parent.TestMode; + } + } + + internal TestAdaptor(RemoteTestData test) + { + Id = test.id; + Name = test.name; + FullName = test.ChildIndex != -1 ? GetIndexedTestCaseName(test.fullName, test.ChildIndex) : test.fullName; + TestCaseCount = test.testCaseCount; + HasChildren = test.hasChildren; + IsSuite = test.isSuite; + m_ChildrenIds = test.childrenIds; + TestCaseTimeout = test.testCaseTimeout; + Categories = test.Categories; + IsTestAssembly = test.IsTestAssembly; + RunState = (RunState)Enum.Parse(typeof(RunState), test.RunState.ToString()); + Description = test.Description; + SkipReason = test.SkipReason; + ParentId = test.ParentId; + UniqueName = test.UniqueName; + ParentUniqueName = test.ParentUniqueName; + ParentFullName = test.ParentFullName; + ChildIndex = test.ChildIndex; + TestMode = TestMode.PlayMode; + } + + internal void ApplyChildren(IEnumerable allTests) + { + Children = m_ChildrenIds.Select(id => allTests.First(t => t.Id == id)).ToArray(); + if (!string.IsNullOrEmpty(ParentId)) + { + Parent = allTests.FirstOrDefault(t => t.Id == ParentId); + } + } + + public string Id { get; private set; } + public string Name { get; private set; } + public string FullName { get; private set; } + public int TestCaseCount { get; private set; } + public bool HasChildren { get; private set; } + public bool IsSuite { get; private set; } + public IEnumerable Children { get; private set; } + public ITestAdaptor Parent { get; private set; } + public int TestCaseTimeout { get; private set; } + public ITypeInfo TypeInfo { get; private set; } + public IMethodInfo Method { get; private set; } + private string[] m_ChildrenIds; + public string[] Categories { get; private set; } + public bool IsTestAssembly { get; private set; } + public RunState RunState { get; } + public string Description { get; } + public string SkipReason { get; } + public string ParentId { get; } + public string ParentFullName { get; } + public string UniqueName { get; } + public string ParentUniqueName { get; } + public int ChildIndex { get; } + public TestMode TestMode { get; private set; } + + private static string GetIndexedTestCaseName(string fullName, int index) + { + var generatedTestSuffix = " GeneratedTestCase" + index; + if (fullName.EndsWith(")")) + { + // Test names from generated TestCaseSource look like Test(TestCaseSourceType) + // This inserts a unique test case index in the name, so that it becomes Test(TestCaseSourceType GeneratedTestCase0) + return fullName.Substring(0, fullName.Length - 1) + generatedTestSuffix + fullName[fullName.Length - 1]; + } + + // In some cases there can be tests with duplicate names generated in other ways and they won't have () in their name + // We just append a suffix at the end of the name in that case + return fullName + generatedTestSuffix; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestAdaptor.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestAdaptor.cs.meta new file mode 100644 index 0000000..273c463 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestAdaptor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6e0e62db88935c74288c97c907243bd0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestAdaptorFactory.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestAdaptorFactory.cs new file mode 100644 index 0000000..9c747f9 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestAdaptorFactory.cs @@ -0,0 +1,91 @@ +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework.Interfaces; +using UnityEngine.TestRunner.NUnitExtensions; +using UnityEngine.TestRunner.TestLaunchers; + +namespace UnityEditor.TestTools.TestRunner.Api +{ + internal class TestAdaptorFactory : ITestAdaptorFactory + { + private Dictionary m_TestAdaptorCache = new Dictionary(); + private Dictionary m_TestResultAdaptorCache = new Dictionary(); + public ITestAdaptor Create(ITest test) + { + var uniqueName = test.GetUniqueName(); + if (m_TestAdaptorCache.ContainsKey(uniqueName)) + { + return m_TestAdaptorCache[uniqueName]; + } + + var adaptor = new TestAdaptor(test, test.Tests.Select(Create).ToArray()); + foreach (var child in adaptor.Children) + { + (child as TestAdaptor).SetParent(adaptor); + } + m_TestAdaptorCache[uniqueName] = adaptor; + return adaptor; + } + + public ITestAdaptor Create(RemoteTestData testData) + { + return new TestAdaptor(testData); + } + + public ITestResultAdaptor Create(ITestResult testResult) + { + var uniqueName = testResult.Test.GetUniqueName(); + if (m_TestResultAdaptorCache.ContainsKey(uniqueName)) + { + return m_TestResultAdaptorCache[uniqueName]; + } + var adaptor = new TestResultAdaptor(testResult, Create(testResult.Test), testResult.Children.Select(Create).ToArray()); + m_TestResultAdaptorCache[uniqueName] = adaptor; + return adaptor; + } + + public ITestResultAdaptor Create(RemoteTestResultData testResult, RemoteTestResultDataWithTestData allData) + { + return new TestResultAdaptor(testResult, allData); + } + + public ITestAdaptor BuildTree(RemoteTestResultDataWithTestData data) + { + var tests = data.tests.Select(remoteTestData => new TestAdaptor(remoteTestData)).ToList(); + + foreach (var test in tests) + { + test.ApplyChildren(tests); + } + + return tests.First(); + } + + public IEnumerator BuildTreeAsync(RemoteTestResultDataWithTestData data) + { + var tests = data.tests.Select(remoteTestData => new TestAdaptor(remoteTestData)).ToList(); + + for (var index = 0; index < tests.Count; index++) + { + var test = tests[index]; + test.ApplyChildren(tests); + if (index % 100 == 0) + { + yield return null; + } + } + + yield return tests.First(); + } + + public void ClearResultsCache() + { + m_TestResultAdaptorCache.Clear(); + } + + public void ClearTestsCache() + { + m_TestAdaptorCache.Clear(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestAdaptorFactory.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestAdaptorFactory.cs.meta new file mode 100644 index 0000000..65e4da7 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestAdaptorFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d0663d520c26b7c48a4135599e66acf8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestMode.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestMode.cs new file mode 100644 index 0000000..d22b732 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestMode.cs @@ -0,0 +1,11 @@ +using System; + +namespace UnityEditor.TestTools.TestRunner.Api +{ + [Flags] + public enum TestMode + { + EditMode = 1 << 0, + PlayMode = 1 << 1 + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestMode.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestMode.cs.meta new file mode 100644 index 0000000..5812ce3 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestMode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cad095eccea17b741bc4cd264e7441cd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestResultAdaptor.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestResultAdaptor.cs new file mode 100644 index 0000000..61501ac --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestResultAdaptor.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework.Interfaces; +using UnityEngine.TestRunner.TestLaunchers; + +namespace UnityEditor.TestTools.TestRunner.Api +{ + internal class TestResultAdaptor : ITestResultAdaptor + { + private TNode m_Node; + + internal TestResultAdaptor(ITestResult result, ITestAdaptor test, ITestResultAdaptor[] children = null) + { + Test = test; + Name = result.Name; + FullName = result.FullName; + ResultState = result.ResultState.ToString(); + TestStatus = ParseTestStatus(result.ResultState.Status); + Duration = result.Duration; + StartTime = result.StartTime; + EndTime = result.EndTime; + Message = result.Message; + StackTrace = result.StackTrace; + AssertCount = result.AssertCount; + FailCount = result.FailCount; + PassCount = result.PassCount; + SkipCount = result.SkipCount; + InconclusiveCount = result.InconclusiveCount; + HasChildren = result.HasChildren; + Output = result.Output; + Children = children; + m_Node = result.ToXml(true); + } + + internal TestResultAdaptor(RemoteTestResultData result, RemoteTestResultDataWithTestData allData) + { + Test = new TestAdaptor(allData.tests.First(t => t.id == result.testId)); + Name = result.name; + FullName = result.fullName; + ResultState = result.resultState; + TestStatus = ParseTestStatus(result.testStatus); + Duration = result.duration; + StartTime = result.startTime; + EndTime = result.endTime; + Message = result.message; + StackTrace = result.stackTrace; + AssertCount = result.assertCount; + FailCount = result.failCount; + PassCount = result.passCount; + SkipCount = result.skipCount; + InconclusiveCount = result.inconclusiveCount; + HasChildren = result.hasChildren; + Output = result.output; + Children = result.childrenIds.Select(childId => new TestResultAdaptor(allData.results.First(r => r.testId == childId), allData)).ToArray(); + m_Node = TNode.FromXml(result.xml); + } + + public ITestAdaptor Test { get; private set; } + public string Name { get; private set; } + public string FullName { get; private set; } + public string ResultState { get; private set; } + public TestStatus TestStatus { get; private set; } + public double Duration { get; private set; } + public DateTime StartTime { get; private set; } + public DateTime EndTime { get; private set; } + public string Message { get; private set; } + public string StackTrace { get; private set; } + public int AssertCount { get; private set; } + public int FailCount { get; private set; } + public int PassCount { get; private set; } + public int SkipCount { get; private set; } + public int InconclusiveCount { get; private set; } + public bool HasChildren { get; private set; } + public IEnumerable Children { get; private set; } + public string Output { get; private set; } + public TNode ToXml() + { + return m_Node; + } + + private static TestStatus ParseTestStatus(NUnit.Framework.Interfaces.TestStatus testStatus) + { + return (TestStatus)Enum.Parse(typeof(TestStatus), testStatus.ToString()); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestResultAdaptor.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestResultAdaptor.cs.meta new file mode 100644 index 0000000..aafad45 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestResultAdaptor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d061ada5d3169454daf54243390b5fdb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestRunnerApi.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestRunnerApi.cs new file mode 100644 index 0000000..6b14d38 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestRunnerApi.cs @@ -0,0 +1,120 @@ +using System; +using System.Linq; +using System.Threading; +using UnityEditor.TestTools.TestRunner.CommandLineTest; +using UnityEditor.TestTools.TestRunner.TestRun; +using UnityEngine; +using UnityEngine.TestRunner.TestLaunchers; +using UnityEngine.TestTools; +using UnityEngine.TestTools.NUnitExtensions; + +namespace UnityEditor.TestTools.TestRunner.Api +{ + public class TestRunnerApi : ScriptableObject, ITestRunnerApi + { + internal ICallbacksHolder callbacksHolder; + + private ICallbacksHolder m_CallbacksHolder + { + get + { + if (callbacksHolder == null) + { + return CallbacksHolder.instance; + } + + return callbacksHolder; + } + } + + internal Func ScheduleJob = (executionSettings) => + { + var runner = new TestJobRunner(); + return runner.RunJob(new TestJobData(executionSettings)); + }; + + public string Execute(ExecutionSettings executionSettings) + { + if (executionSettings == null) + { + throw new ArgumentNullException(nameof(executionSettings)); + } + + if ((executionSettings.filters == null || executionSettings.filters.Length == 0) && executionSettings.filter != null) + { + // Map filter (singular) to filters (plural), for backwards compatibility. + executionSettings.filters = new [] {executionSettings.filter}; + } + + if (executionSettings.targetPlatform == null && executionSettings.filters != null && + executionSettings.filters.Length > 0) + { + executionSettings.targetPlatform = executionSettings.filters[0].targetPlatform; + } + + return ScheduleJob(executionSettings); + } + + public void RegisterCallbacks(T testCallbacks, int priority = 0) where T : ICallbacks + { + if (testCallbacks == null) + { + throw new ArgumentNullException(nameof(testCallbacks)); + } + + m_CallbacksHolder.Add(testCallbacks, priority); + } + + public void UnregisterCallbacks(T testCallbacks) where T : ICallbacks + { + if (testCallbacks == null) + { + throw new ArgumentNullException(nameof(testCallbacks)); + } + + m_CallbacksHolder.Remove(testCallbacks); + } + + internal void RetrieveTestList(ExecutionSettings executionSettings, Action callback) + { + if (executionSettings == null) + { + throw new ArgumentNullException(nameof(executionSettings)); + } + + var firstFilter = executionSettings.filters?.FirstOrDefault() ?? executionSettings.filter; + RetrieveTestList(firstFilter.testMode, callback); + } + + public void RetrieveTestList(TestMode testMode, Action callback) + { + if (callback == null) + { + throw new ArgumentNullException(nameof(callback)); + } + + var platform = ParseTestMode(testMode); + var testAssemblyProvider = new EditorLoadedTestAssemblyProvider(new EditorCompilationInterfaceProxy(), new EditorAssembliesProxy()); + var testAdaptorFactory = new TestAdaptorFactory(); + var testListCache = new TestListCache(testAdaptorFactory, new RemoteTestResultDataFactory(), TestListCacheData.instance); + var testListProvider = new TestListProvider(testAssemblyProvider, new UnityTestAssemblyBuilder()); + var cachedTestListProvider = new CachingTestListProvider(testListProvider, testListCache, testAdaptorFactory); + + var job = new TestListJob(cachedTestListProvider, platform, (testRoot) => + { + callback(testRoot); + }); + job.Start(); + } + + internal static bool IsRunActive() + { + return RunData.instance.isRunning; + } + + private static TestPlatform ParseTestMode(TestMode testMode) + { + return (((testMode & TestMode.EditMode) == TestMode.EditMode) ? TestPlatform.EditMode : 0) | (((testMode & TestMode.PlayMode) == TestMode.PlayMode) ? TestPlatform.PlayMode : 0); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestRunnerApi.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestRunnerApi.cs.meta new file mode 100644 index 0000000..5bac273 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestRunnerApi.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 68993ba529ae04440916cb7c23bf3279 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestStatus.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestStatus.cs new file mode 100644 index 0000000..53eb81b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestStatus.cs @@ -0,0 +1,10 @@ +namespace UnityEditor.TestTools.TestRunner.Api +{ + public enum TestStatus + { + Inconclusive, + Skipped, + Passed, + Failed + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestStatus.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestStatus.cs.meta new file mode 100644 index 0000000..6828582 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestStatus.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9ec94545c5b00344c9bd8e691f15d799 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/AssemblyInfo.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/AssemblyInfo.cs new file mode 100644 index 0000000..657c29d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/AssemblyInfo.cs @@ -0,0 +1,15 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle("UnityEditor.TestRunner")] +[assembly: InternalsVisibleTo("Assembly-CSharp-Editor-testable")] +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] +[assembly: InternalsVisibleTo("Unity.PerformanceTesting.Editor")] +[assembly: InternalsVisibleTo("Unity.IntegrationTests")] +[assembly: InternalsVisibleTo("UnityEditor.TestRunner.Tests")] +[assembly: InternalsVisibleTo("Unity.TestTools.CodeCoverage.Editor")] +[assembly: InternalsVisibleTo("Unity.PackageManagerUI.Develop.Editor")] +[assembly: InternalsVisibleTo("Unity.PackageManagerUI.Develop.EditorTests")] +[assembly: InternalsVisibleTo("Unity.PackageValidationSuite.Editor")] + +[assembly: AssemblyVersion("1.0.0")] diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/AssemblyInfo.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/AssemblyInfo.cs.meta new file mode 100644 index 0000000..f2847f7 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/AssemblyInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9db19a04003fca7439552acd4de9baa1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser.meta new file mode 100644 index 0000000..71f43ac --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7602252bdb82b8d45ae3483c3a00d3e1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/CommandLineOption.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/CommandLineOption.cs new file mode 100644 index 0000000..e6d0cff --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/CommandLineOption.cs @@ -0,0 +1,45 @@ +using System; +using System.Linq; + +namespace UnityEditor.TestRunner.CommandLineParser +{ + internal class CommandLineOption : ICommandLineOption + { + Action m_ArgAction; + + public CommandLineOption(string argName, Action action) + { + ArgName = argName; + m_ArgAction = s => action(); + } + + public CommandLineOption(string argName, Action action) + { + ArgName = argName; + m_ArgAction = action; + } + + public CommandLineOption(string argName, Action action) + { + ArgName = argName; + m_ArgAction = s => action(SplitStringToArray(s)); + } + + public string ArgName { get; private set; } + + public void ApplyValue(string value) + { + m_ArgAction(value); + } + + static string[] SplitStringToArray(string value) + { + if (string.IsNullOrEmpty(value)) + { + return null; + } + + return value.Split(';').ToArray(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/CommandLineOption.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/CommandLineOption.cs.meta new file mode 100644 index 0000000..ebeabb6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/CommandLineOption.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a3529368f4cd0424a89aa51080a16b06 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/CommandLineOptionSet.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/CommandLineOptionSet.cs new file mode 100644 index 0000000..f67ab2f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/CommandLineOptionSet.cs @@ -0,0 +1,49 @@ +using System; + +namespace UnityEditor.TestRunner.CommandLineParser +{ + internal class CommandLineOptionSet + { + ICommandLineOption[] m_Options; + + public CommandLineOptionSet(params ICommandLineOption[] options) + { + m_Options = options; + } + + public void Parse(string[] args) + { + var i = 0; + while (i < args.Length) + { + var arg = args[i]; + if (!arg.StartsWith("-")) + { + i++; + continue; + } + + string value = null; + if (i + 1 < args.Length && !args[i + 1].StartsWith("-")) + { + value = args[i + 1]; + i++; + } + + ApplyValueToMatchingOptions(arg, value); + i++; + } + } + + private void ApplyValueToMatchingOptions(string argName, string value) + { + foreach (var option in m_Options) + { + if ("-" + option.ArgName == argName) + { + option.ApplyValue(value); + } + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/CommandLineOptionSet.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/CommandLineOptionSet.cs.meta new file mode 100644 index 0000000..ce92320 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/CommandLineOptionSet.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 139c5eac101a4dc4fb3098e30c29f15e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/ICommandLineOption.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/ICommandLineOption.cs new file mode 100644 index 0000000..792113e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/ICommandLineOption.cs @@ -0,0 +1,8 @@ +namespace UnityEditor.TestRunner.CommandLineParser +{ + interface ICommandLineOption + { + string ArgName { get; } + void ApplyValue(string value); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/ICommandLineOption.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/ICommandLineOption.cs.meta new file mode 100644 index 0000000..10bed96 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineParser/ICommandLineOption.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f445ca0c614a846449fcd8ae648c24e2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest.meta new file mode 100644 index 0000000..74153e5 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b477d1f29b65a674e9d5cdab4eb72b01 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/Executer.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/Executer.cs new file mode 100644 index 0000000..7204617 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/Executer.cs @@ -0,0 +1,134 @@ +using System; +using System.Linq; +using UnityEditor.TestRunner.TestLaunchers; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner.CommandLineTest +{ + internal class Executer + { + private ITestRunnerApi m_TestRunnerApi; + private ISettingsBuilder m_SettingsBuilder; + private Action m_LogErrorFormat; + private Action m_LogException; + private Action m_ExitEditorApplication; + private Func m_ScriptCompilationFailedCheck; + + public Executer(ITestRunnerApi testRunnerApi, ISettingsBuilder settingsBuilder, Action logErrorFormat, Action logException, Action exitEditorApplication, Func scriptCompilationFailedCheck) + { + m_TestRunnerApi = testRunnerApi; + m_SettingsBuilder = settingsBuilder; + m_LogErrorFormat = logErrorFormat; + m_LogException = logException; + m_ExitEditorApplication = exitEditorApplication; + m_ScriptCompilationFailedCheck = scriptCompilationFailedCheck; + } + + internal void InitializeAndExecuteRun(string[] commandLineArgs) + { + Api.ExecutionSettings executionSettings; + try + { + executionSettings = m_SettingsBuilder.BuildApiExecutionSettings(commandLineArgs); + if (executionSettings.targetPlatform.HasValue) + RemotePlayerLogController.instance.SetBuildTarget(executionSettings.targetPlatform.Value); + } + catch (SetupException exception) + { + HandleSetupException(exception); + return; + } + + try + { + Debug.Log("Executing tests with settings: " + ExecutionSettingsToString(executionSettings)); + m_TestRunnerApi.Execute(executionSettings); + } + catch (Exception exception) + { + m_LogException(exception); + m_ExitEditorApplication((int)ReturnCodes.RunError); + } + } + + internal ExecutionSettings BuildExecutionSettings(string[] commandLineArgs) + { + return m_SettingsBuilder.BuildExecutionSettings(commandLineArgs); + } + + internal enum ReturnCodes + { + Ok = 0, + Failed = 2, + RunError = 3, + PlatformNotFoundReturnCode = 4 + } + + internal void SetUpCallbacks(ExecutionSettings executionSettings) + { + RemotePlayerLogController.instance.SetLogsDirectory(executionSettings.DeviceLogsDirectory); + + var resultSavingCallback = ScriptableObject.CreateInstance(); + resultSavingCallback.m_ResultFilePath = executionSettings.TestResultsFile; + + var logSavingCallback = ScriptableObject.CreateInstance(); + + m_TestRunnerApi.RegisterCallbacks(resultSavingCallback); + m_TestRunnerApi.RegisterCallbacks(logSavingCallback); + m_TestRunnerApi.RegisterCallbacks(ScriptableObject.CreateInstance(), -10); + } + + internal void ExitOnCompileErrors() + { + if (m_ScriptCompilationFailedCheck()) + { + var handling = s_ExceptionHandlingMapping.First(h => h.m_ExceptionType == SetupException.ExceptionType.ScriptCompilationFailed); + m_LogErrorFormat(handling.m_Message, new object[0]); + m_ExitEditorApplication(handling.m_ReturnCode); + } + } + + void HandleSetupException(SetupException exception) + { + ExceptionHandling handling = s_ExceptionHandlingMapping.FirstOrDefault(h => h.m_ExceptionType == exception.Type) ?? new ExceptionHandling(exception.Type, "Unknown command line test run error. " + exception.Type, ReturnCodes.RunError); + m_LogErrorFormat(handling.m_Message, exception.Details); + m_ExitEditorApplication(handling.m_ReturnCode); + } + + private class ExceptionHandling + { + internal SetupException.ExceptionType m_ExceptionType; + internal string m_Message; + internal int m_ReturnCode; + public ExceptionHandling(SetupException.ExceptionType exceptionType, string message, ReturnCodes returnCode) + { + m_ExceptionType = exceptionType; + m_Message = message; + m_ReturnCode = (int)returnCode; + } + } + + static ExceptionHandling[] s_ExceptionHandlingMapping = new[] + { + new ExceptionHandling(SetupException.ExceptionType.ScriptCompilationFailed, "Scripts had compilation errors.", ReturnCodes.RunError), + new ExceptionHandling(SetupException.ExceptionType.PlatformNotFound, "Test platform not found ({0}).", ReturnCodes.PlatformNotFoundReturnCode), + new ExceptionHandling(SetupException.ExceptionType.TestSettingsFileNotFound, "Test settings file not found at {0}.", ReturnCodes.RunError) + }; + + private static string ExecutionSettingsToString(Api.ExecutionSettings executionSettings) + { + if (executionSettings == null) + { + return "none"; + } + + if (executionSettings.filters == null || executionSettings.filters.Length == 0) + { + return "no filter"; + } + + return "test mode = " + executionSettings.filters[0].testMode; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/Executer.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/Executer.cs.meta new file mode 100644 index 0000000..c85fbe2 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/Executer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 083c6a3a5426382449369ddc12b691d8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ExecutionSettings.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ExecutionSettings.cs new file mode 100644 index 0000000..031e28f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ExecutionSettings.cs @@ -0,0 +1,11 @@ +using System; + +namespace UnityEditor.TestTools.TestRunner.CommandLineTest +{ + [Serializable] + internal class ExecutionSettings + { + public string TestResultsFile; + public string DeviceLogsDirectory; + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ExecutionSettings.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ExecutionSettings.cs.meta new file mode 100644 index 0000000..f846a28 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ExecutionSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c3a75354f6ceac94ca15ca9d96593290 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ExitCallbacks.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ExitCallbacks.cs new file mode 100644 index 0000000..ffa636d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ExitCallbacks.cs @@ -0,0 +1,53 @@ +using System; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner.CommandLineTest +{ + [Serializable] + internal class ExitCallbacks : ScriptableObject, IErrorCallbacks + { + private bool m_AnyTestsExecuted; + private bool m_RunFailed; + internal static bool preventExit; + + public void RunFinished(ITestResultAdaptor testResults) + { + if (preventExit) + { + return; + } + + if (!m_AnyTestsExecuted) + { + Debug.LogFormat(LogType.Warning, LogOption.NoStacktrace, null, "No tests were executed"); + } + EditorApplication.Exit(m_RunFailed ? (int)Executer.ReturnCodes.Failed : (int)Executer.ReturnCodes.Ok); + } + + public void TestStarted(ITestAdaptor test) + { + if (!test.IsSuite) + { + m_AnyTestsExecuted = true; + } + } + + public void TestFinished(ITestResultAdaptor result) + { + if (!result.Test.IsSuite && (result.TestStatus == TestStatus.Failed)) + { + m_RunFailed = true; + } + } + + public void RunStarted(ITestAdaptor testsToRun) + { + } + + public void OnError(string message) + { + EditorApplication.Exit((int)Executer.ReturnCodes.RunError); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ExitCallbacks.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ExitCallbacks.cs.meta new file mode 100644 index 0000000..911c45c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ExitCallbacks.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1adaa8dcc4fda3d4cb4d3c8e0cb65d12 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ISettingsBuilder.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ISettingsBuilder.cs new file mode 100644 index 0000000..dd55e8f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ISettingsBuilder.cs @@ -0,0 +1,10 @@ +using UnityEditor.TestTools.TestRunner.Api; + +namespace UnityEditor.TestTools.TestRunner.CommandLineTest +{ + interface ISettingsBuilder + { + Api.ExecutionSettings BuildApiExecutionSettings(string[] commandLineArgs); + ExecutionSettings BuildExecutionSettings(string[] commandLineArgs); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ISettingsBuilder.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ISettingsBuilder.cs.meta new file mode 100644 index 0000000..c8af610 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ISettingsBuilder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8a13cbeb2099aca47bb456f49845f86c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogSavingCallbacks.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogSavingCallbacks.cs new file mode 100644 index 0000000..69e5499 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogSavingCallbacks.cs @@ -0,0 +1,29 @@ +using System; +using UnityEditor.TestRunner.TestLaunchers; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner.CommandLineTest +{ + [Serializable] + internal class LogSavingCallbacks : ScriptableObject, ICallbacks + { + public void RunStarted(ITestAdaptor testsToRun) + { + RemotePlayerLogController.instance.StartLogWriters(); + } + + public virtual void RunFinished(ITestResultAdaptor testResults) + { + RemotePlayerLogController.instance.StopLogWriters(); + } + + public void TestStarted(ITestAdaptor test) + { + } + + public void TestFinished(ITestResultAdaptor result) + { + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogSavingCallbacks.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogSavingCallbacks.cs.meta new file mode 100644 index 0000000..d83e631 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogSavingCallbacks.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8d20eedbe40f0ce41a4c4f633f225de8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogWriter.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogWriter.cs new file mode 100644 index 0000000..ba5532e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogWriter.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.IO; +using UnityEditor.DeploymentTargets; +using UnityEditor.Utils; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner.CommandLineTest +{ + internal class LogWriter : IDisposable + { + private string m_LogsDirectory; + private string m_DeviceID; + private Dictionary m_LogStreams; + private DeploymentTargetLogger m_Logger; + + internal LogWriter(string logsDirectory, string deviceID, DeploymentTargetLogger logger) + { + m_LogStreams = new Dictionary(); + m_Logger = logger; + m_LogsDirectory = logsDirectory; + m_DeviceID = deviceID; + + logger.logMessage += WriteLogToFile; + } + + private void WriteLogToFile(string id, string logLine) + { + StreamWriter logStream; + var streamExists = m_LogStreams.TryGetValue(id, out logStream); + if (!streamExists) + { + var filePath = GetLogFilePath(m_LogsDirectory, m_DeviceID, id); + logStream = CreateLogFile(filePath); + + m_LogStreams.Add(id, logStream); + } + + try + { + if (logLine != null) + logStream.WriteLine(logLine); + } + catch (Exception ex) + { + Debug.LogError($"Writing {id} log failed."); + Debug.LogException(ex); + } + } + + public void Stop() + { + m_Logger.Stop(); + foreach (var logStream in m_LogStreams) + { + logStream.Value.Close(); + } + } + + public void Dispose() + { + Stop(); + } + + private StreamWriter CreateLogFile(string path) + { + Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, "Creating {0} device log: {1}", m_DeviceID, path); + StreamWriter streamWriter = null; + try + { + if (!Directory.Exists(path)) + Directory.CreateDirectory(Path.GetDirectoryName(path)); + + streamWriter = File.CreateText(path); + } + catch (Exception ex) + { + Debug.LogError($"Creating device log {path} file failed."); + Debug.LogException(ex); + } + + return streamWriter; + } + + private string GetLogFilePath(string lgosDirectory, string deviceID, string logID) + { + var fileName = "Device-" + deviceID + "-" + logID + ".txt"; + fileName = string.Join("_", fileName.Split(Path.GetInvalidFileNameChars())); + return Paths.Combine(lgosDirectory, fileName); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogWriter.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogWriter.cs.meta new file mode 100644 index 0000000..1828ca9 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/LogWriter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 05778dd1de4433d418793b6f3d3c18cf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ResultsSavingCallbacks.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ResultsSavingCallbacks.cs new file mode 100644 index 0000000..a3f184f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ResultsSavingCallbacks.cs @@ -0,0 +1,50 @@ +using System; +using System.IO; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEditor.Utils; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner.CommandLineTest +{ + [Serializable] + internal class ResultsSavingCallbacks : ScriptableObject, ICallbacks + { + [SerializeField] + public string m_ResultFilePath; + + public ResultsSavingCallbacks() + { + this.m_ResultFilePath = GetDefaultResultFilePath(); + } + + public void RunStarted(ITestAdaptor testsToRun) + { + } + + public virtual void RunFinished(ITestResultAdaptor testResults) + { + if (string.IsNullOrEmpty(m_ResultFilePath)) + { + m_ResultFilePath = GetDefaultResultFilePath(); + } + + var resultWriter = new ResultsWriter(); + resultWriter.WriteResultToFile(testResults, m_ResultFilePath); + } + + public void TestStarted(ITestAdaptor test) + { + } + + public void TestFinished(ITestResultAdaptor result) + { + } + + private static string GetDefaultResultFilePath() + { + var fileName = "TestResults-" + DateTime.Now.Ticks + ".xml"; + var projectPath = Directory.GetCurrentDirectory(); + return Paths.Combine(projectPath, fileName); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ResultsSavingCallbacks.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ResultsSavingCallbacks.cs.meta new file mode 100644 index 0000000..0c6854f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ResultsSavingCallbacks.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ef563c5a6ecf64d4193dc144cb7d472a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ResultsWriter.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ResultsWriter.cs new file mode 100644 index 0000000..ffb8af3 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ResultsWriter.cs @@ -0,0 +1,103 @@ +using System; +using System.IO; +using System.Xml; +using NUnit.Framework.Interfaces; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner.CommandLineTest +{ + internal class ResultsWriter + { + private const string k_nUnitVersion = "3.5.0.0"; + + private const string k_TestRunNode = "test-run"; + private const string k_Id = "id"; + private const string k_Testcasecount = "testcasecount"; + private const string k_Result = "result"; + private const string k_Total = "total"; + private const string k_Passed = "passed"; + private const string k_Failed = "failed"; + private const string k_Inconclusive = "inconclusive"; + private const string k_Skipped = "skipped"; + private const string k_Asserts = "asserts"; + private const string k_EngineVersion = "engine-version"; + private const string k_ClrVersion = "clr-version"; + private const string k_StartTime = "start-time"; + private const string k_EndTime = "end-time"; + private const string k_Duration = "duration"; + + private const string k_TimeFormat = "u"; + + public void WriteResultToFile(ITestResultAdaptor result, string filePath) + { + Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, "Saving results to: {0}", filePath); + + try + { + if (!Directory.Exists(filePath)) + { + CreateDirectory(filePath); + } + + using (var fileStream = File.CreateText(filePath)) + { + WriteResultToStream(result, fileStream); + } + } + catch (Exception ex) + { + Debug.LogError("Saving result file failed."); + Debug.LogException(ex); + } + } + + void CreateDirectory(string filePath) + { + var driectoryPath = Path.GetDirectoryName(filePath); + if (!String.IsNullOrEmpty(driectoryPath)) + { + Directory.CreateDirectory(driectoryPath); + } + } + + public void WriteResultToStream(ITestResultAdaptor result, StreamWriter streamWriter, XmlWriterSettings settings = null) + { + settings = settings ?? new XmlWriterSettings(); + settings.Indent = true; + settings.NewLineOnAttributes = false; + + using (var xmlWriter = XmlWriter.Create(streamWriter, settings)) + { + WriteResultsToXml(result, xmlWriter); + } + } + + void WriteResultsToXml(ITestResultAdaptor result, XmlWriter xmlWriter) + { + // XML format as specified at https://github.com/nunit/docs/wiki/Test-Result-XML-Format + + var testRunNode = new TNode(k_TestRunNode); + + testRunNode.AddAttribute(k_Id, "2"); + testRunNode.AddAttribute(k_Testcasecount, (result.PassCount + result.FailCount + result.SkipCount + result.InconclusiveCount).ToString()); + testRunNode.AddAttribute(k_Result, result.ResultState.ToString()); + testRunNode.AddAttribute(k_Total, (result.PassCount + result.FailCount + result.SkipCount + result.InconclusiveCount).ToString()); + testRunNode.AddAttribute(k_Passed, result.PassCount.ToString()); + testRunNode.AddAttribute(k_Failed, result.FailCount.ToString()); + testRunNode.AddAttribute(k_Inconclusive, result.InconclusiveCount.ToString()); + testRunNode.AddAttribute(k_Skipped, result.SkipCount.ToString()); + testRunNode.AddAttribute(k_Asserts, result.AssertCount.ToString()); + testRunNode.AddAttribute(k_EngineVersion, k_nUnitVersion); + testRunNode.AddAttribute(k_ClrVersion, Environment.Version.ToString()); + testRunNode.AddAttribute(k_StartTime, result.StartTime.ToString(k_TimeFormat)); + testRunNode.AddAttribute(k_EndTime, result.EndTime.ToString(k_TimeFormat)); + testRunNode.AddAttribute(k_Duration, result.Duration.ToString()); + + var resultNode = result.ToXml(); + testRunNode.ChildNodes.Add(resultNode); + + testRunNode.WriteTo(xmlWriter); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ResultsWriter.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ResultsWriter.cs.meta new file mode 100644 index 0000000..6ab194a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/ResultsWriter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 29d603e0a726a9043b3503112271844a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/RunData.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/RunData.cs new file mode 100644 index 0000000..8f92198 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/RunData.cs @@ -0,0 +1,8 @@ +namespace UnityEditor.TestTools.TestRunner.CommandLineTest +{ + internal class RunData : ScriptableSingleton + { + public bool isRunning; + public ExecutionSettings executionSettings; + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/RunData.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/RunData.cs.meta new file mode 100644 index 0000000..69abd7d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/RunData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3f8c1075884df0249b80e23a0598f9c1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/RunSettings.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/RunSettings.cs new file mode 100644 index 0000000..df00772 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/RunSettings.cs @@ -0,0 +1,29 @@ +using UnityEditor.TestTools.TestRunner.Api; + +namespace UnityEditor.TestTools.TestRunner.CommandLineTest +{ + internal class RunSettings : ITestRunSettings + { + private ITestSettings m_TestSettings; + public RunSettings(ITestSettings testSettings) + { + this.m_TestSettings = testSettings; + } + + public void Apply() + { + if (m_TestSettings != null) + { + m_TestSettings.SetupProjectParameters(); + } + } + + public void Dispose() + { + if (m_TestSettings != null) + { + m_TestSettings.Dispose(); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/RunSettings.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/RunSettings.cs.meta new file mode 100644 index 0000000..6ea9afa --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/RunSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 59d3f5586b341a74c84c8f72144a4568 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/SettingsBuilder.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/SettingsBuilder.cs new file mode 100644 index 0000000..f8cee70 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/SettingsBuilder.cs @@ -0,0 +1,185 @@ +using System; +using System.IO; +using UnityEditor.TestRunner.CommandLineParser; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine.TestTools.TestRunner.GUI; + +namespace UnityEditor.TestTools.TestRunner.CommandLineTest +{ + internal class SettingsBuilder : ISettingsBuilder + { + private ITestSettingsDeserializer m_TestSettingsDeserializer; + private Action m_LogAction; + private Action m_LogWarningAction; + private Func m_FileExistsCheck; + private Func m_ScriptCompilationFailedCheck; + public SettingsBuilder(ITestSettingsDeserializer testSettingsDeserializer, Action logAction, Action logWarningAction, Func fileExistsCheck, Func scriptCompilationFailedCheck) + { + m_LogAction = logAction; + m_LogWarningAction = logWarningAction; + m_FileExistsCheck = fileExistsCheck; + m_ScriptCompilationFailedCheck = scriptCompilationFailedCheck; + m_TestSettingsDeserializer = testSettingsDeserializer; + } + + public Api.ExecutionSettings BuildApiExecutionSettings(string[] commandLineArgs) + { + var quit = false; + string testPlatform = TestMode.EditMode.ToString(); + string[] testFilters = null; + string[] testCategories = null; + string testSettingsFilePath = null; + int testRepetitions = 1; + int? playerHeartbeatTimeout = null; + bool runSynchronously = false; + + var optionSet = new CommandLineOptionSet( + new CommandLineOption("quit", () => { quit = true; }), + new CommandLineOption("testPlatform", platform => { testPlatform = platform; }), + new CommandLineOption("editorTestsFilter", filters => { testFilters = filters; }), + new CommandLineOption("testFilter", filters => { testFilters = filters; }), + new CommandLineOption("editorTestsCategories", catagories => { testCategories = catagories; }), + new CommandLineOption("testCategory", catagories => { testCategories = catagories; }), + new CommandLineOption("testSettingsFile", settingsFilePath => { testSettingsFilePath = settingsFilePath; }), + new CommandLineOption("testRepetitions", reps => { testRepetitions = int.Parse(reps); }), + new CommandLineOption("playerHeartbeatTimeout", timeout => { playerHeartbeatTimeout = int.Parse(timeout); }), + new CommandLineOption("runSynchronously", () => { runSynchronously = true; }) + ); + optionSet.Parse(commandLineArgs); + + DisplayQuitWarningIfQuitIsGiven(quit); + + CheckForScriptCompilationErrors(); + + LogParametersForRun(testPlatform, testFilters, testCategories, testSettingsFilePath); + + var testSettings = GetTestSettings(testSettingsFilePath); + + var filter = new Filter() + { + groupNames = testFilters, + categoryNames = testCategories + }; + + var buildTarget = SetFilterAndGetBuildTarget(testPlatform, filter); + + RerunCallbackData.instance.runFilters = new []{new TestRunnerFilter() + { + categoryNames = filter.categoryNames, + groupNames = filter.groupNames, + testRepetitions = testRepetitions + }}; + + RerunCallbackData.instance.testMode = filter.testMode; + + var settings = new Api.ExecutionSettings() + { + filters = new []{filter}, + overloadTestRunSettings = new RunSettings(testSettings), + targetPlatform = buildTarget, + runSynchronously = runSynchronously + }; + + if (playerHeartbeatTimeout != null) + { + settings.playerHeartbeatTimeout = playerHeartbeatTimeout.Value; + } + + return settings; + } + + public ExecutionSettings BuildExecutionSettings(string[] commandLineArgs) + { + string resultFilePath = null; + string deviceLogsDirectory = null; + + var optionSet = new CommandLineOptionSet( + new CommandLineOption("editorTestsResultFile", filePath => { resultFilePath = filePath; }), + new CommandLineOption("testResults", filePath => { resultFilePath = filePath; }), + new CommandLineOption("deviceLogs", dirPath => { deviceLogsDirectory = dirPath; }) + ); + optionSet.Parse(commandLineArgs); + + return new ExecutionSettings() + { + TestResultsFile = resultFilePath, + DeviceLogsDirectory = deviceLogsDirectory + }; + } + + void DisplayQuitWarningIfQuitIsGiven(bool quitIsGiven) + { + if (quitIsGiven) + { + m_LogWarningAction("Running tests from command line arguments will not work when \"quit\" is specified."); + } + } + + void CheckForScriptCompilationErrors() + { + if (m_ScriptCompilationFailedCheck()) + { + throw new SetupException(SetupException.ExceptionType.ScriptCompilationFailed); + } + } + + void LogParametersForRun(string testPlatform, string[] testFilters, string[] testCategories, string testSettingsFilePath) + { + m_LogAction("Running tests for " + testPlatform); + if (testFilters != null && testFilters.Length > 0) + { + m_LogAction("With test filter: " + string.Join(", ", testFilters)); + } + if (testCategories != null && testCategories.Length > 0) + { + m_LogAction("With test categories: " + string.Join(", ", testCategories)); + } + if (!string.IsNullOrEmpty(testSettingsFilePath)) + { + m_LogAction("With test settings file: " + testSettingsFilePath); + } + } + + ITestSettings GetTestSettings(string testSettingsFilePath) + { + ITestSettings testSettings = null; + if (!string.IsNullOrEmpty(testSettingsFilePath)) + { + if (!m_FileExistsCheck(testSettingsFilePath)) + { + throw new SetupException(SetupException.ExceptionType.TestSettingsFileNotFound, testSettingsFilePath); + } + + testSettings = m_TestSettingsDeserializer.GetSettingsFromJsonFile(testSettingsFilePath); + } + return testSettings; + } + + static BuildTarget? SetFilterAndGetBuildTarget(string testPlatform, Filter filter) + { + BuildTarget? buildTarget = null; + if (testPlatform.ToLower() == "editmode") + { + filter.testMode = TestMode.EditMode; + } + else if (testPlatform.ToLower() == "playmode") + { + filter.testMode = TestMode.PlayMode; + } + else + { + try + { + buildTarget = (BuildTarget)Enum.Parse(typeof(BuildTarget), testPlatform, true); + + filter.testMode = TestMode.PlayMode; + } + catch (ArgumentException) + { + throw new SetupException(SetupException.ExceptionType.PlatformNotFound, testPlatform); + } + } + return buildTarget; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/SettingsBuilder.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/SettingsBuilder.cs.meta new file mode 100644 index 0000000..1e322b5 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/SettingsBuilder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b7468a027a77337478e133b40b42b4f9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/SetupException.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/SetupException.cs new file mode 100644 index 0000000..2f4051b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/SetupException.cs @@ -0,0 +1,23 @@ +using System; + +namespace UnityEditor.TestTools.TestRunner.CommandLineTest +{ + internal class SetupException : Exception + { + public ExceptionType Type { get; } + public object[] Details { get; } + + public SetupException(ExceptionType type, params object[] details) + { + Type = type; + Details = details; + } + + public enum ExceptionType + { + ScriptCompilationFailed, + PlatformNotFound, + TestSettingsFileNotFound, + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/SetupException.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/SetupException.cs.meta new file mode 100644 index 0000000..9fccc1d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/SetupException.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 63572993f2104574099a48392460b211 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/TestStarter.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/TestStarter.cs new file mode 100644 index 0000000..3ade433 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/TestStarter.cs @@ -0,0 +1,80 @@ +using System; +using System.IO; +using UnityEditor.TestRunner.CommandLineParser; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner.CommandLineTest +{ + [InitializeOnLoad] + static class TestStarter + { + static TestStarter() + { + if (!ShouldRunTests()) + { + return; + } + + if (EditorApplication.isCompiling) + { + return; + } + + executer.ExitOnCompileErrors(); + + if (RunData.instance.isRunning) + { + executer.SetUpCallbacks(RunData.instance.executionSettings); + return; + } + + EditorApplication.update += UpdateWatch; + } + + static void UpdateWatch() + { + EditorApplication.update -= UpdateWatch; + + if (RunData.instance.isRunning) + { + return; + } + + RunData.instance.isRunning = true; + var commandLineArgs = Environment.GetCommandLineArgs(); + RunData.instance.executionSettings = executer.BuildExecutionSettings(commandLineArgs); + executer.SetUpCallbacks(RunData.instance.executionSettings); + executer.InitializeAndExecuteRun(commandLineArgs); + } + + static bool ShouldRunTests() + { + var shouldRunTests = false; + var optionSet = new CommandLineOptionSet( + new CommandLineOption("runTests", () => { shouldRunTests = true; }), + new CommandLineOption("runEditorTests", () => { shouldRunTests = true; }) + ); + optionSet.Parse(Environment.GetCommandLineArgs()); + return shouldRunTests; + } + + static Executer s_Executer; + + static Executer executer + { + get + { + if (s_Executer == null) + { + Func compilationCheck = () => EditorUtility.scriptCompilationFailed; + Action actionLogger = (string msg) => { Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, msg); }; + var apiSettingsBuilder = new SettingsBuilder(new TestSettingsDeserializer(() => new TestSettings()), actionLogger, Debug.LogWarning, File.Exists, compilationCheck); + s_Executer = new Executer(ScriptableObject.CreateInstance(), apiSettingsBuilder, Debug.LogErrorFormat, Debug.LogException, EditorApplication.Exit, compilationCheck); + } + + return s_Executer; + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/TestStarter.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/TestStarter.cs.meta new file mode 100644 index 0000000..45d63f5 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/TestStarter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4d616d1a494edd144b262cf6cd5e5fda +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI.meta new file mode 100644 index 0000000..6c63332 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7e609b27ad2caa14c83dd9951b6c13c6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/AssetsDatabaseHelper.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/AssetsDatabaseHelper.cs new file mode 100644 index 0000000..d4fd891 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/AssetsDatabaseHelper.cs @@ -0,0 +1,11 @@ +namespace UnityEditor.TestTools.TestRunner.GUI +{ + internal class AssetsDatabaseHelper : IAssetsDatabaseHelper + { + public void OpenAssetInItsDefaultExternalEditor(string assetPath, int line) + { + var asset = AssetDatabase.LoadMainAssetAtPath(assetPath); + AssetDatabase.OpenAsset(asset, line); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/AssetsDatabaseHelper.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/AssetsDatabaseHelper.cs.meta new file mode 100644 index 0000000..601d916 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/AssetsDatabaseHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 740b3785866edda4b8d1e1a05570a5f8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/GuiHelper.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/GuiHelper.cs new file mode 100644 index 0000000..3db6d32 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/GuiHelper.cs @@ -0,0 +1,101 @@ +using System; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text.RegularExpressions; +using UnityEditor.Utils; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner.GUI +{ + internal class GuiHelper : IGuiHelper + { + public GuiHelper(IMonoCecilHelper monoCecilHelper, IAssetsDatabaseHelper assetsDatabaseHelper) + { + MonoCecilHelper = monoCecilHelper; + AssetsDatabaseHelper = assetsDatabaseHelper; + } + + protected IMonoCecilHelper MonoCecilHelper { get; private set; } + public IAssetsDatabaseHelper AssetsDatabaseHelper { get; private set; } + + public void OpenScriptInExternalEditor(Type type, MethodInfo method) + { + var fileOpenInfo = GetFileOpenInfo(type, method); + + if (string.IsNullOrEmpty(fileOpenInfo.FilePath)) + { + Debug.LogWarning("Failed to open test method source code in external editor. Inconsistent filename and yield return operator in target method."); + + return; + } + + if (fileOpenInfo.LineNumber == 1) + { + Debug.LogWarning("Failed to get a line number for unity test method. So please find it in opened file in external editor."); + } + + AssetsDatabaseHelper.OpenAssetInItsDefaultExternalEditor(fileOpenInfo.FilePath, fileOpenInfo.LineNumber); + } + + public IFileOpenInfo GetFileOpenInfo(Type type, MethodInfo method) + { + const string fileExtension = ".cs"; + + var fileOpenInfo = MonoCecilHelper.TryGetCecilFileOpenInfo(type, method); + if (string.IsNullOrEmpty(fileOpenInfo.FilePath)) + { + var dirPath = Paths.UnifyDirectorySeparator(Application.dataPath); + var allCsFiles = Directory.GetFiles(dirPath, string.Format("*{0}", fileExtension), SearchOption.AllDirectories) + .Select(Paths.UnifyDirectorySeparator); + + var fileName = allCsFiles.FirstOrDefault(x => + x.Split(Path.DirectorySeparatorChar).Last().Equals(string.Concat(type.Name, fileExtension))); + + fileOpenInfo.FilePath = fileName ?? string.Empty; + } + + fileOpenInfo.FilePath = FilePathToAssetsRelativeAndUnified(fileOpenInfo.FilePath); + + return fileOpenInfo; + } + + public string FilePathToAssetsRelativeAndUnified(string filePath) + { + if (string.IsNullOrEmpty(filePath)) + return string.Empty; + + filePath = Paths.UnifyDirectorySeparator(filePath); + var length = Paths.UnifyDirectorySeparator(Application.dataPath).Length - "Assets".Length; + + return filePath.Substring(length); + } + + public bool OpenScriptInExternalEditor(string stacktrace) + { + if (string.IsNullOrEmpty(stacktrace)) + return false; + + var regex = new Regex("in (?.*):{1}(?[0-9]+)"); + + var matchingLines = stacktrace.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).Where(x => regex.IsMatch(x)).ToList(); + if (!matchingLines.Any()) + return false; + + var fileOpenInfo = matchingLines + .Select(x => regex.Match(x)) + .Select(x => + new FileOpenInfo + { + FilePath = x.Groups["path"].Value, + LineNumber = int.Parse(x.Groups["line"].Value) + }) + .First(openInfo => !string.IsNullOrEmpty(openInfo.FilePath) && File.Exists(openInfo.FilePath)); + + var filePath = FilePathToAssetsRelativeAndUnified(fileOpenInfo.FilePath); + AssetsDatabaseHelper.OpenAssetInItsDefaultExternalEditor(filePath, fileOpenInfo.LineNumber); + + return true; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/GuiHelper.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/GuiHelper.cs.meta new file mode 100644 index 0000000..7d3deeb --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/GuiHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d0138170d24533e47b8e6c250c6d7fbc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/IAssetsDatabaseHelper.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/IAssetsDatabaseHelper.cs new file mode 100644 index 0000000..975996b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/IAssetsDatabaseHelper.cs @@ -0,0 +1,7 @@ +namespace UnityEditor.TestTools.TestRunner.GUI +{ + internal interface IAssetsDatabaseHelper + { + void OpenAssetInItsDefaultExternalEditor(string assetPath, int line); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/IAssetsDatabaseHelper.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/IAssetsDatabaseHelper.cs.meta new file mode 100644 index 0000000..66259d1 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/IAssetsDatabaseHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 208e46d59ff6e304db0318377d20f5a1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/IGuiHelper.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/IGuiHelper.cs new file mode 100644 index 0000000..9d43397 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/IGuiHelper.cs @@ -0,0 +1,13 @@ +using System; +using System.Reflection; + +namespace UnityEditor.TestTools.TestRunner.GUI +{ + internal interface IGuiHelper + { + bool OpenScriptInExternalEditor(string stacktrace); + void OpenScriptInExternalEditor(Type type, MethodInfo method); + IFileOpenInfo GetFileOpenInfo(Type type, MethodInfo method); + string FilePathToAssetsRelativeAndUnified(string filePath); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/IGuiHelper.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/IGuiHelper.cs.meta new file mode 100644 index 0000000..90a5490 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/IGuiHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fd57cf917f61bbb42b8f030436426ddd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder.meta new file mode 100644 index 0000000..93d48bc --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 07ea0326ed848fb4489187cb58f96113 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/RenderingOptions.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/RenderingOptions.cs new file mode 100644 index 0000000..495537f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/RenderingOptions.cs @@ -0,0 +1,12 @@ +namespace UnityEditor.TestTools.TestRunner.GUI +{ + internal class RenderingOptions + { + public string nameFilter; + public bool showSucceeded; + public bool showFailed; + public bool showIgnored; + public bool showNotRunned; + public string[] categories; + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/RenderingOptions.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/RenderingOptions.cs.meta new file mode 100644 index 0000000..a566ec8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/RenderingOptions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 87357ff0dec4ef348a295235835c6ee4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/ResultSummarizer.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/ResultSummarizer.cs new file mode 100644 index 0000000..c4d9ce4 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/ResultSummarizer.cs @@ -0,0 +1,175 @@ +// **************************************************************** +// Based on nUnit 2.6.2 (http://www.nunit.org/) +// **************************************************************** + +using System; +using System.Collections.Generic; +using UnityEngine.TestTools.TestRunner.GUI; + +namespace UnityEditor.TestTools.TestRunner.GUI +{ + /// + /// Summary description for ResultSummarizer. + /// + internal class ResultSummarizer + { + private int m_ErrorCount = -1; + private int m_FailureCount; + private int m_IgnoreCount = -1; + private int m_InconclusiveCount = -1; + private int m_NotRunnable = -1; + private int m_ResultCount; + private int m_SkipCount; + private int m_SuccessCount; + private int m_TestsRun; + + private TimeSpan m_Duration = TimeSpan.FromSeconds(0); + + public ResultSummarizer(IEnumerable results) + { + foreach (var result in results) + Summarize(result); + } + + public bool success + { + get { return m_FailureCount == 0; } + } + + /// + /// Returns the number of test cases for which results + /// have been summarized. Any tests excluded by use of + /// Category or Explicit attributes are not counted. + /// + public int ResultCount + { + get { return m_ResultCount; } + } + + /// + /// Returns the number of test cases actually run, which + /// is the same as ResultCount, less any Skipped, Ignored + /// or NonRunnable tests. + /// + public int TestsRun + { + get { return m_TestsRun; } + } + + /// + /// Returns the number of tests that passed + /// + public int Passed + { + get { return m_SuccessCount; } + } + + /// + /// Returns the number of test cases that had an error. + /// + public int errors + { + get { return m_ErrorCount; } + } + + /// + /// Returns the number of test cases that failed. + /// + public int failures + { + get { return m_FailureCount; } + } + + /// + /// Returns the number of test cases that failed. + /// + public int inconclusive + { + get { return m_InconclusiveCount; } + } + + /// + /// Returns the number of test cases that were not runnable + /// due to errors in the signature of the class or method. + /// Such tests are also counted as Errors. + /// + public int notRunnable + { + get { return m_NotRunnable; } + } + + /// + /// Returns the number of test cases that were skipped. + /// + public int Skipped + { + get { return m_SkipCount; } + } + + public int ignored + { + get { return m_IgnoreCount; } + } + + public double duration + { + get { return m_Duration.TotalSeconds; } + } + + public int testsNotRun + { + get { return m_SkipCount + m_IgnoreCount + m_NotRunnable; } + } + + public void Summarize(TestRunnerResult result) + { + m_Duration += TimeSpan.FromSeconds(result.duration); + m_ResultCount++; + + if (result.resultStatus != TestRunnerResult.ResultStatus.NotRun) + { + //TODO implement missing features + // if(result.IsIgnored) + // { + // m_IgnoreCount++; + // return; + // } + + m_SkipCount++; + return; + } + + switch (result.resultStatus) + { + case TestRunnerResult.ResultStatus.Passed: + m_SuccessCount++; + m_TestsRun++; + break; + case TestRunnerResult.ResultStatus.Failed: + m_FailureCount++; + m_TestsRun++; + break; + //TODO implement missing features + // case TestResultState.Error: + // case TestResultState.Cancelled: + // m_ErrorCount++; + // m_TestsRun++; + // break; + // case TestResultState.Inconclusive: + // m_InconclusiveCount++; + // m_TestsRun++; + // break; + // case TestResultState.NotRunnable: + // m_NotRunnable++; + // // errorCount++; + // break; + // case TestResultState.Ignored: + // m_IgnoreCount++; + // break; + default: + m_SkipCount++; + break; + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/ResultSummarizer.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/ResultSummarizer.cs.meta new file mode 100644 index 0000000..197b321 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/ResultSummarizer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 95a2914724952ef40bb590d0607fc878 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/TestFilterSettings.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/TestFilterSettings.cs new file mode 100644 index 0000000..faa828b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/TestFilterSettings.cs @@ -0,0 +1,105 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using UnityEngine.TestTools.TestRunner.GUI; + +namespace UnityEditor.TestTools.TestRunner.GUI +{ + internal class TestFilterSettings + { + public bool showSucceeded; + public bool showFailed; + public bool showIgnored; + public bool showNotRun; + + public string filterByName; + public int filterByCategory; + + private GUIContent m_SucceededBtn; + private GUIContent m_FailedBtn; + private GUIContent m_IgnoredBtn; + private GUIContent m_NotRunBtn; + + public string[] availableCategories; + + private readonly string m_PrefsKey; + + public TestFilterSettings(string prefsKey) + { + availableCategories = null; + m_PrefsKey = prefsKey; + Load(); + UpdateCounters(Enumerable.Empty()); + } + + public void Load() + { + showSucceeded = EditorPrefs.GetBool(m_PrefsKey + ".ShowSucceeded", true); + showFailed = EditorPrefs.GetBool(m_PrefsKey + ".ShowFailed", true); + showIgnored = EditorPrefs.GetBool(m_PrefsKey + ".ShowIgnored", true); + showNotRun = EditorPrefs.GetBool(m_PrefsKey + ".ShowNotRun", true); + filterByName = EditorPrefs.GetString(m_PrefsKey + ".FilterByName", string.Empty); + filterByCategory = EditorPrefs.GetInt(m_PrefsKey + ".FilterByCategory", 0); + } + + public void Save() + { + EditorPrefs.SetBool(m_PrefsKey + ".ShowSucceeded", showSucceeded); + EditorPrefs.SetBool(m_PrefsKey + ".ShowFailed", showFailed); + EditorPrefs.SetBool(m_PrefsKey + ".ShowIgnored", showIgnored); + EditorPrefs.SetBool(m_PrefsKey + ".ShowNotRun", showNotRun); + EditorPrefs.SetString(m_PrefsKey + ".FilterByName", filterByName); + EditorPrefs.SetInt(m_PrefsKey + ".FilterByCategory", filterByCategory); + } + + public void UpdateCounters(IEnumerable results) + { + var summary = new ResultSummarizer(results); + + m_SucceededBtn = new GUIContent(summary.Passed.ToString(), Icons.s_SuccessImg, "Show tests that succeeded"); + m_FailedBtn = new GUIContent((summary.errors + summary.failures + summary.inconclusive).ToString(), Icons.s_FailImg, "Show tests that failed"); + m_IgnoredBtn = new GUIContent((summary.ignored + summary.notRunnable).ToString(), Icons.s_IgnoreImg, "Show tests that are ignored"); + m_NotRunBtn = new GUIContent((summary.testsNotRun - summary.ignored - summary.notRunnable).ToString(), Icons.s_UnknownImg, "Show tests that didn't run"); + } + + public string[] GetSelectedCategories() + { + if (availableCategories == null) + return new string[0]; + + return availableCategories.Where((c, i) => (filterByCategory & (1 << i)) != 0).ToArray(); + } + + public void OnGUI() + { + EditorGUI.BeginChangeCheck(); + + filterByName = GUILayout.TextField(filterByName, "ToolbarSeachTextField", GUILayout.MinWidth(100), GUILayout.MaxWidth(250), GUILayout.ExpandWidth(true)); + if (GUILayout.Button(GUIContent.none, string.IsNullOrEmpty(filterByName) ? "ToolbarSeachCancelButtonEmpty" : "ToolbarSeachCancelButton")) + filterByName = string.Empty; + + if (availableCategories != null && availableCategories.Length > 0) + filterByCategory = EditorGUILayout.MaskField(filterByCategory, availableCategories, EditorStyles.toolbarDropDown, GUILayout.MaxWidth(90)); + + showSucceeded = GUILayout.Toggle(showSucceeded, m_SucceededBtn, EditorStyles.toolbarButton); + showFailed = GUILayout.Toggle(showFailed, m_FailedBtn, EditorStyles.toolbarButton); + showIgnored = GUILayout.Toggle(showIgnored, m_IgnoredBtn, EditorStyles.toolbarButton); + showNotRun = GUILayout.Toggle(showNotRun, m_NotRunBtn, EditorStyles.toolbarButton); + + if (EditorGUI.EndChangeCheck()) + Save(); + } + + public RenderingOptions BuildRenderingOptions() + { + var options = new RenderingOptions(); + options.showSucceeded = showSucceeded; + options.showFailed = showFailed; + options.showIgnored = showIgnored; + options.showNotRunned = showNotRun; + options.nameFilter = filterByName; + options.categories = GetSelectedCategories(); + return options; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/TestFilterSettings.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/TestFilterSettings.cs.meta new file mode 100644 index 0000000..8d26c30 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/TestFilterSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 046c3854296c5ec48bac50da6ca248ec +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/TestTreeViewBuilder.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/TestTreeViewBuilder.cs new file mode 100644 index 0000000..a6f53c9 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/TestTreeViewBuilder.cs @@ -0,0 +1,111 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEditor.IMGUI.Controls; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine.TestRunner.NUnitExtensions; +using UnityEngine.TestTools.TestRunner.GUI; +using UnityEngine.TestRunner.NUnitExtensions.Filters; + +namespace UnityEditor.TestTools.TestRunner.GUI +{ + internal class TestTreeViewBuilder + { + public List results = new List(); + private readonly List m_OldTestResultList; + private readonly TestRunnerUIFilter m_UIFilter; + private readonly ITestAdaptor m_TestListRoot; + + private readonly List m_AvailableCategories = new List(); + + public string[] AvailableCategories + { + get { return m_AvailableCategories.Distinct().OrderBy(a => a).ToArray(); } + } + + public TestTreeViewBuilder(ITestAdaptor tests, List oldTestResultResults, TestRunnerUIFilter uiFilter) + { + m_AvailableCategories.Add(CategoryFilterExtended.k_DefaultCategory); + m_OldTestResultList = oldTestResultResults; + m_TestListRoot = tests; + m_UIFilter = uiFilter; + } + + public TreeViewItem BuildTreeView(TestFilterSettings settings, bool sceneBased, string sceneName) + { + var rootItem = new TreeViewItem(int.MaxValue, 0, null, "Invisible Root Item"); + ParseTestTree(0, rootItem, m_TestListRoot); + return rootItem; + } + + private bool IsFilteredOutByUIFilter(ITestAdaptor test, TestRunnerResult result) + { + if (m_UIFilter.PassedHidden && result.resultStatus == TestRunnerResult.ResultStatus.Passed) + return true; + if (m_UIFilter.FailedHidden && (result.resultStatus == TestRunnerResult.ResultStatus.Failed || result.resultStatus == TestRunnerResult.ResultStatus.Inconclusive)) + return true; + if (m_UIFilter.NotRunHidden && (result.resultStatus == TestRunnerResult.ResultStatus.NotRun || result.resultStatus == TestRunnerResult.ResultStatus.Skipped)) + return true; + if (m_UIFilter.CategoryFilter.Length > 0) + return !test.Categories.Any(category => m_UIFilter.CategoryFilter.Contains(category)); + return false; + } + + private void ParseTestTree(int depth, TreeViewItem rootItem, ITestAdaptor testElement) + { + m_AvailableCategories.AddRange(testElement.Categories); + + var testElementId = testElement.UniqueName; + if (!testElement.HasChildren) + { + var result = m_OldTestResultList.FirstOrDefault(a => a.uniqueId == testElementId); + + if (result != null && + (result.ignoredOrSkipped + || result.notRunnable + || testElement.RunState == RunState.NotRunnable + || testElement.RunState == RunState.Ignored + || testElement.RunState == RunState.Skipped + ) + ) + { + //if the test was or becomes ignored or not runnable, we recreate the result in case it has changed + result = null; + } + if (result == null) + { + result = new TestRunnerResult(testElement); + } + results.Add(result); + + var test = new TestTreeViewItem(testElement, depth, rootItem); + if (!IsFilteredOutByUIFilter(testElement, result)) + rootItem.AddChild(test); + test.SetResult(result); + return; + } + + var groupResult = m_OldTestResultList.FirstOrDefault(a => a.uniqueId == testElementId); + if (groupResult == null) + { + groupResult = new TestRunnerResult(testElement); + } + + results.Add(groupResult); + var group = new TestTreeViewItem(testElement, depth, rootItem); + group.SetResult(groupResult); + + depth++; + foreach (var child in testElement.Children) + { + ParseTestTree(depth, group, child); + } + + + if (testElement.IsTestAssembly && !testElement.HasChildren) + return; + + if (group.hasChildren) + rootItem.AddChild(group); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/TestTreeViewBuilder.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/TestTreeViewBuilder.cs.meta new file mode 100644 index 0000000..dbed4be --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListBuilder/TestTreeViewBuilder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e17c88b021c2a4c409b3f15b0d80ac62 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListGuiHelper.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListGuiHelper.cs new file mode 100644 index 0000000..992f161 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListGuiHelper.cs @@ -0,0 +1,135 @@ +using System; +using System.IO; +using System.Linq; +using UnityEditor.ProjectWindowCallback; +using UnityEditor.Scripting.ScriptCompilation; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner.GUI +{ + internal class TestListGUIHelper + { + private const string kResourcesTemplatePath = "Resources/ScriptTemplates"; + private const string kAssemblyDefinitionTestTemplate = "92-Assembly Definition-NewTestAssembly.asmdef.txt"; + + private const string kAssemblyDefinitionEditModeTestTemplate = + "92-Assembly Definition-NewEditModeTestAssembly.asmdef.txt"; + + private const string kTestScriptTemplate = "83-C# Script-NewTestScript.cs.txt"; + private const string kNewTestScriptName = "NewTestScript.cs"; + private const string kNunit = "nunit.framework.dll"; + + [MenuItem("Assets/Create/Testing/Tests Assembly Folder", false, 83)] + public static void MenuItemAddFolderAndAsmDefForTesting() + { + AddFolderAndAsmDefForTesting(); + } + + [MenuItem("Assets/Create/Testing/Tests Assembly Folder", true, 83)] + public static bool MenuItemAddFolderAndAsmDefForTestingWithValidation() + { + return !SelectedFolderContainsTestAssembly(); + } + + public static void AddFolderAndAsmDefForTesting(bool isEditorOnly = false) + { + ProjectWindowUtil.CreateFolderWithTemplates("Tests", + isEditorOnly ? kAssemblyDefinitionEditModeTestTemplate : kAssemblyDefinitionTestTemplate); + } + + public static bool SelectedFolderContainsTestAssembly() + { + var theNearestCustomScriptAssembly = GetTheNearestCustomScriptAssembly(); + if (theNearestCustomScriptAssembly != null) + { + return theNearestCustomScriptAssembly.PrecompiledReferences != null && theNearestCustomScriptAssembly.PrecompiledReferences.Any(x => Path.GetFileName(x) == kNunit); + } + + return false; + } + + [MenuItem("Assets/Create/Testing/C# Test Script", false, 83)] + public static void AddTest() + { + var basePath = Path.Combine(EditorApplication.applicationContentsPath, kResourcesTemplatePath); + var destPath = Path.Combine(GetActiveFolderPath(), kNewTestScriptName); + var templatePath = Path.Combine(basePath, kTestScriptTemplate); + var icon = EditorGUIUtility.IconContent("cs Script Icon").image as Texture2D; + ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, + ScriptableObject.CreateInstance(), destPath, icon, templatePath); + + AssetDatabase.Refresh(); + } + + [MenuItem("Assets/Create/Testing/C# Test Script", true, 83)] + public static bool CanAddScriptAndItWillCompile() + { + return CanAddEditModeTestScriptAndItWillCompile() || CanAddPlayModeTestScriptAndItWillCompile(); + } + + public static bool CanAddEditModeTestScriptAndItWillCompile() + { + var theNearestCustomScriptAssembly = GetTheNearestCustomScriptAssembly(); + if (theNearestCustomScriptAssembly != null) + { + return (theNearestCustomScriptAssembly.AssemblyFlags & AssemblyFlags.EditorOnly) == + AssemblyFlags.EditorOnly; + } + + var activeFolderPath = GetActiveFolderPath(); + return activeFolderPath.ToLower().Contains("/editor"); + } + + public static bool CanAddPlayModeTestScriptAndItWillCompile() + { + if (PlayerSettings.playModeTestRunnerEnabled) + { + return true; + } + + var theNearestCustomScriptAssembly = GetTheNearestCustomScriptAssembly(); + + if (theNearestCustomScriptAssembly == null) + { + return false; + } + + var hasTestAssemblyFlag = theNearestCustomScriptAssembly.PrecompiledReferences != null && theNearestCustomScriptAssembly.PrecompiledReferences.Any(x => Path.GetFileName(x) == kNunit);; + var editorOnlyAssembly = (theNearestCustomScriptAssembly.AssemblyFlags & AssemblyFlags.EditorOnly) != 0; + + return hasTestAssemblyFlag && !editorOnlyAssembly; + } + + public static string GetActiveFolderPath() + { + var path = "Assets"; + + foreach (var obj in Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets)) + { + path = AssetDatabase.GetAssetPath(obj); + if (!string.IsNullOrEmpty(path) && File.Exists(path)) + { + path = Path.GetDirectoryName(path); + break; + } + } + return path; + } + + private static CustomScriptAssembly GetTheNearestCustomScriptAssembly() + { + CustomScriptAssembly findCustomScriptAssemblyFromScriptPath; + try + { + findCustomScriptAssemblyFromScriptPath = + EditorCompilationInterface.Instance.FindCustomScriptAssemblyFromScriptPath( + Path.Combine(GetActiveFolderPath(), "Foo.cs")); + } + catch (Exception) + { + return null; + } + return findCustomScriptAssemblyFromScriptPath; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListGuiHelper.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListGuiHelper.cs.meta new file mode 100644 index 0000000..b60d7fe --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListGuiHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 97a05971510726f438153cd4987526fb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView.meta new file mode 100644 index 0000000..5f5c3a1 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 68cb547af0187634aad591a09c01cd5b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/Icons.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/Icons.cs new file mode 100644 index 0000000..706130a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/Icons.cs @@ -0,0 +1,24 @@ +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner.GUI +{ + internal static class Icons + { + public static readonly Texture2D s_FailImg; + public static readonly Texture2D s_IgnoreImg; + public static readonly Texture2D s_SuccessImg; + public static readonly Texture2D s_UnknownImg; + public static readonly Texture2D s_InconclusiveImg; + public static readonly Texture2D s_StopwatchImg; + + static Icons() + { + s_FailImg = EditorGUIUtility.IconContent("TestFailed").image as Texture2D; + s_IgnoreImg = EditorGUIUtility.IconContent("TestIgnored").image as Texture2D; + s_SuccessImg = EditorGUIUtility.IconContent("TestPassed").image as Texture2D; + s_UnknownImg = EditorGUIUtility.IconContent("TestNormal").image as Texture2D; + s_InconclusiveImg = EditorGUIUtility.IconContent("TestInconclusive").image as Texture2D; + s_StopwatchImg = EditorGUIUtility.IconContent("TestStopwatch").image as Texture2D; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/Icons.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/Icons.cs.meta new file mode 100644 index 0000000..00f10ba --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/Icons.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 27769e9b00b038d47aefe306a4d20bec +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestListTreeViewDataSource.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestListTreeViewDataSource.cs new file mode 100644 index 0000000..9e6f1b7 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestListTreeViewDataSource.cs @@ -0,0 +1,99 @@ +using System.Collections.Generic; +using NUnit.Framework.Interfaces; +using UnityEditor.IMGUI.Controls; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine.SceneManagement; +using UnityEngine.TestTools.TestRunner; +using UnityEngine.TestTools.TestRunner.GUI; + +namespace UnityEditor.TestTools.TestRunner.GUI +{ + internal class TestListTreeViewDataSource : TreeViewDataSource + { + private bool m_ExpandTreeOnCreation; + private readonly TestListGUI m_TestListGUI; + private ITestAdaptor m_RootTest; + + public TestListTreeViewDataSource(TreeViewController testListTree, TestListGUI testListGUI, ITestAdaptor rootTest) : base(testListTree) + { + showRootItem = false; + rootIsCollapsable = false; + m_TestListGUI = testListGUI; + m_RootTest = rootTest; + } + + public void UpdateRootTest(ITestAdaptor rootTest) + { + m_RootTest = rootTest; + } + + public override void FetchData() + { + var sceneName = SceneManager.GetActiveScene().name; + if (sceneName.StartsWith("InitTestScene")) + sceneName = PlaymodeTestsController.GetController().settings.originalScene; + + var testListBuilder = new TestTreeViewBuilder(m_RootTest, m_TestListGUI.newResultList, m_TestListGUI.m_TestRunnerUIFilter); + + m_RootItem = testListBuilder.BuildTreeView(null, false, sceneName); + SetExpanded(m_RootItem, true); + if (m_RootItem.hasChildren && m_RootItem.children.Count == 1) + SetExpanded(m_RootItem.children[0], true); + + if (m_ExpandTreeOnCreation) + SetExpandedWithChildren(m_RootItem, true); + + m_TestListGUI.newResultList = new List(testListBuilder.results); + m_TestListGUI.m_TestRunnerUIFilter.availableCategories = testListBuilder.AvailableCategories; + m_NeedRefreshRows = true; + } + + public override bool IsRenamingItemAllowed(TreeViewItem item) + { + return false; + } + + public void ExpandTreeOnCreation() + { + m_ExpandTreeOnCreation = true; + } + + public override bool IsExpandable(TreeViewItem item) + { + if (item is TestTreeViewItem) + return ((TestTreeViewItem)item).IsGroupNode; + return base.IsExpandable(item); + } + + protected override List Search(TreeViewItem rootItem, string search) + { + var result = new List(); + + if (rootItem.hasChildren) + { + foreach (var child in rootItem.children) + { + SearchTestTree(child, search, result); + } + } + return result; + } + + protected void SearchTestTree(TreeViewItem item, string search, IList searchResult) + { + var testItem = item as TestTreeViewItem; + if (!testItem.IsGroupNode) + { + if (testItem.FullName.ToLower().Contains(search)) + { + searchResult.Add(item); + } + } + else if (item.children != null) + { + foreach (var child in item.children) + SearchTestTree(child, search, searchResult); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestListTreeViewDataSource.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestListTreeViewDataSource.cs.meta new file mode 100644 index 0000000..c70d7e5 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestListTreeViewDataSource.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ce87c287371edde43a4b5fcfdee7b9ef +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestListTreeViewGUI.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestListTreeViewGUI.cs new file mode 100644 index 0000000..a45d2bb --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestListTreeViewGUI.cs @@ -0,0 +1,11 @@ +using UnityEditor.IMGUI.Controls; + +namespace UnityEditor.TestTools.TestRunner.GUI +{ + internal class TestListTreeViewGUI : TreeViewGUI + { + public TestListTreeViewGUI(TreeViewController testListTree) : base(testListTree) + { + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestListTreeViewGUI.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestListTreeViewGUI.cs.meta new file mode 100644 index 0000000..26d2c9c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestListTreeViewGUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 52c907c81459f324497af504b84fd557 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestTreeViewItem.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestTreeViewItem.cs new file mode 100644 index 0000000..327b1fa --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestTreeViewItem.cs @@ -0,0 +1,118 @@ +using System; +using System.Reflection; +using System.Text; +using UnityEditor.IMGUI.Controls; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine.TestTools.TestRunner.GUI; + +namespace UnityEditor.TestTools.TestRunner.GUI +{ + internal sealed class TestTreeViewItem : TreeViewItem + { + public TestRunnerResult result; + internal ITestAdaptor m_Test; + + public Type type; + public MethodInfo method; + + private const int k_ResultTestMaxLength = 15000; + + public bool IsGroupNode { get { return m_Test.IsSuite; } } + + public string FullName { get { return m_Test.FullName; } } + + public TestTreeViewItem(ITestAdaptor test, int depth, TreeViewItem parent) + : base(GetId(test), depth, parent, test.Name) + { + m_Test = test; + + if (test.TypeInfo != null) + { + type = test.TypeInfo.Type; + } + if (test.Method != null) + { + method = test.Method.MethodInfo; + } + + displayName = test.Name.Replace("\n", ""); + icon = Icons.s_UnknownImg; + } + + private static int GetId(ITestAdaptor test) + { + return test.UniqueName.GetHashCode(); + } + + public void SetResult(TestRunnerResult testResult) + { + result = testResult; + result.SetResultChangedCallback(ResultUpdated); + ResultUpdated(result); + } + + public string GetResultText() + { + var durationString = String.Format("{0:0.000}", result.duration); + var sb = new StringBuilder(string.Format("{0} ({1}s)", displayName.Trim(), durationString)); + if (!string.IsNullOrEmpty(result.description)) + { + sb.AppendFormat("\n{0}", result.description); + } + if (!string.IsNullOrEmpty(result.messages)) + { + sb.Append("\n---\n"); + sb.Append(result.messages.Trim()); + } + if (!string.IsNullOrEmpty(result.stacktrace)) + { + sb.Append("\n---\n"); + sb.Append(result.stacktrace.Trim()); + } + if (!string.IsNullOrEmpty(result.output)) + { + sb.Append("\n---\n"); + sb.Append(result.output.Trim()); + } + if (sb.Length > k_ResultTestMaxLength) + { + sb.Length = k_ResultTestMaxLength; + sb.AppendFormat("...\n\n---MESSAGE TRUNCATED AT {0} CHARACTERS---", k_ResultTestMaxLength); + } + return sb.ToString().Trim(); + } + + private void ResultUpdated(TestRunnerResult testResult) + { + switch (testResult.resultStatus) + { + case TestRunnerResult.ResultStatus.Passed: + icon = Icons.s_SuccessImg; + break; + case TestRunnerResult.ResultStatus.Failed: + icon = Icons.s_FailImg; + break; + case TestRunnerResult.ResultStatus.Inconclusive: + icon = Icons.s_InconclusiveImg; + break; + case TestRunnerResult.ResultStatus.Skipped: + icon = Icons.s_IgnoreImg; + break; + default: + if (testResult.ignoredOrSkipped) + { + icon = Icons.s_IgnoreImg; + } + else if (testResult.notRunnable) + { + icon = Icons.s_FailImg; + } + else + { + icon = Icons.s_UnknownImg; + } + break; + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestTreeViewItem.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestTreeViewItem.cs.meta new file mode 100644 index 0000000..3d38673 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestListTreeView/TestTreeViewItem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ce567ddbf30368344bc7b80e20cac36e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestRunnerResult.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestRunnerResult.cs new file mode 100644 index 0000000..d6072a1 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestRunnerResult.cs @@ -0,0 +1,149 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine.TestTools.TestRunner.GUI; + +namespace UnityEditor.TestTools.TestRunner.GUI +{ + [Serializable] + internal class TestRunnerResult : TestRunnerFilter.IClearableResult + { + public string id; + public string uniqueId; + public string name; + public string fullName; + public ResultStatus resultStatus = ResultStatus.NotRun; + public float duration; + public string messages; + public string output; + public string stacktrace; + public bool notRunnable; + public bool ignoredOrSkipped; + public string description; + public bool isSuite; + public List categories; + public string parentId; + public string parentUniqueId; + + //This field is suppose to mark results from before domain reload + //Such result is outdated because the code might haev changed + //This field will get reset every time a domain reload happens + [NonSerialized] + public bool notOutdated; + + protected Action m_OnResultUpdate; + + internal TestRunnerResult(ITestAdaptor test) + { + id = test.Id; + uniqueId = test.UniqueName; + + fullName = test.FullName; + name = test.Name; + description = test.Description; + isSuite = test.IsSuite; + + ignoredOrSkipped = test.RunState == RunState.Ignored || test.RunState == RunState.Skipped; + notRunnable = test.RunState == RunState.NotRunnable; + + if (ignoredOrSkipped) + { + messages = test.SkipReason; + } + if (notRunnable) + { + resultStatus = ResultStatus.Failed; + messages = test.SkipReason; + } + categories = test.Categories.ToList(); + parentId = test.ParentId; + parentUniqueId = test.ParentUniqueName; + } + + internal TestRunnerResult(ITestResultAdaptor testResult) : this(testResult.Test) + { + notOutdated = true; + + messages = testResult.Message; + output = testResult.Output; + stacktrace = testResult.StackTrace; + duration = (float)testResult.Duration; + if (testResult.Test.IsSuite && testResult.ResultState == "Ignored") + { + resultStatus = ResultStatus.Passed; + } + else + { + resultStatus = ParseNUnitResultStatus(testResult.TestStatus); + } + } + + public void Update(TestRunnerResult result) + { + if (ReferenceEquals(result, null)) + return; + resultStatus = result.resultStatus; + duration = result.duration; + messages = result.messages; + output = result.output; + stacktrace = result.stacktrace; + ignoredOrSkipped = result.ignoredOrSkipped; + notRunnable = result.notRunnable; + description = result.description; + notOutdated = result.notOutdated; + if (m_OnResultUpdate != null) + m_OnResultUpdate(this); + } + + public void SetResultChangedCallback(Action resultUpdated) + { + m_OnResultUpdate = resultUpdated; + } + + [Serializable] + internal enum ResultStatus + { + NotRun, + Passed, + Failed, + Inconclusive, + Skipped + } + + private static ResultStatus ParseNUnitResultStatus(TestStatus status) + { + switch (status) + { + case TestStatus.Passed: + return ResultStatus.Passed; + case TestStatus.Failed: + return ResultStatus.Failed; + case TestStatus.Inconclusive: + return ResultStatus.Inconclusive; + case TestStatus.Skipped: + return ResultStatus.Skipped; + default: + return ResultStatus.NotRun; + } + } + + public override string ToString() + { + return string.Format("{0} ({1})", name, fullName); + } + + public string Id { get { return uniqueId; } } + public string FullName { get { return fullName; } } + public string ParentId { get { return parentUniqueId; } } + public bool IsSuite { get { return isSuite; } } + public List Categories { get { return categories; } } + + public void Clear() + { + resultStatus = ResultStatus.NotRun; + if (m_OnResultUpdate != null) + m_OnResultUpdate(this); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestRunnerResult.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestRunnerResult.cs.meta new file mode 100644 index 0000000..034a196 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestRunnerResult.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a04a45bbed9e1714f9902fc9443669b9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestRunnerUIFilter.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestRunnerUIFilter.cs new file mode 100644 index 0000000..2694c7f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestRunnerUIFilter.cs @@ -0,0 +1,178 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using UnityEngine.TestTools.TestRunner.GUI; + +namespace UnityEditor.TestTools.TestRunner.GUI +{ + [Serializable] + internal class TestRunnerUIFilter + { + private int m_PassedCount; + private int m_FailedCount; + private int m_NotRunCount; + private int m_InconclusiveCount; + private int m_SkippedCount; + + public int PassedCount { get { return m_PassedCount; } } + public int FailedCount { get { return m_FailedCount + m_InconclusiveCount; } } + public int NotRunCount { get { return m_NotRunCount + m_SkippedCount; } } + + [SerializeField] + public bool PassedHidden; + [SerializeField] + public bool FailedHidden; + [SerializeField] + public bool NotRunHidden; + + [SerializeField] + private string m_SearchString; + [SerializeField] + private int selectedCategoryMask; + + public string[] availableCategories = new string[0]; + + + private GUIContent m_SucceededBtn; + private GUIContent m_FailedBtn; + private GUIContent m_NotRunBtn; + + public Action RebuildTestList; + public Action SearchStringChanged; + public Action SearchStringCleared; + public bool IsFiltering + { + get + { + return !string.IsNullOrEmpty(m_SearchString) || PassedHidden || FailedHidden || NotRunHidden || + selectedCategoryMask != 0; + } + } + + public string[] CategoryFilter + { + get + { + var list = new List(); + for (int i = 0; i < availableCategories.Length; i++) + { + if ((selectedCategoryMask & (1 << i)) != 0) + { + list.Add(availableCategories[i]); + } + } + return list.ToArray(); + } + } + + public void UpdateCounters(List resultList) + { + m_PassedCount = m_FailedCount = m_NotRunCount = m_InconclusiveCount = m_SkippedCount = 0; + foreach (var result in resultList) + { + if (result.isSuite) + continue; + switch (result.resultStatus) + { + case TestRunnerResult.ResultStatus.Passed: + m_PassedCount++; + break; + case TestRunnerResult.ResultStatus.Failed: + m_FailedCount++; + break; + case TestRunnerResult.ResultStatus.Inconclusive: + m_InconclusiveCount++; + break; + case TestRunnerResult.ResultStatus.Skipped: + m_SkippedCount++; + break; + case TestRunnerResult.ResultStatus.NotRun: + default: + m_NotRunCount++; + break; + } + } + + var succeededTooltip = string.Format("Show tests that succeeded\n{0} succeeded", m_PassedCount); + m_SucceededBtn = new GUIContent(PassedCount.ToString(), Icons.s_SuccessImg, succeededTooltip); + var failedTooltip = string.Format("Show tests that failed\n{0} failed\n{1} inconclusive", m_FailedCount, m_InconclusiveCount); + m_FailedBtn = new GUIContent(FailedCount.ToString(), Icons.s_FailImg, failedTooltip); + var notRunTooltip = string.Format("Show tests that didn't run\n{0} didn't run\n{1} skipped or ignored", m_NotRunCount, m_SkippedCount); + m_NotRunBtn = new GUIContent(NotRunCount.ToString(), Icons.s_UnknownImg, notRunTooltip); + } + + public void Draw() + { + EditorGUI.BeginChangeCheck(); + if (m_SearchString == null) + { + m_SearchString = ""; + } + m_SearchString = EditorGUILayout.ToolbarSearchField(m_SearchString); + if (EditorGUI.EndChangeCheck() && SearchStringChanged != null) + { + SearchStringChanged(m_SearchString); + if (String.IsNullOrEmpty(m_SearchString)) + SearchStringCleared(); + } + + if (availableCategories != null && availableCategories.Any()) + { + EditorGUI.BeginChangeCheck(); + selectedCategoryMask = EditorGUILayout.MaskField(selectedCategoryMask, availableCategories, EditorStyles.toolbarDropDown, GUILayout.MaxWidth(150)); + if (EditorGUI.EndChangeCheck() && RebuildTestList != null) + { + RebuildTestList(); + } + } + else + { + EditorGUILayout.Popup(0, new[] { "" }, EditorStyles.toolbarDropDown, GUILayout.MaxWidth(150)); + } + + EditorGUI.BeginChangeCheck(); + if (m_SucceededBtn != null) + { + PassedHidden = !GUILayout.Toggle(!PassedHidden, m_SucceededBtn, EditorStyles.toolbarButton, GUILayout.MaxWidth(GetMaxWidth(PassedCount))); + } + if (m_FailedBtn != null) + { + FailedHidden = !GUILayout.Toggle(!FailedHidden, m_FailedBtn, EditorStyles.toolbarButton, GUILayout.MaxWidth(GetMaxWidth(FailedCount))); + } + if (m_NotRunBtn != null) + { + NotRunHidden = !GUILayout.Toggle(!NotRunHidden, m_NotRunBtn, EditorStyles.toolbarButton, GUILayout.MaxWidth(GetMaxWidth(NotRunCount))); + } + + if (EditorGUI.EndChangeCheck() && RebuildTestList != null) + { + RebuildTestList(); + } + } + + private static int GetMaxWidth(int count) + { + if (count < 10) + return 33; + return count < 100 ? 40 : 47; + } + + public void Clear() + { + PassedHidden = false; + FailedHidden = false; + NotRunHidden = false; + selectedCategoryMask = 0; + m_SearchString = ""; + if (SearchStringChanged != null) + { + SearchStringChanged(m_SearchString); + } + if (SearchStringCleared != null) + { + SearchStringCleared(); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestRunnerUIFilter.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestRunnerUIFilter.cs.meta new file mode 100644 index 0000000..5842615 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/TestRunnerUIFilter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 15f870c6975ad6449b5b52514b90dc2b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views.meta new file mode 100644 index 0000000..83fac52 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c5535d742ea2e4941850b421f9c70a1f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/EditModeTestListGUI.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/EditModeTestListGUI.cs new file mode 100644 index 0000000..f630569 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/EditModeTestListGUI.cs @@ -0,0 +1,93 @@ +using System; +using System.Linq; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine; +using UnityEngine.TestTools; +using UnityEngine.TestTools.TestRunner.GUI; + +namespace UnityEditor.TestTools.TestRunner.GUI +{ + [Serializable] + internal class EditModeTestListGUI : TestListGUI + { + public override TestMode TestMode + { + get { return TestMode.EditMode; } + } + + public override void RenderNoTestsInfo() + { + if (!TestListGUIHelper.SelectedFolderContainsTestAssembly()) + { + var noTestText = "No tests to show"; + + if (!PlayerSettings.playModeTestRunnerEnabled) + { + const string testsArePulledFromCustomAssemblies = + "EditMode tests can be in Editor only Assemblies, either in the editor special folder or Editor only Assembly Definitions that references the \"nunit.framework.dll\" Assembly Reference or any of the Assembly Definition References \"UnityEngine.TestRunner\" or \"UnityEditor.TestRunner\".."; + noTestText += Environment.NewLine + testsArePulledFromCustomAssemblies; + } + + EditorGUILayout.HelpBox(noTestText, MessageType.Info); + if (GUILayout.Button("Create EditMode Test Assembly Folder")) + { + TestListGUIHelper.AddFolderAndAsmDefForTesting(isEditorOnly: true); + } + } + + if (!TestListGUIHelper.CanAddEditModeTestScriptAndItWillCompile()) + { + UnityEngine.GUI.enabled = false; + EditorGUILayout.HelpBox("EditMode test scripts can only be created in editor test assemblies.", MessageType.Warning); + } + if (GUILayout.Button("Create Test Script in current folder")) + { + TestListGUIHelper.AddTest(); + } + UnityEngine.GUI.enabled = true; + } + + public override void PrintHeadPanel() + { + base.PrintHeadPanel(); + DrawFilters(); + } + + protected override void RunTests(params TestRunnerFilter[] filters) + { + if (EditorUtility.scriptCompilationFailed) + { + Debug.LogError("Fix compilation issues before running tests"); + return; + } + + foreach (var filter in filters) + { + filter.ClearResults(newResultList.OfType().ToList()); + } + + RerunCallbackData.instance.runFilters = filters; + RerunCallbackData.instance.testMode = TestMode.EditMode; + + var testRunnerApi = ScriptableObject.CreateInstance(); + testRunnerApi.Execute(new ExecutionSettings() + { + filters = filters.Select(filter => new Filter() + { + assemblyNames = filter.assemblyNames, + categoryNames = filter.categoryNames, + groupNames = filter.groupNames, + testMode = TestMode, + testNames = filter.testNames + }).ToArray() + }); + } + + public override TestPlatform TestPlatform { get { return TestPlatform.EditMode; } } + + protected override bool IsBusy() + { + return TestRunnerApi.IsRunActive() || EditorApplication.isCompiling || EditorApplication.isPlaying; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/EditModeTestListGUI.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/EditModeTestListGUI.cs.meta new file mode 100644 index 0000000..93ff4f1 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/EditModeTestListGUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0336a32a79bfaed43a3fd2d88b91e974 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/PlayModeTestListGUI.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/PlayModeTestListGUI.cs new file mode 100644 index 0000000..43ae464 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/PlayModeTestListGUI.cs @@ -0,0 +1,111 @@ +using System; +using System.Linq; +using UnityEditor.SceneManagement; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine; +using UnityEngine.TestTools; +using UnityEngine.TestTools.TestRunner.GUI; + +namespace UnityEditor.TestTools.TestRunner.GUI +{ + [Serializable] + internal class PlayModeTestListGUI : TestListGUI + { + public override TestMode TestMode + { + get { return TestMode.PlayMode; } + } + public override void PrintHeadPanel() + { + EditorGUILayout.BeginHorizontal(GUILayout.ExpandHeight(false)); + base.PrintHeadPanel(); + var runButtonText = EditorUserBuildSettings.installInBuildFolder ? "Export project" : "Run all in player"; + if (GUILayout.Button($"{runButtonText} ({EditorUserBuildSettings.activeBuildTarget})", EditorStyles.toolbarButton)) + { + RunTestsInPlayer(); + } + EditorGUILayout.EndHorizontal(); + DrawFilters(); + EditorGUILayout.BeginHorizontal(GUILayout.ExpandHeight(false)); + EditorGUILayout.EndHorizontal(); + } + + public override void RenderNoTestsInfo() + { + if (!TestListGUIHelper.SelectedFolderContainsTestAssembly()) + { + var noTestText = "No tests to show"; + if (!PlayerSettings.playModeTestRunnerEnabled) + { + const string testsArePulledFromCustomAssemblues = "Test Assemblies are defined by Assembly Definitions that references the \"nunit.framework.dll\" Assembly Reference or the Assembly Definition Reference \"UnityEngine.TestRunner\"."; + const string infoTextAboutTestsInAllAssemblies = + "To have tests in all assemblies enable it in the Test Runner window context menu"; + noTestText += Environment.NewLine + testsArePulledFromCustomAssemblues + Environment.NewLine + + infoTextAboutTestsInAllAssemblies; + } + + EditorGUILayout.HelpBox(noTestText, MessageType.Info); + if (GUILayout.Button("Create PlayMode Test Assembly Folder")) + { + TestListGUIHelper.AddFolderAndAsmDefForTesting(); + } + } + + if (!TestListGUIHelper.CanAddPlayModeTestScriptAndItWillCompile()) + { + UnityEngine.GUI.enabled = false; + EditorGUILayout.HelpBox("PlayMode test scripts can only be created in non editor test assemblies.", MessageType.Warning); + } + if (GUILayout.Button("Create Test Script in current folder")) + { + TestListGUIHelper.AddTest(); + } + UnityEngine.GUI.enabled = true; + } + + protected override void RunTests(TestRunnerFilter[] filters) + { + foreach (var filter in filters) + { + filter.ClearResults(newResultList.OfType().ToList()); + } + + RerunCallbackData.instance.runFilters = filters; + RerunCallbackData.instance.testMode = TestMode.PlayMode; + + var testRunnerApi = ScriptableObject.CreateInstance(); + testRunnerApi.Execute(new ExecutionSettings() + { + filters = filters.Select(filter => new Filter() + { + assemblyNames = filter.assemblyNames, + categoryNames = filter.categoryNames, + groupNames = filter.groupNames, + testMode = TestMode, + testNames = filter.testNames + }).ToArray() + }); + } + + protected void RunTestsInPlayer() + { + var testRunnerApi = ScriptableObject.CreateInstance(); + testRunnerApi.Execute(new ExecutionSettings() + { + filters = new [] { new Filter() + { + testMode = TestMode, + }}, + targetPlatform = EditorUserBuildSettings.activeBuildTarget + }); + GUIUtility.ExitGUI(); + } + + public override TestPlatform TestPlatform { get { return TestPlatform.PlayMode; } } + + protected override bool IsBusy() + { + return TestRunnerApi.IsRunActive() || PlaymodeLauncher.IsRunning || EditorApplication.isCompiling || EditorApplication.isPlaying; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/PlayModeTestListGUI.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/PlayModeTestListGUI.cs.meta new file mode 100644 index 0000000..191caab --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/PlayModeTestListGUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c3efd39f2cfb43a4c830d4fd5689900f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/TestListGUIBase.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/TestListGUIBase.cs new file mode 100644 index 0000000..0855a01 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/TestListGUIBase.cs @@ -0,0 +1,525 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using UnityEditor.IMGUI.Controls; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine; +using UnityEngine.TestTools.TestRunner.GUI; +using UnityEngine.TestTools; + +namespace UnityEditor.TestTools.TestRunner.GUI +{ + internal abstract class TestListGUI + { + private static readonly GUIContent s_GUIRunSelectedTests = EditorGUIUtility.TrTextContent("Run Selected", "Run selected test(s)"); + private static readonly GUIContent s_GUIRunAllTests = EditorGUIUtility.TrTextContent("Run All", "Run all tests"); + private static readonly GUIContent s_GUIRerunFailedTests = EditorGUIUtility.TrTextContent("Rerun Failed", "Rerun all failed tests"); + private static readonly GUIContent s_GUIRun = EditorGUIUtility.TrTextContent("Run"); + private static readonly GUIContent s_GUIRunUntilFailed = EditorGUIUtility.TrTextContent("Run Until Failed"); + private static readonly GUIContent s_GUIRun100Times = EditorGUIUtility.TrTextContent("Run 100 times"); + private static readonly GUIContent s_GUIOpenTest = EditorGUIUtility.TrTextContent("Open source code"); + private static readonly GUIContent s_GUIOpenErrorLine = EditorGUIUtility.TrTextContent("Open error line"); + private static readonly GUIContent s_GUIClearResults = EditorGUIUtility.TrTextContent("Clear Results", "Clear all test results"); + + [SerializeField] + protected TestRunnerWindow m_Window; + [SerializeField] + public List newResultList = new List(); + [SerializeField] + private string m_ResultText; + [SerializeField] + private string m_ResultStacktrace; + + private TreeViewController m_TestListTree; + [SerializeField] + internal TreeViewState m_TestListState; + [SerializeField] + internal TestRunnerUIFilter m_TestRunnerUIFilter = new TestRunnerUIFilter(); + + private Vector2 m_TestInfoScroll, m_TestListScroll; + private string m_PreviousProjectPath; + private List m_QueuedResults = new List(); + + protected TestListGUI() + { + MonoCecilHelper = new MonoCecilHelper(); + AssetsDatabaseHelper = new AssetsDatabaseHelper(); + + GuiHelper = new GuiHelper(MonoCecilHelper, AssetsDatabaseHelper); + } + + protected IMonoCecilHelper MonoCecilHelper { get; private set; } + protected IAssetsDatabaseHelper AssetsDatabaseHelper { get; private set; } + protected IGuiHelper GuiHelper { get; private set; } + + public abstract TestMode TestMode { get; } + + public virtual void PrintHeadPanel() + { + EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); + using (new EditorGUI.DisabledScope(IsBusy())) + { + if (GUILayout.Button(s_GUIRunAllTests, EditorStyles.toolbarButton)) + { + var filter = new TestRunnerFilter {categoryNames = m_TestRunnerUIFilter.CategoryFilter}; + RunTests(filter); + GUIUtility.ExitGUI(); + } + } + using (new EditorGUI.DisabledScope(m_TestListTree == null || !m_TestListTree.HasSelection() || IsBusy())) + { + if (GUILayout.Button(s_GUIRunSelectedTests, EditorStyles.toolbarButton)) + { + RunTests(GetSelectedTestsAsFilter(m_TestListTree.GetSelection())); + GUIUtility.ExitGUI(); + } + } + using (new EditorGUI.DisabledScope(m_TestRunnerUIFilter.FailedCount == 0 || IsBusy())) + { + if (GUILayout.Button(s_GUIRerunFailedTests, EditorStyles.toolbarButton)) + { + var failedTestnames = new List(); + foreach (var result in newResultList) + { + if (result.isSuite) + continue; + if (result.resultStatus == TestRunnerResult.ResultStatus.Failed || + result.resultStatus == TestRunnerResult.ResultStatus.Inconclusive) + failedTestnames.Add(result.fullName); + } + RunTests(new TestRunnerFilter() {testNames = failedTestnames.ToArray(), categoryNames = m_TestRunnerUIFilter.CategoryFilter}); + GUIUtility.ExitGUI(); + } + } + using (new EditorGUI.DisabledScope(IsBusy())) + { + if (GUILayout.Button(s_GUIClearResults, EditorStyles.toolbarButton)) + { + foreach (var result in newResultList) + { + result.Clear(); + } + m_TestRunnerUIFilter.UpdateCounters(newResultList); + GUIUtility.ExitGUI(); + } + } + GUILayout.FlexibleSpace(); + EditorGUILayout.EndHorizontal(); + } + + protected void DrawFilters() + { + EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); + m_TestRunnerUIFilter.Draw(); + EditorGUILayout.EndHorizontal(); + } + + public bool HasTreeData() + { + return m_TestListTree != null; + } + + public virtual void RenderTestList() + { + if (m_TestListTree == null) + { + GUILayout.Label("Loading..."); + return; + } + + m_TestListScroll = EditorGUILayout.BeginScrollView(m_TestListScroll, + GUILayout.ExpandWidth(true), + GUILayout.MaxWidth(2000)); + + if (m_TestListTree.data.root == null || m_TestListTree.data.rowCount == 0 || (!m_TestListTree.isSearching && !m_TestListTree.data.GetItem(0).hasChildren)) + { + if (m_TestRunnerUIFilter.IsFiltering) + { + if (GUILayout.Button("Clear filters")) + { + m_TestRunnerUIFilter.Clear(); + m_TestListTree.ReloadData(); + m_Window.Repaint(); + } + } + RenderNoTestsInfo(); + } + else + { + var treeRect = EditorGUILayout.GetControlRect(GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true)); + var treeViewKeyboardControlId = GUIUtility.GetControlID(FocusType.Keyboard); + + m_TestListTree.OnGUI(treeRect, treeViewKeyboardControlId); + } + + EditorGUILayout.EndScrollView(); + } + + public virtual void RenderNoTestsInfo() + { + EditorGUILayout.HelpBox("No tests to show", MessageType.Info); + } + + public void RenderDetails() + { + m_TestInfoScroll = EditorGUILayout.BeginScrollView(m_TestInfoScroll); + var resultTextSize = TestRunnerWindow.Styles.info.CalcSize(new GUIContent(m_ResultText)); + EditorGUILayout.SelectableLabel(m_ResultText, TestRunnerWindow.Styles.info, + GUILayout.ExpandHeight(true), + GUILayout.ExpandWidth(true), + GUILayout.MinWidth(resultTextSize.x), + GUILayout.MinHeight(resultTextSize.y)); + EditorGUILayout.EndScrollView(); + } + + public void Reload() + { + if (m_TestListTree != null) + { + m_TestListTree.ReloadData(); + UpdateQueuedResults(); + } + } + + public void Repaint() + { + if (m_TestListTree == null || m_TestListTree.data.root == null) + { + return; + } + + m_TestListTree.Repaint(); + if (m_TestListTree.data.rowCount == 0) + m_TestListTree.SetSelection(new int[0], false); + TestSelectionCallback(m_TestListState.selectedIDs.ToArray()); + } + + public void Init(TestRunnerWindow window, ITestAdaptor rootTest) + { + if (m_Window == null) + { + m_Window = window; + } + + if (m_TestListTree == null) + { + if (m_TestListState == null) + { + m_TestListState = new TreeViewState(); + } + if (m_TestListTree == null) + m_TestListTree = new TreeViewController(m_Window, m_TestListState); + + m_TestListTree.deselectOnUnhandledMouseDown = false; + + m_TestListTree.selectionChangedCallback += TestSelectionCallback; + m_TestListTree.itemDoubleClickedCallback += TestDoubleClickCallback; + m_TestListTree.contextClickItemCallback += TestContextClickCallback; + + var testListTreeViewDataSource = new TestListTreeViewDataSource(m_TestListTree, this, rootTest); + + if (!newResultList.Any()) + testListTreeViewDataSource.ExpandTreeOnCreation(); + + m_TestListTree.Init(new Rect(), + testListTreeViewDataSource, + new TestListTreeViewGUI(m_TestListTree), + null); + } + + EditorApplication.update += RepaintIfProjectPathChanged; + + m_TestRunnerUIFilter.UpdateCounters(newResultList); + m_TestRunnerUIFilter.RebuildTestList = () => m_TestListTree.ReloadData(); + m_TestRunnerUIFilter.SearchStringChanged = s => m_TestListTree.searchString = s; + m_TestRunnerUIFilter.SearchStringCleared = () => FrameSelection(); + } + + public void UpdateResult(TestRunnerResult result) + { + if (!HasTreeData()) + { + m_QueuedResults.Add(result); + return; + } + + if (newResultList.All(x => x.uniqueId != result.uniqueId)) + { + return; + } + + var testRunnerResult = newResultList.FirstOrDefault(x => x.uniqueId == result.uniqueId); + if (testRunnerResult != null) + { + testRunnerResult.Update(result); + } + + Repaint(); + m_Window.Repaint(); + } + + public void UpdateTestTree(ITestAdaptor test) + { + if (!HasTreeData()) + { + return; + } + + (m_TestListTree.data as TestListTreeViewDataSource).UpdateRootTest(test); + + m_TestListTree.ReloadData(); + Repaint(); + m_Window.Repaint(); + } + + private void UpdateQueuedResults() + { + foreach (var testRunnerResult in m_QueuedResults) + { + var existingResult = newResultList.FirstOrDefault(x => x.uniqueId == testRunnerResult.uniqueId); + if (existingResult != null) + { + existingResult.Update(testRunnerResult); + } + } + m_QueuedResults.Clear(); + TestSelectionCallback(m_TestListState.selectedIDs.ToArray()); + Repaint(); + m_Window.Repaint(); + } + + internal void TestSelectionCallback(int[] selected) + { + if (m_TestListTree != null && selected.Length == 1) + { + if (m_TestListTree != null) + { + var node = m_TestListTree.FindItem(selected[0]); + if (node is TestTreeViewItem) + { + var test = node as TestTreeViewItem; + m_ResultText = test.GetResultText(); + m_ResultStacktrace = test.result.stacktrace; + } + } + } + else if (selected.Length == 0) + { + m_ResultText = ""; + } + } + + protected virtual void TestDoubleClickCallback(int id) + { + if (IsBusy()) + return; + + RunTests(GetSelectedTestsAsFilter(new List { id })); + GUIUtility.ExitGUI(); + } + + protected virtual void RunTests(params TestRunnerFilter[] filters) + { + throw new NotImplementedException(); + } + + protected virtual void TestContextClickCallback(int id) + { + if (id == 0) + return; + + var m = new GenericMenu(); + var testFilters = GetSelectedTestsAsFilter(m_TestListState.selectedIDs); + var multilineSelection = m_TestListState.selectedIDs.Count > 1; + + if (!multilineSelection) + { + var testNode = GetSelectedTest(); + var isNotSuite = !testNode.IsGroupNode; + if (isNotSuite) + { + if (!string.IsNullOrEmpty(m_ResultStacktrace)) + { + m.AddItem(s_GUIOpenErrorLine, + false, + data => + { + if (!GuiHelper.OpenScriptInExternalEditor(m_ResultStacktrace)) + { + GuiHelper.OpenScriptInExternalEditor(testNode.type, testNode.method); + } + }, + ""); + } + + m.AddItem(s_GUIOpenTest, + false, + data => GuiHelper.OpenScriptInExternalEditor(testNode.type, testNode.method), + ""); + m.AddSeparator(""); + } + } + + if (!IsBusy()) + { + m.AddItem(multilineSelection ? s_GUIRunSelectedTests : s_GUIRun, + false, + data => RunTests(testFilters), + ""); + + if (EditorPrefs.GetBool("DeveloperMode", false)) + { + m.AddItem(multilineSelection ? s_GUIRunSelectedTests : s_GUIRunUntilFailed, + false, + data => + { + foreach (var filter in testFilters) + { + filter.testRepetitions = int.MaxValue; + } + + RunTests(testFilters); + }, + ""); + + m.AddItem(multilineSelection ? s_GUIRunSelectedTests : s_GUIRun100Times, + false, + data => + { + foreach (var filter in testFilters) + { + filter.testRepetitions = 100; + } + + RunTests(testFilters); + }, + ""); + } + } + else + m.AddDisabledItem(multilineSelection ? s_GUIRunSelectedTests : s_GUIRun, false); + + m.ShowAsContext(); + } + + private TestRunnerFilter[] GetSelectedTestsAsFilter(IEnumerable selectedIDs) + { + var namesToRun = new List(); + var exactNamesToRun = new List(); + var assembliesToRun = new List(); + foreach (var lineId in selectedIDs) + { + var line = m_TestListTree.FindItem(lineId); + if (line is TestTreeViewItem) + { + var testLine = line as TestTreeViewItem; + if (testLine.IsGroupNode && !testLine.FullName.Contains("+")) + { + if (testLine.parent != null && testLine.parent.displayName == "Invisible Root Item") + { + //Root node selected. Use an empty TestRunnerFilter to run every test + return new[] {new TestRunnerFilter()}; + } + + if (testLine.FullName.EndsWith(".dll", StringComparison.OrdinalIgnoreCase)) + assembliesToRun.Add(TestRunnerFilter.AssemblyNameFromPath(testLine.FullName)); + else + namesToRun.Add(string.Format("^{0}$", Regex.Escape(testLine.FullName))); + } + else + exactNamesToRun.Add(testLine.FullName); + } + } + + var filters = new List(); + + if (assembliesToRun.Count > 0) + { + filters.Add(new TestRunnerFilter() + { + assemblyNames = assembliesToRun.ToArray() + }); + } + + if (namesToRun.Count > 0) + { + filters.Add(new TestRunnerFilter() + { + groupNames = namesToRun.ToArray() + }); + } + + if (exactNamesToRun.Count > 0) + { + filters.Add(new TestRunnerFilter() + { + testNames = exactNamesToRun.ToArray() + }); + } + + if (filters.Count == 0) + { + filters.Add(new TestRunnerFilter()); + } + + var categories = m_TestRunnerUIFilter.CategoryFilter.ToArray(); + if (categories.Length > 0) + { + foreach (var filter in filters) + { + filter.categoryNames = categories; + } + } + + return filters.ToArray(); + } + + private TestTreeViewItem GetSelectedTest() + { + foreach (var lineId in m_TestListState.selectedIDs) + { + var line = m_TestListTree.FindItem(lineId); + if (line is TestTreeViewItem) + { + return line as TestTreeViewItem; + } + } + return null; + } + + private void FrameSelection() + { + if (m_TestListTree.HasSelection()) + { + var firstClickedID = m_TestListState.selectedIDs.First() == m_TestListState.lastClickedID ? m_TestListState.selectedIDs.Last() : m_TestListState.selectedIDs.First(); + m_TestListTree.Frame(firstClickedID, true, false); + } + } + + public abstract TestPlatform TestPlatform { get; } + + public void RebuildUIFilter() + { + m_TestRunnerUIFilter.UpdateCounters(newResultList); + if (m_TestRunnerUIFilter.IsFiltering) + { + m_TestListTree.ReloadData(); + } + } + + public void RepaintIfProjectPathChanged() + { + var path = TestListGUIHelper.GetActiveFolderPath(); + if (path != m_PreviousProjectPath) + { + m_PreviousProjectPath = path; + TestRunnerWindow.s_Instance.Repaint(); + } + + EditorApplication.update -= RepaintIfProjectPathChanged; + } + + protected abstract bool IsBusy(); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/TestListGUIBase.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/TestListGUIBase.cs.meta new file mode 100644 index 0000000..f45c6ec --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/GUI/Views/TestListGUIBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b8abb41ceb6f62c45a00197ae59224c1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension.meta new file mode 100644 index 0000000..0b2f3ee --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3f9202a39620f51418046c7754f215f0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes.meta new file mode 100644 index 0000000..585e7ee --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 96c503bf059df984c86eecf572370347 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/AssetPipelineIgnore.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/AssetPipelineIgnore.cs new file mode 100644 index 0000000..d1d579f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/AssetPipelineIgnore.cs @@ -0,0 +1,63 @@ +using System; +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; + +namespace UnityEditor.TestTools +{ + /// + /// Ignore attributes dedicated to Asset Import Pipeline backend version handling. + /// + internal static class AssetPipelineIgnore + { + internal enum AssetPipelineBackend + { + V1, + V2 + } + + /// + /// Ignore the test when running with the legacy Asset Import Pipeline V1 backend. + /// + internal class IgnoreInV1 : AssetPipelineIgnoreAttribute + { + public IgnoreInV1(string ignoreReason) : base(AssetPipelineBackend.V1, ignoreReason) {} + } + + /// + /// Ignore the test when running with the latest Asset Import Pipeline V2 backend. + /// + internal class IgnoreInV2 : AssetPipelineIgnoreAttribute + { + public IgnoreInV2(string ignoreReason) : base(AssetPipelineBackend.V2, ignoreReason) {} + } + + [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)] + internal class AssetPipelineIgnoreAttribute : NUnitAttribute, IApplyToTest + { + readonly string m_IgnoreReason; + readonly AssetPipelineBackend m_IgnoredBackend; + static readonly AssetPipelineBackend k_ActiveBackend = AssetDatabase.IsV2Enabled() + ? AssetPipelineBackend.V2 + : AssetPipelineBackend.V1; + + static string ActiveBackendName = Enum.GetName(typeof(AssetPipelineBackend), k_ActiveBackend); + + public AssetPipelineIgnoreAttribute(AssetPipelineBackend backend, string ignoreReason) + { + m_IgnoredBackend = backend; + m_IgnoreReason = ignoreReason; + } + + public void ApplyToTest(Test test) + { + if (k_ActiveBackend == m_IgnoredBackend) + { + test.RunState = RunState.Ignored; + var skipReason = string.Format("Not supported by asset pipeline {0} backend {1}", ActiveBackendName, m_IgnoreReason); + test.Properties.Add(PropertyNames.SkipReason, skipReason); + } + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/AssetPipelineIgnore.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/AssetPipelineIgnore.cs.meta new file mode 100644 index 0000000..3d9d352 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/AssetPipelineIgnore.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b88caca58e05ee74486d86fb404c48e2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/ITestPlayerBuildModifier.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/ITestPlayerBuildModifier.cs new file mode 100644 index 0000000..99d7515 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/ITestPlayerBuildModifier.cs @@ -0,0 +1,7 @@ +namespace UnityEditor.TestTools +{ + public interface ITestPlayerBuildModifier + { + BuildPlayerOptions ModifyOptions(BuildPlayerOptions playerOptions); + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/ITestPlayerBuildModifier.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/ITestPlayerBuildModifier.cs.meta new file mode 100644 index 0000000..b491f6b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/ITestPlayerBuildModifier.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6d2f47eae5f447748892c46848956d5f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/TestPlayerBuildModifierAttribute.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/TestPlayerBuildModifierAttribute.cs new file mode 100644 index 0000000..bcf7c24 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/TestPlayerBuildModifierAttribute.cs @@ -0,0 +1,25 @@ +using System; + +namespace UnityEditor.TestTools +{ + [AttributeUsage(AttributeTargets.Assembly)] + public class TestPlayerBuildModifierAttribute : Attribute + { + private Type m_Type; + public TestPlayerBuildModifierAttribute(Type type) + { + var interfaceType = typeof(ITestPlayerBuildModifier); + if (!interfaceType.IsAssignableFrom(type)) + { + throw new ArgumentException(string.Format("Type provided to {0} does not implement {1}", this.GetType().Name, interfaceType.Name)); + } + m_Type = type; + } + + internal ITestPlayerBuildModifier ConstructModifier() + { + return Activator.CreateInstance(m_Type) as ITestPlayerBuildModifier; + } + } +} + diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/TestPlayerBuildModifierAttribute.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/TestPlayerBuildModifierAttribute.cs.meta new file mode 100644 index 0000000..6020add --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/Attributes/TestPlayerBuildModifierAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dd57b1176859fc84e93586103d3b5f73 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/TestRunnerStateSerializer.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/TestRunnerStateSerializer.cs new file mode 100644 index 0000000..351e622 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/TestRunnerStateSerializer.cs @@ -0,0 +1,162 @@ +using System; +using System.Reflection; +using System.Text; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.TestRunner.NUnitExtensions.Runner; +using UnityEngine.TestTools.NUnitExtensions; +using UnityEngine.TestTools.Logging; + +namespace UnityEditor.TestTools.TestRunner +{ + [Serializable] + internal class TestRunnerStateSerializer : IStateSerializer + { + private const BindingFlags Flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy; + + [SerializeField] + private HideFlags m_OriginalHideFlags; + + [SerializeField] + private bool m_ShouldRestore; + + [SerializeField] + private string m_TestObjectTypeName; + + [SerializeField] + private ScriptableObject m_TestObject; + + [SerializeField] + private string m_TestObjectTxt; + + [SerializeField] + private long StartTicks; + + [SerializeField] + private double StartTimeOA; + + [SerializeField] + private string output; + + [SerializeField] + private LogMatch[] m_ExpectedLogs; + + public bool ShouldRestore() + { + return m_ShouldRestore; + } + + public void SaveContext() + { + var currentContext = UnityTestExecutionContext.CurrentContext; + + if (currentContext.TestObject != null) + { + m_TestObjectTypeName = currentContext.TestObject.GetType().AssemblyQualifiedName; + m_TestObject = null; + m_TestObjectTxt = null; + if (currentContext.TestObject is ScriptableObject) + { + m_TestObject = currentContext.TestObject as ScriptableObject; + m_OriginalHideFlags = m_TestObject.hideFlags; + m_TestObject.hideFlags |= HideFlags.DontSave; + } + else + { + m_TestObjectTxt = JsonUtility.ToJson(currentContext.TestObject); + } + } + + output = currentContext.CurrentResult.Output; + StartTicks = currentContext.StartTicks; + StartTimeOA = currentContext.StartTime.ToOADate(); + if (LogScope.HasCurrentLogScope()) + { + m_ExpectedLogs = LogScope.Current.ExpectedLogs.ToArray(); + } + + m_ShouldRestore = true; + } + + public void RestoreContext() + { + var currentContext = UnityTestExecutionContext.CurrentContext; + + var outputProp = currentContext.CurrentResult.GetType().BaseType.GetField("_output", Flags); + (outputProp.GetValue(currentContext.CurrentResult) as StringBuilder).Append(output); + + currentContext.StartTicks = StartTicks; + currentContext.StartTime = DateTime.FromOADate(StartTimeOA); + if (LogScope.HasCurrentLogScope()) + { + LogScope.Current.ExpectedLogs = new Queue(m_ExpectedLogs); + } + + m_ShouldRestore = false; + } + + public bool CanRestoreFromScriptableObject(Type requestedType) + { + if (m_TestObject == null) + { + return false; + } + return m_TestObjectTypeName == requestedType.AssemblyQualifiedName; + } + + public ScriptableObject RestoreScriptableObjectInstance() + { + if (m_TestObject == null) + { + Debug.LogError("No object to restore"); + return null; + } + EditorApplication.playModeStateChanged += OnPlayModeStateChanged; + var temp = m_TestObject; + m_TestObject = null; + m_TestObjectTypeName = null; + return temp; + } + + public bool CanRestoreFromJson(Type requestedType) + { + if (string.IsNullOrEmpty(m_TestObjectTxt)) + { + return false; + } + return m_TestObjectTypeName == requestedType.AssemblyQualifiedName; + } + + public void RestoreClassFromJson(ref object instance) + { + if (string.IsNullOrEmpty(m_TestObjectTxt)) + { + Debug.LogWarning("No JSON representation to restore"); + return; + } + JsonUtility.FromJsonOverwrite(m_TestObjectTxt, instance); + m_TestObjectTxt = null; + m_TestObjectTypeName = null; + } + + private void OnPlayModeStateChanged(PlayModeStateChange state) + { + if (m_TestObject == null) + { + EditorApplication.playModeStateChanged -= OnPlayModeStateChanged; + return; + } + + //We set the DontSave flag here because the ScriptableObject would be nulled right before entering EditMode + if (state == PlayModeStateChange.ExitingPlayMode) + { + m_TestObject.hideFlags |= HideFlags.DontSave; + } + else if (state == PlayModeStateChange.EnteredEditMode) + { + m_TestObject.hideFlags = m_OriginalHideFlags; + EditorApplication.playModeStateChanged -= OnPlayModeStateChanged; + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/TestRunnerStateSerializer.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/TestRunnerStateSerializer.cs.meta new file mode 100644 index 0000000..94495c1 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/NUnitExtension/TestRunnerStateSerializer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 124533853216377448d786fd7c725701 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/RequireApiProfileAttribute.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/RequireApiProfileAttribute.cs new file mode 100644 index 0000000..090f218 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/RequireApiProfileAttribute.cs @@ -0,0 +1,32 @@ +using System; +using System.Linq; +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; + +namespace UnityEditor.TestTools +{ + [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)] + internal class RequireApiProfileAttribute : NUnitAttribute, IApplyToTest + { + public ApiCompatibilityLevel[] apiProfiles { get; private set; } + + public RequireApiProfileAttribute(params ApiCompatibilityLevel[] apiProfiles) + { + this.apiProfiles = apiProfiles; + } + + void IApplyToTest.ApplyToTest(Test test) + { + test.Properties.Add(PropertyNames.Category, string.Format("ApiProfile({0})", string.Join(", ", apiProfiles.Select(p => p.ToString()).OrderBy(p => p).ToArray()))); + ApiCompatibilityLevel testProfile = PlayerSettings.GetApiCompatibilityLevel(EditorUserBuildSettings.activeBuildTargetGroup); + + if (!apiProfiles.Contains(testProfile)) + { + string skipReason = "Skipping test as it requires a compatible api profile set: " + string.Join(", ", apiProfiles.Select(p => p.ToString()).ToArray()); + test.RunState = RunState.Skipped; + test.Properties.Add(PropertyNames.SkipReason, skipReason); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/RequireApiProfileAttribute.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/RequireApiProfileAttribute.cs.meta new file mode 100644 index 0000000..736c1f5 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/RequireApiProfileAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a667f6654ad7a9548b8c8e68b51c8895 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/RequirePlatformSupportAttribute.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/RequirePlatformSupportAttribute.cs new file mode 100644 index 0000000..972b19f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/RequirePlatformSupportAttribute.cs @@ -0,0 +1,33 @@ +using System; +using System.Linq; +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; + +namespace UnityEditor.TestTools +{ + [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)] + public class RequirePlatformSupportAttribute : NUnitAttribute, IApplyToTest + { + public RequirePlatformSupportAttribute(params BuildTarget[] platforms) + { + this.platforms = platforms; + } + + public BuildTarget[] platforms { get; private set; } + + void IApplyToTest.ApplyToTest(Test test) + { + test.Properties.Add(PropertyNames.Category, string.Format("RequirePlatformSupport({0})", string.Join(", ", platforms.Select(p => p.ToString()).OrderBy(p => p).ToArray()))); + + if (!platforms.All(p => BuildPipeline.IsBuildTargetSupported(BuildTargetGroup.Unknown, p))) + { + var missingPlatforms = platforms.Where(p => !BuildPipeline.IsBuildTargetSupported(BuildTargetGroup.Unknown, p)).Select(p => p.ToString()).ToArray(); + string skipReason = "Test cannot be run as it requires support for the following platforms to be installed: " + string.Join(", ", missingPlatforms); + + test.RunState = RunState.Skipped; + test.Properties.Add(PropertyNames.SkipReason, skipReason); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/RequirePlatformSupportAttribute.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/RequirePlatformSupportAttribute.cs.meta new file mode 100644 index 0000000..2780461 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/RequirePlatformSupportAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d2146428d3f1ad54eb7326c9a44b3284 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestBuildAssemblyFilter.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestBuildAssemblyFilter.cs new file mode 100644 index 0000000..a8dd54a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestBuildAssemblyFilter.cs @@ -0,0 +1,22 @@ +using System.Linq; +using UnityEditor.Build; + +namespace UnityEditor.TestRunner +{ + // This class is invoked from native, during build + internal class TestBuildAssemblyFilter : IFilterBuildAssemblies + { + private const string nunitAssemblyName = "nunit.framework"; + private const string unityTestRunnerAssemblyName = "UnityEngine.TestRunner"; + + public int callbackOrder { get; } + public string[] OnFilterAssemblies(BuildOptions buildOptions, string[] assemblies) + { + if ((buildOptions & BuildOptions.IncludeTestAssemblies) == BuildOptions.IncludeTestAssemblies || PlayerSettings.playModeTestRunnerEnabled) + { + return assemblies; + } + return assemblies.Where(x => !x.Contains(nunitAssemblyName) && !x.Contains(unityTestRunnerAssemblyName)).ToArray(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestBuildAssemblyFilter.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestBuildAssemblyFilter.cs.meta new file mode 100644 index 0000000..e4df710 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestBuildAssemblyFilter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3411e19edd44cfd46b548b058c3bc36c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers.meta new file mode 100644 index 0000000..fbf047b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d64d92e4f04a13e4b99ea8d48e9e8ae9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/AttributeFinderBase.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/AttributeFinderBase.cs new file mode 100644 index 0000000..c1690a2 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/AttributeFinderBase.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework.Interfaces; +using UnityEngine; +using UnityEngine.TestTools; + +namespace UnityEditor.TestTools.TestRunner +{ + internal abstract class AttributeFinderBase : IAttributeFinder + { + public abstract IEnumerable Search(ITest tests, ITestFilter filter, RuntimePlatform testTargetPlatform); + } + + internal interface IAttributeFinder + { + IEnumerable Search(ITest tests, ITestFilter filter, RuntimePlatform testTargetPlatform); + } + + internal abstract class AttributeFinderBase : AttributeFinderBase where T2 : Attribute + { + private readonly Func m_TypeSelector; + protected AttributeFinderBase(Func typeSelector) + { + m_TypeSelector = typeSelector; + } + + public override IEnumerable Search(ITest tests, ITestFilter filter, RuntimePlatform testTargetPlatform) + { + var selectedTests = new List(); + GetMatchingTests(tests, filter, ref selectedTests, testTargetPlatform); + + var result = new List(); + result.AddRange(GetTypesFromPrebuildAttributes(selectedTests)); + result.AddRange(GetTypesFromInterface(selectedTests, testTargetPlatform)); + + return result.Distinct(); + } + + private static void GetMatchingTests(ITest tests, ITestFilter filter, ref List resultList, RuntimePlatform testTargetPlatform) + { + foreach (var test in tests.Tests) + { + if (IsTestEnabledOnPlatform(test, testTargetPlatform)) + { + if (test.IsSuite) + { + GetMatchingTests(test, filter, ref resultList, testTargetPlatform); + } + else + { + if (filter.Pass(test)) + resultList.Add(test); + } + } + } + } + + private static bool IsTestEnabledOnPlatform(ITest test, RuntimePlatform testTargetPlatform) + { + if (test.Method == null) + { + return true; + } + + var attributesFromMethods = test.Method.GetCustomAttributes(true).Select(attribute => attribute); + var attributesFromTypes = test.Method.TypeInfo.GetCustomAttributes(true).Select(attribute => attribute); + + if (!attributesFromMethods.All(a => a.IsPlatformSupported(testTargetPlatform))) + { + return false; + } + + if (!attributesFromTypes.All(a => a.IsPlatformSupported(testTargetPlatform))) + { + return false; + } + + return true; + } + + private IEnumerable GetTypesFromPrebuildAttributes(IEnumerable tests) + { + var allAssemblies = AppDomain.CurrentDomain.GetAssemblies(); + allAssemblies = allAssemblies.Where(x => x.GetReferencedAssemblies().Any(z => z.Name == "UnityEditor.TestRunner")).ToArray(); + var attributesFromAssemblies = allAssemblies.SelectMany(assembly => assembly.GetCustomAttributes(typeof(T2), true).OfType()); + var attributesFromMethods = tests.SelectMany(t => t.Method.GetCustomAttributes(true).Select(attribute => attribute)); + var attributesFromTypes = tests.SelectMany(t => t.Method.TypeInfo.GetCustomAttributes(true).Select(attribute => attribute)); + + var result = new List(); + result.AddRange(attributesFromAssemblies); + result.AddRange(attributesFromMethods); + result.AddRange(attributesFromTypes); + + return result.Select(m_TypeSelector).Where(type => type != null); + } + + private static IEnumerable GetTypesFromInterface(IEnumerable selectedTests, RuntimePlatform testTargetPlatform) + { + var typesWithInterfaces = selectedTests.Where(t => typeof(T1).IsAssignableFrom(t.Method.TypeInfo.Type) && IsTestEnabledOnPlatform(t, testTargetPlatform)); + return typesWithInterfaces.Select(t => t.Method.TypeInfo.Type); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/AttributeFinderBase.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/AttributeFinderBase.cs.meta new file mode 100644 index 0000000..7348ffb --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/AttributeFinderBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5d4de3d4682a8d641907cc75e4fb950e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/EditModeLauncher.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/EditModeLauncher.cs new file mode 100644 index 0000000..f630de6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/EditModeLauncher.cs @@ -0,0 +1,160 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework.Interfaces; +using UnityEditor.SceneManagement; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine; +using UnityEngine.SceneManagement; +using UnityEngine.TestRunner.Utils; +using UnityEngine.TestTools; +using UnityEngine.TestTools.TestRunner; +using UnityEngine.TestTools.TestRunner.GUI; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class EditModeLauncher : TestLauncherBase + { + public static bool IsRunning; + internal readonly EditModeRunner m_EditModeRunner; + public bool launchedOutsideApi; + + // provided for backward compatibility with Rider UnitTesting prior to Rider package v.1.1.1 + public EditModeLauncher(TestRunnerFilter filter, TestPlatform platform) + { + launchedOutsideApi = true; + var apiFilter = new[] + { + new Filter() + { + testMode = TestMode.EditMode, + testNames = filter.testNames, + categoryNames = filter.categoryNames, + groupNames = filter.groupNames, + assemblyNames = filter.assemblyNames + } + }; + + ScriptableObject.CreateInstance().Execute(new ExecutionSettings(apiFilter)); + } + + public EditModeLauncher(Filter[] filters, TestPlatform platform, bool runSynchronously) + { + m_EditModeRunner = ScriptableObject.CreateInstance(); + m_EditModeRunner.UnityTestAssemblyRunnerFactory = new UnityTestAssemblyRunnerFactory(); + m_EditModeRunner.Init(filters, platform, runSynchronously); + } + + public override void Run() + { + if (launchedOutsideApi) + { + // Do not use the launcher, as it will be relaunched trough the api. See ctor. + return; + } + + IsRunning = true; + + SceneSetup[] previousSceneSetup; + if (!OpenNewScene(out previousSceneSetup)) + return; + + var callback = AddEventHandler(); + callback.previousSceneSetup = previousSceneSetup; + callback.runner = m_EditModeRunner; + AddEventHandler(); + + m_EditModeRunner.Run(); + AddEventHandler(); + AddEventHandler(); + + if (m_EditModeRunner.RunningSynchronously) + m_EditModeRunner.CompleteSynchronously(); + } + + private static bool OpenNewScene(out SceneSetup[] previousSceneSetup) + { + previousSceneSetup = null; + + var sceneCount = SceneManager.sceneCount; + + var scene = SceneManager.GetSceneAt(0); + var isSceneNotPersisted = string.IsNullOrEmpty(scene.path); + + if (sceneCount == 1 && isSceneNotPersisted) + { + EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects, NewSceneMode.Single); + return true; + } + RemoveUntitledScenes(); + + // In case the user chose not to save the dirty scenes we reload them + ReloadUnsavedDirtyScene(); + + previousSceneSetup = EditorSceneManager.GetSceneManagerSetup(); + + scene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Additive); + SceneManager.SetActiveScene(scene); + + return true; + } + + private static void ReloadUnsavedDirtyScene() + { + for (var i = 0; i < SceneManager.sceneCount; i++) + { + var scene = SceneManager.GetSceneAt(i); + var isSceneNotPersisted = string.IsNullOrEmpty(scene.path); + var isSceneDirty = scene.isDirty; + if (isSceneNotPersisted && isSceneDirty) + { + EditorSceneManager.ReloadScene(scene); + } + } + } + + private static void RemoveUntitledScenes() + { + int sceneCount = SceneManager.sceneCount; + + var scenesToClose = new List(); + for (var i = 0; i < sceneCount; i++) + { + var scene = SceneManager.GetSceneAt(i); + var isSceneNotPersisted = string.IsNullOrEmpty(scene.path); + if (isSceneNotPersisted) + { + scenesToClose.Add(scene); + } + } + foreach (Scene scene in scenesToClose) + { + EditorSceneManager.CloseScene(scene, true); + } + } + + public class BackgroundListener : ScriptableObject, ITestRunnerListener + { + public void RunStarted(ITest testsToRun) + { + } + + public void RunFinished(ITestResult testResults) + { + IsRunning = false; + } + + public void TestStarted(ITest test) + { + } + + public void TestFinished(ITestResult result) + { + } + } + + public T AddEventHandler() where T : ScriptableObject, ITestRunnerListener + { + return m_EditModeRunner.AddEventHandler(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/EditModeLauncher.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/EditModeLauncher.cs.meta new file mode 100644 index 0000000..b319430 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/EditModeLauncher.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ac68f5ae37c8957468562b8da42f9984 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/EditModeLauncherContextSettings.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/EditModeLauncherContextSettings.cs new file mode 100644 index 0000000..fd94982 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/EditModeLauncherContextSettings.cs @@ -0,0 +1,31 @@ +using System; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class EditModeLauncherContextSettings : IDisposable + { + private bool m_RunInBackground; + + public EditModeLauncherContextSettings() + { + SetupProjectParameters(); + } + + public void Dispose() + { + CleanupProjectParameters(); + } + + private void SetupProjectParameters() + { + m_RunInBackground = Application.runInBackground; + Application.runInBackground = true; + } + + private void CleanupProjectParameters() + { + Application.runInBackground = m_RunInBackground; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/EditModeLauncherContextSettings.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/EditModeLauncherContextSettings.cs.meta new file mode 100644 index 0000000..280623c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/EditModeLauncherContextSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a582090813554df479fb9ca03e9857d3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup.meta new file mode 100644 index 0000000..9daf884 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ebc4d20cc106cea49b1df1153f0b3b5e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/AndroidPlatformSetup.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/AndroidPlatformSetup.cs new file mode 100644 index 0000000..39fcc60 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/AndroidPlatformSetup.cs @@ -0,0 +1,66 @@ +using System; +using UnityEngine; +using System.Net; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class AndroidPlatformSetup : IPlatformSetup + { + private string m_oldApplicationIdentifier; + private string m_oldDeviceSocketAddress; + [SerializeField] + private bool m_Stripping; + + public void Setup() + { + m_oldApplicationIdentifier = PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.Android); + PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, "com.UnityTestRunner.UnityTestRunner"); + + m_oldDeviceSocketAddress = EditorUserBuildSettings.androidDeviceSocketAddress; + var androidDeviceConnection = Environment.GetEnvironmentVariable("ANDROID_DEVICE_CONNECTION"); + EditorUserBuildSettings.waitForPlayerConnection = true; + if (androidDeviceConnection != null) + { + EditorUserBuildSettings.androidDeviceSocketAddress = androidDeviceConnection; + } + m_Stripping = PlayerSettings.stripEngineCode; + PlayerSettings.stripEngineCode = false; + } + + public void PostBuildAction() + { + PlayerSettings.stripEngineCode = m_Stripping; + } + + public void PostSuccessfulBuildAction() + { + } + + public void PostSuccessfulLaunchAction() + { + var connectionResult = -1; + var maxTryCount = 10; + var tryCount = maxTryCount; + while (tryCount-- > 0 && connectionResult == -1) + { + connectionResult = EditorConnectionInternal.ConnectPlayerProxy(IPAddress.Loopback.ToString(), 34999); + if (EditorUtility.DisplayCancelableProgressBar("Editor Connection", "Connecting to the player", + 1 - ((float)tryCount / maxTryCount))) + { + EditorUtility.ClearProgressBar(); + throw new TestLaunchFailedException(); + } + } + EditorUtility.ClearProgressBar(); + if (connectionResult == -1) + throw new TestLaunchFailedException( + "Timed out trying to connect to the player. Player failed to launch or crashed soon after launching"); + } + + public void CleanUp() + { + EditorUserBuildSettings.androidDeviceSocketAddress = m_oldDeviceSocketAddress; + PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, m_oldApplicationIdentifier); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/AndroidPlatformSetup.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/AndroidPlatformSetup.cs.meta new file mode 100644 index 0000000..6c897f2 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/AndroidPlatformSetup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 961642509dec50b44a293d26240140ec +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/ApplePlatformSetup.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/ApplePlatformSetup.cs new file mode 100644 index 0000000..1d1b074 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/ApplePlatformSetup.cs @@ -0,0 +1,42 @@ +using System; +using System.Diagnostics; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner +{ + [Serializable] + internal class ApplePlatformSetup : IPlatformSetup + { + [SerializeField] + private bool m_Stripping; + + public ApplePlatformSetup(BuildTarget buildTarget) + { + } + + public void Setup() + { + // Camera and fonts are stripped out and app crashes on iOS when test runner is trying to add a scene with... camera and text + m_Stripping = PlayerSettings.stripEngineCode; + PlayerSettings.stripEngineCode = false; + } + + public void PostBuildAction() + { + // Restoring player setting as early as possible + PlayerSettings.stripEngineCode = m_Stripping; + } + + public void PostSuccessfulBuildAction() + { + } + + public void PostSuccessfulLaunchAction() + { + } + + public void CleanUp() + { + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/ApplePlatformSetup.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/ApplePlatformSetup.cs.meta new file mode 100644 index 0000000..1b3a7e0 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/ApplePlatformSetup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f6c189a159d3bde4c964cee562e508ea +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/IPlatformSetup.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/IPlatformSetup.cs new file mode 100644 index 0000000..59df2f2 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/IPlatformSetup.cs @@ -0,0 +1,11 @@ +namespace UnityEditor.TestTools.TestRunner +{ + internal interface IPlatformSetup + { + void Setup(); + void PostBuildAction(); + void PostSuccessfulBuildAction(); + void PostSuccessfulLaunchAction(); + void CleanUp(); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/IPlatformSetup.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/IPlatformSetup.cs.meta new file mode 100644 index 0000000..536968c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/IPlatformSetup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9d614808f9add8a4f8e4860db2c7af0d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/LuminPlatformSetup.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/LuminPlatformSetup.cs new file mode 100644 index 0000000..cb965c8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/LuminPlatformSetup.cs @@ -0,0 +1,50 @@ +using System; +using System.Threading; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class LuminPlatformSetup : IPlatformSetup + { + private const string kDeviceAddress = "127.0.0.1"; + private const int kDevicePort = 55000; + + public void Setup() + { + } + + public void PostBuildAction() + { + } + + public void PostSuccessfulBuildAction() + { + } + + public void PostSuccessfulLaunchAction() + { + var connectionResult = -1; + var maxTryCount = 100; + var tryCount = maxTryCount; + while (tryCount-- > 0 && connectionResult == -1) + { + Thread.Sleep(1000); + connectionResult = EditorConnectionInternal.ConnectPlayerProxy(kDeviceAddress, kDevicePort); + if (EditorUtility.DisplayCancelableProgressBar("Editor Connection", "Connecting to the player", + 1 - ((float)tryCount / maxTryCount))) + { + EditorUtility.ClearProgressBar(); + throw new TestLaunchFailedException(); + } + } + EditorUtility.ClearProgressBar(); + if (connectionResult == -1) + throw new TestLaunchFailedException( + "Timed out trying to connect to the player. Player failed to launch or crashed soon after launching"); + } + + public void CleanUp() + { + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/LuminPlatformSetup.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/LuminPlatformSetup.cs.meta new file mode 100644 index 0000000..0ac0d99 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/LuminPlatformSetup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c38ae0585d6a55042a2d678330689685 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/PlatformSpecificSetup.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/PlatformSpecificSetup.cs new file mode 100644 index 0000000..30379eb --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/PlatformSpecificSetup.cs @@ -0,0 +1,117 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner +{ + [Serializable] + internal class PlatformSpecificSetup + { + [SerializeField] + private ApplePlatformSetup m_AppleiOSPlatformSetup = new ApplePlatformSetup(BuildTarget.iOS); + [SerializeField] + private ApplePlatformSetup m_AppleTvOSPlatformSetup = new ApplePlatformSetup(BuildTarget.tvOS); + [SerializeField] + private XboxOnePlatformSetup m_XboxOnePlatformSetup = new XboxOnePlatformSetup(); + [SerializeField] + private AndroidPlatformSetup m_AndroidPlatformSetup = new AndroidPlatformSetup(); + [SerializeField] + private SwitchPlatformSetup m_SwitchPlatformSetup = new SwitchPlatformSetup(); + + [SerializeField] + private UwpPlatformSetup m_UwpPlatformSetup = new UwpPlatformSetup(); + + [SerializeField] + private LuminPlatformSetup m_LuminPlatformSetup = new LuminPlatformSetup(); + + + private IDictionary m_SetupTypes; + + [SerializeField] + private BuildTarget m_Target; + + public PlatformSpecificSetup() + { + } + + public PlatformSpecificSetup(BuildTarget target) + { + m_Target = target; + } + + public void Setup() + { + var dictionary = GetSetup(); + + if (!dictionary.ContainsKey(m_Target)) + { + return; + } + + dictionary[m_Target].Setup(); + } + + public void PostBuildAction() + { + var dictionary = GetSetup(); + + if (!dictionary.ContainsKey(m_Target)) + { + return; + } + + dictionary[m_Target].PostBuildAction(); + } + + public void PostSuccessfulBuildAction() + { + var dictionary = GetSetup(); + + if (!dictionary.ContainsKey(m_Target)) + { + return; + } + + dictionary[m_Target].PostSuccessfulBuildAction(); + } + + public void PostSuccessfulLaunchAction() + { + var dictionary = GetSetup(); + + if (!dictionary.ContainsKey(m_Target)) + { + return; + } + + dictionary[m_Target].PostSuccessfulLaunchAction(); + } + + public void CleanUp() + { + var dictionary = GetSetup(); + + if (!dictionary.ContainsKey(m_Target)) + { + return; + } + + dictionary[m_Target].CleanUp(); + } + + private IDictionary GetSetup() + { + m_SetupTypes = new Dictionary() + { + {BuildTarget.iOS, m_AppleiOSPlatformSetup}, + {BuildTarget.tvOS, m_AppleTvOSPlatformSetup}, + {BuildTarget.XboxOne, m_XboxOnePlatformSetup}, + {BuildTarget.Android, m_AndroidPlatformSetup}, + {BuildTarget.WSAPlayer, m_UwpPlatformSetup}, + {BuildTarget.Lumin, m_LuminPlatformSetup}, + {BuildTarget.Switch, m_SwitchPlatformSetup} + }; + return m_SetupTypes; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/PlatformSpecificSetup.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/PlatformSpecificSetup.cs.meta new file mode 100644 index 0000000..a84f775 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/PlatformSpecificSetup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6cccd50ebf7384242bda4d7bcb282ebf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/SwitchPlatformSetup.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/SwitchPlatformSetup.cs new file mode 100644 index 0000000..e63c850 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/SwitchPlatformSetup.cs @@ -0,0 +1,41 @@ +namespace UnityEditor.TestTools.TestRunner +{ + internal class SwitchPlatformSetup : IPlatformSetup + { + public void Setup() + { + EditorUserBuildSettings.switchCreateRomFile = true; + EditorUserBuildSettings.switchNVNGraphicsDebugger = false; +#if UNITY_2020_1_OR_NEWER + EditorUserBuildSettings.switchNVNDrawValidation_Heavy = true; // catches more graphics errors +#else + EditorUserBuildSettings.switchNVNDrawValidation = true; // catches more graphics errors +#endif + EditorUserBuildSettings.development = true; + EditorUserBuildSettings.switchRedirectWritesToHostMount = true; + + // We can use these when more debugging is required: + //EditorUserBuildSettings.switchNVNDrawValidation = false; // cannot be used with shader debug + //EditorUserBuildSettings.switchNVNGraphicsDebugger = true; + //EditorUserBuildSettings.switchNVNShaderDebugging = true; + //EditorUserBuildSettings.switchCreateSolutionFile = true; // for shorter iteration time + //EditorUserBuildSettings.allowDebugging = true; // managed debugger can be attached + } + + public void PostBuildAction() + { + } + + public void PostSuccessfulBuildAction() + { + } + + public void PostSuccessfulLaunchAction() + { + } + + public void CleanUp() + { + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/SwitchPlatformSetup.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/SwitchPlatformSetup.cs.meta new file mode 100644 index 0000000..0ecf426 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/SwitchPlatformSetup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: adf7bea9401c1834380d55601add6cfb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/UwpPlatformSetup.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/UwpPlatformSetup.cs new file mode 100644 index 0000000..87ea5e0 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/UwpPlatformSetup.cs @@ -0,0 +1,52 @@ +using System; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class UwpPlatformSetup : IPlatformSetup + { + private const string k_SettingsBuildConfiguration = "BuildConfiguration"; + private bool m_InternetClientServer; + private bool m_PrivateNetworkClientServer; + + public void Setup() + { + m_InternetClientServer = PlayerSettings.WSA.GetCapability(PlayerSettings.WSACapability.InternetClientServer); + m_PrivateNetworkClientServer = PlayerSettings.WSA.GetCapability(PlayerSettings.WSACapability.PrivateNetworkClientServer); + PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.InternetClientServer, true); + PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.PrivateNetworkClientServer, true); + + // This setting is initialized only when Window Store App is selected from the Build Settings window, and + // is typically an empty strings when running tests via UTR on the command-line. + bool wsaSettingNotInitialized = string.IsNullOrEmpty(EditorUserBuildSettings.wsaArchitecture); + + // If WSA build settings aren't fully initialized or running from a build machine, specify a default build configuration. + // Otherwise we can use the existing configuration specified by the user in Build Settings. + if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("UNITY_THISISABUILDMACHINE")) || wsaSettingNotInitialized) + { + EditorUserBuildSettings.wsaSubtarget = WSASubtarget.PC; + EditorUserBuildSettings.wsaArchitecture = "x64"; + EditorUserBuildSettings.SetPlatformSettings(BuildPipeline.GetBuildTargetName(BuildTarget.WSAPlayer), k_SettingsBuildConfiguration, WSABuildType.Debug.ToString()); + EditorUserBuildSettings.wsaUWPBuildType = WSAUWPBuildType.ExecutableOnly; + PlayerSettings.SetIl2CppCompilerConfiguration(BuildTargetGroup.WSA, Il2CppCompilerConfiguration.Debug); + } + } + + public void PostBuildAction() + { + } + + public void PostSuccessfulBuildAction() + { + } + + public void PostSuccessfulLaunchAction() + { + } + + public void CleanUp() + { + PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.InternetClientServer, m_InternetClientServer); + PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.PrivateNetworkClientServer, m_PrivateNetworkClientServer); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/UwpPlatformSetup.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/UwpPlatformSetup.cs.meta new file mode 100644 index 0000000..34f040d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/UwpPlatformSetup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 667c6ad86a0b7a548aaa5c287f2c2861 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/XboxOnePlatformSetup.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/XboxOnePlatformSetup.cs new file mode 100644 index 0000000..0eb1e19 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/XboxOnePlatformSetup.cs @@ -0,0 +1,47 @@ +namespace UnityEditor.TestTools.TestRunner +{ + internal class XboxOnePlatformSetup : IPlatformSetup + { + private XboxOneDeployMethod oldXboxOneDeployMethod; + private XboxOneDeployDrive oldXboxOneDeployDrive; + private string oldXboxOneAdditionalDebugPorts; + + public void Setup() + { + oldXboxOneDeployMethod = EditorUserBuildSettings.xboxOneDeployMethod; + oldXboxOneDeployDrive = EditorUserBuildSettings.xboxOneDeployDrive; + oldXboxOneAdditionalDebugPorts = EditorUserBuildSettings.xboxOneAdditionalDebugPorts; + + EditorUserBuildSettings.xboxOneDeployMethod = XboxOneDeployMethod.Package; + EditorUserBuildSettings.xboxOneDeployDrive = XboxOneDeployDrive.Default; + + // This causes the XboxOne post processing systems to open this port in your package manifest. + // In addition it will open the ephemeral range for debug connections as well. + // Failure to do this will cause connection problems. + EditorUserBuildSettings.xboxOneAdditionalDebugPorts = "34999"; + } + + public void PostBuildAction() + { + } + + public void PostSuccessfulBuildAction() + { + } + + public void PostSuccessfulLaunchAction() + { + } + + public void CleanUp() + { + EditorUserBuildSettings.xboxOneDeployMethod = oldXboxOneDeployMethod; + EditorUserBuildSettings.xboxOneDeployDrive = oldXboxOneDeployDrive; + + // This causes the XboxOne post processing systems to open this port in your package manifest. + // In addition it will open the ephemeral range for debug connections as well. + // Failure to do this will cause connection problems. + EditorUserBuildSettings.xboxOneAdditionalDebugPorts = oldXboxOneAdditionalDebugPorts; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/XboxOnePlatformSetup.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/XboxOnePlatformSetup.cs.meta new file mode 100644 index 0000000..22b811c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlatformSetup/XboxOnePlatformSetup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: aed7ab02155e43341a2dbcb7bc17c160 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncher.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncher.cs new file mode 100644 index 0000000..337414b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncher.cs @@ -0,0 +1,216 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; +using NUnit.Framework.Internal.Filters; +using UnityEditor; +using UnityEditor.TestRunner.TestLaunchers; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine; +using UnityEngine.SceneManagement; +using UnityEngine.TestRunner.Utils; +using UnityEngine.TestTools.TestRunner; +using UnityEngine.TestTools.TestRunner.Callbacks; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class TestLaunchFailedException : Exception + { + public TestLaunchFailedException() {} + public TestLaunchFailedException(string message) : base(message) {} + } + + [Serializable] + internal class PlayerLauncher : RuntimeTestLauncherBase + { + private readonly PlaymodeTestsControllerSettings m_Settings; + private readonly BuildTarget m_TargetPlatform; + private ITestRunSettings m_OverloadTestRunSettings; + private string m_SceneName; + private int m_HeartbeatTimeout; + + public PlayerLauncher(PlaymodeTestsControllerSettings settings, BuildTarget? targetPlatform, ITestRunSettings overloadTestRunSettings, int heartbeatTimeout) + { + m_Settings = settings; + m_TargetPlatform = targetPlatform ?? EditorUserBuildSettings.activeBuildTarget; + m_OverloadTestRunSettings = overloadTestRunSettings; + m_HeartbeatTimeout = heartbeatTimeout; + } + + protected override RuntimePlatform? TestTargetPlatform + { + get { return BuildTargetConverter.TryConvertToRuntimePlatform(m_TargetPlatform); } + } + + public override void Run() + { + var editorConnectionTestCollector = RemoteTestRunController.instance; + editorConnectionTestCollector.hideFlags = HideFlags.HideAndDontSave; + editorConnectionTestCollector.Init(m_TargetPlatform, m_HeartbeatTimeout); + + var remotePlayerLogController = RemotePlayerLogController.instance; + remotePlayerLogController.hideFlags = HideFlags.HideAndDontSave; + + using (var settings = new PlayerLauncherContextSettings(m_OverloadTestRunSettings)) + { + m_SceneName = CreateSceneName(); + var scene = PrepareScene(m_SceneName); + string scenePath = scene.path; + + var filter = m_Settings.BuildNUnitFilter(); + var runner = LoadTests(filter); + var exceptionThrown = ExecutePreBuildSetupMethods(runner.LoadedTest, filter); + if (exceptionThrown) + { + ReopenOriginalScene(m_Settings.originalScene); + AssetDatabase.DeleteAsset(m_SceneName); + CallbacksDelegator.instance.RunFailed("Run Failed: One or more errors in a prebuild setup. See the editor log for details."); + return; + } + + var playerBuildOptions = GetBuildOptions(scenePath); + + var success = BuildAndRunPlayer(playerBuildOptions); + editorConnectionTestCollector.PostBuildAction(); + ExecutePostBuildCleanupMethods(runner.LoadedTest, filter); + + ReopenOriginalScene(m_Settings.originalScene); + AssetDatabase.DeleteAsset(m_SceneName); + + if (!success) + { + ScriptableObject.DestroyImmediate(editorConnectionTestCollector); + Debug.LogError("Player build failed"); + throw new TestLaunchFailedException("Player build failed"); + } + + editorConnectionTestCollector.PostSuccessfulBuildAction(); + if((playerBuildOptions.BuildPlayerOptions.options & BuildOptions.AutoRunPlayer) != 0) + editorConnectionTestCollector.PostSuccessfulLaunchAction(); + } + } + + public Scene PrepareScene(string sceneName) + { + var scene = CreateBootstrapScene(sceneName, runner => + { + runner.AddEventHandlerMonoBehaviour(); + runner.settings = m_Settings; + runner.AddEventHandlerMonoBehaviour(); + runner.AddEventHandlerScriptableObject(); + }); + return scene; + } + + private static bool BuildAndRunPlayer(PlayerLauncherBuildOptions buildOptions) + { + Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, "Building player with following options:\n{0}", buildOptions); + + + // Android has to be in listen mode to establish player connection + if (buildOptions.BuildPlayerOptions.target == BuildTarget.Android) + { + buildOptions.BuildPlayerOptions.options &= ~BuildOptions.ConnectToHost; + } + + // For now, so does Lumin + if (buildOptions.BuildPlayerOptions.target == BuildTarget.Lumin) + { + buildOptions.BuildPlayerOptions.options &= ~BuildOptions.ConnectToHost; + } + + var result = BuildPipeline.BuildPlayer(buildOptions.BuildPlayerOptions); + if (result.summary.result != Build.Reporting.BuildResult.Succeeded) + Debug.LogError(result.SummarizeErrors()); + + return result.summary.result == Build.Reporting.BuildResult.Succeeded; + } + + private PlayerLauncherBuildOptions GetBuildOptions(string scenePath) + { + var buildOptions = new BuildPlayerOptions(); + var reduceBuildLocationPathLength = false; + + //Some platforms hit MAX_PATH limits during the build process, in these cases minimize the path length + if ((m_TargetPlatform == BuildTarget.WSAPlayer) || (m_TargetPlatform == BuildTarget.XboxOne)) + { + reduceBuildLocationPathLength = true; + } + + var scenes = new List() { scenePath }; + scenes.AddRange(EditorBuildSettings.scenes.Select(x => x.path)); + buildOptions.scenes = scenes.ToArray(); + + buildOptions.options |= BuildOptions.Development | BuildOptions.ConnectToHost | BuildOptions.IncludeTestAssemblies | BuildOptions.StrictMode; + buildOptions.target = m_TargetPlatform; + + if (EditorUserBuildSettings.waitForPlayerConnection) + buildOptions.options |= BuildOptions.WaitForPlayerConnection; + + if (EditorUserBuildSettings.allowDebugging) + buildOptions.options |= BuildOptions.AllowDebugging; + + if (EditorUserBuildSettings.installInBuildFolder) + buildOptions.options |= BuildOptions.InstallInBuildFolder; + else + buildOptions.options |= BuildOptions.AutoRunPlayer; + + var buildTargetGroup = EditorUserBuildSettings.activeBuildTargetGroup; + + //Check if Lz4 is supported for the current buildtargetgroup and enable it if need be + if (PostprocessBuildPlayer.SupportsLz4Compression(buildTargetGroup, m_TargetPlatform)) + { + if (EditorUserBuildSettings.GetCompressionType(buildTargetGroup) == Compression.Lz4) + buildOptions.options |= BuildOptions.CompressWithLz4; + else if (EditorUserBuildSettings.GetCompressionType(buildTargetGroup) == Compression.Lz4HC) + buildOptions.options |= BuildOptions.CompressWithLz4HC; + } + + var uniqueTempPathInProject = FileUtil.GetUniqueTempPathInProject(); + var playerDirectoryName = reduceBuildLocationPathLength ? "PwT" : "PlayerWithTests"; + + if (reduceBuildLocationPathLength) + { + uniqueTempPathInProject = Path.GetTempFileName(); + File.Delete(uniqueTempPathInProject); + Directory.CreateDirectory(uniqueTempPathInProject); + } + var tempPath = Path.GetFullPath(uniqueTempPathInProject); + var buildLocation = Path.Combine(tempPath, playerDirectoryName); + + // iOS builds create a folder with Xcode project instead of an executable, therefore no executable name is added + if (m_TargetPlatform == BuildTarget.iOS) + { + buildOptions.locationPathName = buildLocation; + } + else + { + string extensionForBuildTarget = PostprocessBuildPlayer.GetExtensionForBuildTarget(buildTargetGroup, buildOptions.target, buildOptions.options); + var playerExecutableName = "PlayerWithTests"; + playerExecutableName += string.Format(".{0}", extensionForBuildTarget); + buildOptions.locationPathName = Path.Combine(buildLocation, playerExecutableName); + } + + return new PlayerLauncherBuildOptions + { + BuildPlayerOptions = ModifyBuildOptions(buildOptions), + PlayerDirectory = buildLocation, + }; + } + + private BuildPlayerOptions ModifyBuildOptions(BuildPlayerOptions buildOptions) + { + var allAssemblies = AppDomain.CurrentDomain.GetAssemblies().Where(x => x.GetReferencedAssemblies().Any(z => z.Name == "UnityEngine.TestRunner")).ToArray(); + var attributes = allAssemblies.SelectMany(assembly => assembly.GetCustomAttributes(typeof(TestPlayerBuildModifierAttribute), true).OfType()).ToArray(); + var modifiers = attributes.Select(attribute => attribute.ConstructModifier()).ToArray(); + + foreach (var modifier in modifiers) + { + buildOptions = modifier.ModifyOptions(buildOptions); + } + + return buildOptions; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncher.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncher.cs.meta new file mode 100644 index 0000000..17eece2 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncher.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d973fc1524e4d724081553934c55958c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncherBuildOptions.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncherBuildOptions.cs new file mode 100644 index 0000000..589796c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncherBuildOptions.cs @@ -0,0 +1,23 @@ +using System.Text; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class PlayerLauncherBuildOptions + { + public BuildPlayerOptions BuildPlayerOptions; + public string PlayerDirectory; + + public override string ToString() + { + var str = new StringBuilder(); + str.AppendLine("locationPathName = " + BuildPlayerOptions.locationPathName); + str.AppendLine("target = " + BuildPlayerOptions.target); + str.AppendLine("scenes = " + string.Join(", ", BuildPlayerOptions.scenes)); + str.AppendLine("assetBundleManifestPath = " + BuildPlayerOptions.assetBundleManifestPath); + str.AppendLine("options.Development = " + ((BuildPlayerOptions.options & BuildOptions.Development) != 0)); + str.AppendLine("options.AutoRunPlayer = " + ((BuildPlayerOptions.options & BuildOptions.AutoRunPlayer) != 0)); + str.AppendLine("options.ForceEnableAssertions = " + ((BuildPlayerOptions.options & BuildOptions.ForceEnableAssertions) != 0)); + return str.ToString(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncherBuildOptions.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncherBuildOptions.cs.meta new file mode 100644 index 0000000..5d6f277 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncherBuildOptions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2a0bd678385f98e4d8eabdfc07d62b4f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncherContextSettings.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncherContextSettings.cs new file mode 100644 index 0000000..329bcd6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncherContextSettings.cs @@ -0,0 +1,112 @@ +using System; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class PlayerLauncherContextSettings : IDisposable + { + private ITestRunSettings m_OverloadSettings; + + private EditorBuildSettingsScene[] m_EditorBuildSettings; +#pragma warning disable 618 + private ResolutionDialogSetting m_DisplayResolutionDialog; +#pragma warning restore 618 + private bool m_RunInBackground; + private FullScreenMode m_FullScreenMode; + private bool m_ResizableWindow; + private bool m_ShowUnitySplashScreen; + private string m_OldproductName; + private string m_OldAotOptions; +#pragma warning disable 618 + private Lightmapping.GIWorkflowMode m_OldLightmapping; +#pragma warning restore 618 + private bool m_explicitNullChecks; + + private bool m_Disposed; + + public PlayerLauncherContextSettings(ITestRunSettings overloadSettings) + { + m_OverloadSettings = overloadSettings; + SetupProjectParameters(); + + if (overloadSettings != null) + { + overloadSettings.Apply(); + } + } + + public void Dispose() + { + if (!m_Disposed) + { + CleanupProjectParameters(); + if (m_OverloadSettings != null) + { + m_OverloadSettings.Dispose(); + } + + m_Disposed = true; + } + } + + private void SetupProjectParameters() + { + EditorApplication.LockReloadAssemblies(); + + m_EditorBuildSettings = EditorBuildSettings.scenes; + +#pragma warning disable 618 + m_DisplayResolutionDialog = PlayerSettings.displayResolutionDialog; + PlayerSettings.displayResolutionDialog = ResolutionDialogSetting.Disabled; +#pragma warning restore 618 + + m_RunInBackground = PlayerSettings.runInBackground; + PlayerSettings.runInBackground = true; + + m_FullScreenMode = PlayerSettings.fullScreenMode; + PlayerSettings.fullScreenMode = FullScreenMode.Windowed; + + m_OldAotOptions = PlayerSettings.aotOptions; + PlayerSettings.aotOptions = "nimt-trampolines=1024"; + + m_ResizableWindow = PlayerSettings.resizableWindow; + PlayerSettings.resizableWindow = true; + + m_ShowUnitySplashScreen = PlayerSettings.SplashScreen.show; + PlayerSettings.SplashScreen.show = false; + + m_OldproductName = PlayerSettings.productName; + PlayerSettings.productName = "UnityTestFramework"; + +#pragma warning disable 618 + m_OldLightmapping = Lightmapping.giWorkflowMode; + Lightmapping.giWorkflowMode = Lightmapping.GIWorkflowMode.OnDemand; +#pragma warning restore 618 + + m_explicitNullChecks = EditorUserBuildSettings.explicitNullChecks; + EditorUserBuildSettings.explicitNullChecks = true; + } + + private void CleanupProjectParameters() + { + EditorBuildSettings.scenes = m_EditorBuildSettings; + + PlayerSettings.fullScreenMode = m_FullScreenMode; + PlayerSettings.runInBackground = m_RunInBackground; +#pragma warning disable 618 + PlayerSettings.displayResolutionDialog = m_DisplayResolutionDialog; +#pragma warning restore 618 + PlayerSettings.resizableWindow = m_ResizableWindow; + PlayerSettings.SplashScreen.show = m_ShowUnitySplashScreen; + PlayerSettings.productName = m_OldproductName; + PlayerSettings.aotOptions = m_OldAotOptions; +#pragma warning disable 618 + Lightmapping.giWorkflowMode = m_OldLightmapping; +#pragma warning restore 618 + EditorUserBuildSettings.explicitNullChecks = m_explicitNullChecks; + + EditorApplication.UnlockReloadAssemblies(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncherContextSettings.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncherContextSettings.cs.meta new file mode 100644 index 0000000..81671ce --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlayerLauncherContextSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6965880f76f40194593cb53a88f74005 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlaymodeLauncher.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlaymodeLauncher.cs new file mode 100644 index 0000000..a5838d1 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlaymodeLauncher.cs @@ -0,0 +1,133 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal.Filters; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine; +using UnityEngine.SceneManagement; +using UnityEngine.TestRunner.Utils; +using UnityEngine.TestTools.TestRunner; +using UnityEngine.TestTools.TestRunner.Callbacks; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class PlaymodeLauncher : RuntimeTestLauncherBase + { + public static bool IsRunning; + private Scene m_Scene; + private bool m_IsTestSetupPerformed; + private readonly PlaymodeTestsControllerSettings m_Settings; + private ITestFilter testFilter; + + [SerializeField] + private List m_EventHandlers = new List(); + + public PlaymodeLauncher(PlaymodeTestsControllerSettings settings) + { + m_Settings = settings; + } + + public override void Run() + { + IsRunning = true; + ConsoleWindow.SetConsoleErrorPause(false); + Application.runInBackground = true; + + var sceneName = CreateSceneName(); + m_Scene = CreateBootstrapScene(sceneName, runner => + { + runner.AddEventHandlerMonoBehaviour(); + runner.AddEventHandlerScriptableObject(); + runner.AddEventHandlerScriptableObject(); + runner.AddEventHandlerScriptableObject(); + + foreach (var eventHandler in m_EventHandlers) + { + var obj = ScriptableObject.CreateInstance(eventHandler); + runner.AddEventHandlerScriptableObject(obj as ITestRunnerListener); + } + + runner.settings = m_Settings; + }); + + if (m_Settings.sceneBased) + { + var newListOfScenes = + new List {new EditorBuildSettingsScene(sceneName, true)}; + newListOfScenes.AddRange(EditorBuildSettings.scenes); + EditorBuildSettings.scenes = newListOfScenes.ToArray(); + } + + EditorApplication.update += UpdateCallback; + } + + public void UpdateCallback() + { + if (m_IsTestSetupPerformed) + { + if (m_Scene.IsValid()) + SceneManager.SetActiveScene(m_Scene); + EditorApplication.update -= UpdateCallback; + EditorApplication.isPlaying = true; + } + else + { + testFilter = m_Settings.BuildNUnitFilter(); + var runner = LoadTests(testFilter); + + var exceptionThrown = ExecutePreBuildSetupMethods(runner.LoadedTest, testFilter); + if (exceptionThrown) + { + EditorApplication.update -= UpdateCallback; + IsRunning = false; + var controller = PlaymodeTestsController.GetController(); + ReopenOriginalScene(controller); + AssetDatabase.DeleteAsset(controller.settings.bootstrapScene); + CallbacksDelegator.instance.RunFailed("Run Failed: One or more errors in a prebuild setup. See the editor log for details."); + return; + } + m_IsTestSetupPerformed = true; + } + } + + [InitializeOnLoad] + public class BackgroundWatcher + { + static BackgroundWatcher() + { + EditorApplication.playModeStateChanged += OnPlayModeStateChanged; + } + + private static void OnPlayModeStateChanged(PlayModeStateChange state) + { + if (!PlaymodeTestsController.IsControllerOnScene()) + return; + var runner = PlaymodeTestsController.GetController(); + if (runner == null) + return; + if (state == PlayModeStateChange.ExitingPlayMode) + { + AssetDatabase.DeleteAsset(runner.settings.bootstrapScene); + ExecutePostBuildCleanupMethods(runner.m_Runner.LoadedTest, runner.settings.BuildNUnitFilter(), Application.platform); + IsRunning = false; + } + else if (state == PlayModeStateChange.EnteredEditMode) + { + //reopen the original scene once we exit playmode + ReopenOriginalScene(runner); + } + } + } + + protected static void ReopenOriginalScene(PlaymodeTestsController runner) + { + ReopenOriginalScene(runner.settings.originalScene); + } + + public void AddEventHandler() where T : ScriptableObject, ITestRunnerListener + { + m_EventHandlers.Add(typeof(T)); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlaymodeLauncher.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlaymodeLauncher.cs.meta new file mode 100644 index 0000000..de1999d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PlaymodeLauncher.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d3217d58bbd1d2b4aaee933e2e8b9195 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PostbuildCleanupAttributeFinder.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PostbuildCleanupAttributeFinder.cs new file mode 100644 index 0000000..bad0e4a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PostbuildCleanupAttributeFinder.cs @@ -0,0 +1,9 @@ +using UnityEngine.TestTools; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class PostbuildCleanupAttributeFinder : AttributeFinderBase + { + public PostbuildCleanupAttributeFinder() : base(attribute => attribute.TargetClass) {} + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PostbuildCleanupAttributeFinder.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PostbuildCleanupAttributeFinder.cs.meta new file mode 100644 index 0000000..8d68b8c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PostbuildCleanupAttributeFinder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2c2dfcbbb77359547bcaa7cdabd47ebb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PrebuildSetupAttributeFinder.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PrebuildSetupAttributeFinder.cs new file mode 100644 index 0000000..cd4ada8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PrebuildSetupAttributeFinder.cs @@ -0,0 +1,9 @@ +using UnityEngine.TestTools; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class PrebuildSetupAttributeFinder : AttributeFinderBase + { + public PrebuildSetupAttributeFinder() : base((attribute) => attribute.TargetClass) {} + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PrebuildSetupAttributeFinder.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PrebuildSetupAttributeFinder.cs.meta new file mode 100644 index 0000000..45adbb9 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/PrebuildSetupAttributeFinder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3c4ccfb0896bcf44da13e152b267aa49 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemotePlayerLogController.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemotePlayerLogController.cs new file mode 100644 index 0000000..ebdf71e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemotePlayerLogController.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using UnityEditor.DeploymentTargets; +using UnityEditor.TestTools.TestRunner.CommandLineTest; +using UnityEngine; + +namespace UnityEditor.TestRunner.TestLaunchers +{ + [Serializable] + internal class RemotePlayerLogController : ScriptableSingleton + { + private List m_LogWriters; + + private Dictionary m_Loggers; + + private string m_DeviceLogsDirectory; + + public void SetBuildTarget(BuildTarget buildTarget) + { + m_Loggers = GetDeploymentTargetLoggers(buildTarget); + } + + public void SetLogsDirectory(string dir) + { + m_DeviceLogsDirectory = dir; + } + + public void StartLogWriters() + { + if (m_DeviceLogsDirectory == null || m_Loggers == null) + return; + + m_LogWriters = new List(); + + foreach (var logger in m_Loggers) + { + m_LogWriters.Add(new LogWriter(m_DeviceLogsDirectory, logger.Key, logger.Value)); + logger.Value.Start(); + } + } + + public void StopLogWriters() + { + if (m_LogWriters == null) + return; + + foreach (var logWriter in m_LogWriters) + { + logWriter.Stop(); + } + } + + private Dictionary GetDeploymentTargetLoggers(BuildTarget buildTarget) + { + DeploymentTargetManager deploymentTargetManager; + + try + { + deploymentTargetManager = DeploymentTargetManager.CreateInstance(EditorUserBuildSettings.activeBuildTargetGroup, buildTarget); + } + catch (NotSupportedException ex) + { + Debug.Log(ex.Message); + Debug.Log("Deployment target logger not initialised"); + return null; + } + + var targets = deploymentTargetManager.GetKnownTargets(); + var loggers = new Dictionary(); + + foreach (var target in targets) + { + if (target.status != DeploymentTargetStatus.Ready) continue; + + var logger = deploymentTargetManager.GetTargetLogger(target.id); + logger.Clear(); + loggers.Add(target.id, logger); + } + + return loggers; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemotePlayerLogController.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemotePlayerLogController.cs.meta new file mode 100644 index 0000000..09b5310 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemotePlayerLogController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: edd2a1fe1acbbde43aad39862bb3f4a8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemotePlayerTestController.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemotePlayerTestController.cs new file mode 100644 index 0000000..87871ee --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemotePlayerTestController.cs @@ -0,0 +1,110 @@ +using System; +using UnityEditor.Networking.PlayerConnection; +using UnityEditor.TestTools.TestRunner; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEditor.TestTools.TestRunner.UnityTestProtocol; +using UnityEngine; +using UnityEngine.Networking.PlayerConnection; +using UnityEngine.TestRunner.TestLaunchers; + +namespace UnityEditor.TestRunner.TestLaunchers +{ + [Serializable] + internal class RemoteTestRunController : ScriptableSingleton + { + internal const int k_HeartbeatTimeout = 60 * 10; + + [SerializeField] + private RemoteTestResultReciever m_RemoteTestResultReciever; + + [SerializeField] + private PlatformSpecificSetup m_PlatformSpecificSetup; + + [SerializeField] + private bool m_RegisteredConnectionCallbacks; + + [SerializeField] + private int m_HearbeatTimeOut; + + private IDelayedCallback m_TimeoutCallback; + + public void Init(BuildTarget buildTarget, int heartbeatTimeout) + { + m_HearbeatTimeOut = heartbeatTimeout; + m_PlatformSpecificSetup = new PlatformSpecificSetup(buildTarget); + m_PlatformSpecificSetup.Setup(); + m_RemoteTestResultReciever = new RemoteTestResultReciever(); + EditorConnection.instance.Initialize(); + if (!m_RegisteredConnectionCallbacks) + { + EditorConnection.instance.Initialize(); + DelegateEditorConnectionEvents(); + } + } + + private void DelegateEditorConnectionEvents() + { + m_RegisteredConnectionCallbacks = true; + //This is needed because RemoteTestResultReciever is not a ScriptableObject + EditorConnection.instance.Register(PlayerConnectionMessageIds.runStartedMessageId, RunStarted); + EditorConnection.instance.Register(PlayerConnectionMessageIds.runFinishedMessageId, RunFinished); + EditorConnection.instance.Register(PlayerConnectionMessageIds.testStartedMessageId, TestStarted); + EditorConnection.instance.Register(PlayerConnectionMessageIds.testFinishedMessageId, TestFinished); + EditorConnection.instance.Register(PlayerConnectionMessageIds.playerAliveHeartbeat, PlayerAliveHearbeat); + } + + private void RunStarted(MessageEventArgs messageEventArgs) + { + m_TimeoutCallback?.Reset(); + m_RemoteTestResultReciever.RunStarted(messageEventArgs); + CallbacksDelegator.instance.RunStartedRemotely(messageEventArgs.data); + } + + private void RunFinished(MessageEventArgs messageEventArgs) + { + m_TimeoutCallback?.Clear(); + m_RemoteTestResultReciever.RunFinished(messageEventArgs); + m_PlatformSpecificSetup.CleanUp(); + + CallbacksDelegator.instance.RunFinishedRemotely(messageEventArgs.data); + } + + private void TestStarted(MessageEventArgs messageEventArgs) + { + m_TimeoutCallback?.Reset(); + CallbacksDelegator.instance.TestStartedRemotely(messageEventArgs.data); + } + + private void TestFinished(MessageEventArgs messageEventArgs) + { + m_TimeoutCallback?.Reset(); + CallbacksDelegator.instance.TestFinishedRemotely(messageEventArgs.data); + } + + private void PlayerAliveHearbeat(MessageEventArgs messageEventArgs) + { + m_TimeoutCallback?.Reset(); + } + + private void TimeoutCallback() + { + CallbacksDelegator.instance.RunFailed($"Test execution timed out. No activity received from the player in {m_HearbeatTimeOut} seconds."); + } + + public void PostBuildAction() + { + m_PlatformSpecificSetup.PostBuildAction(); + } + + public void PostSuccessfulBuildAction() + { + m_PlatformSpecificSetup.PostSuccessfulBuildAction(); + m_TimeoutCallback = new DelayedCallback(TimeoutCallback, m_HearbeatTimeOut); + } + + public void PostSuccessfulLaunchAction() + { + m_PlatformSpecificSetup.PostSuccessfulLaunchAction(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemotePlayerTestController.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemotePlayerTestController.cs.meta new file mode 100644 index 0000000..cdae8a1 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemotePlayerTestController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7d36034e63ad8254b9b2f55280fcc040 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemoteTestResultReciever.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemoteTestResultReciever.cs new file mode 100644 index 0000000..fe0a624 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemoteTestResultReciever.cs @@ -0,0 +1,22 @@ +using System; +using UnityEditor.Networking.PlayerConnection; +using UnityEngine; +using UnityEngine.Networking.PlayerConnection; +using UnityEngine.TestRunner.TestLaunchers; + +namespace UnityEditor.TestTools.TestRunner +{ + [Serializable] + internal class RemoteTestResultReciever + { + public void RunStarted(MessageEventArgs messageEventArgs) + { + } + + public void RunFinished(MessageEventArgs messageEventArgs) + { + EditorConnection.instance.Send(PlayerConnectionMessageIds.quitPlayerMessageId, null, messageEventArgs.playerId); + EditorConnection.instance.DisconnectAll(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemoteTestResultReciever.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemoteTestResultReciever.cs.meta new file mode 100644 index 0000000..cd0da50 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RemoteTestResultReciever.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fdb35ef8fc437e14fa4b6c74a0609e86 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RuntimeTestLauncherBase.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RuntimeTestLauncherBase.cs new file mode 100644 index 0000000..9c104db --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RuntimeTestLauncherBase.cs @@ -0,0 +1,92 @@ +using System; +using System.Linq; +using NUnit.Framework.Interfaces; +using UnityEditor.Events; +using UnityEditor.SceneManagement; +using UnityEngine; +using UnityEngine.SceneManagement; +using UnityEngine.TestRunner.NUnitExtensions.Runner; +using UnityEngine.TestTools; +using UnityEngine.TestTools.NUnitExtensions; +using UnityEngine.TestTools.TestRunner; +using UnityEngine.TestTools.Utils; + +namespace UnityEditor.TestTools.TestRunner +{ + internal abstract class RuntimeTestLauncherBase : TestLauncherBase + { + protected Scene CreateBootstrapScene(string sceneName, Action runnerSetup) + { + var scene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single); + var go = new GameObject(PlaymodeTestsController.kPlaymodeTestControllerName); + + var editorLoadedTestAssemblyProvider = new EditorLoadedTestAssemblyProvider(new EditorCompilationInterfaceProxy(), new EditorAssembliesProxy()); + + var runner = go.AddComponent(); + runnerSetup(runner); + runner.settings.bootstrapScene = sceneName; + runner.AssembliesWithTests = editorLoadedTestAssemblyProvider.GetAssembliesGroupedByType(TestPlatform.PlayMode).Select(x => x.Assembly.GetName().Name).ToList(); + + EditorSceneManager.MarkSceneDirty(scene); + AssetDatabase.SaveAssets(); + EditorSceneManager.SaveScene(scene, sceneName, false); + + return scene; + } + + public string CreateSceneName() + { + return "Assets/InitTestScene" + DateTime.Now.Ticks + ".unity"; + } + + protected UnityTestAssemblyRunner LoadTests(ITestFilter filter) + { + var editorLoadedTestAssemblyProvider = new EditorLoadedTestAssemblyProvider(new EditorCompilationInterfaceProxy(), new EditorAssembliesProxy()); + var assembliesWithTests = editorLoadedTestAssemblyProvider.GetAssembliesGroupedByType(TestPlatform.PlayMode).Select(x => x.Assembly.GetName().Name).ToList(); + + var nUnitTestAssemblyRunner = new UnityTestAssemblyRunner(new UnityTestAssemblyBuilder(), null); + var assemblyProvider = new PlayerTestAssemblyProvider(new AssemblyLoadProxy(), assembliesWithTests); + nUnitTestAssemblyRunner.Load(assemblyProvider.GetUserAssemblies().Select(a => a.Assembly).ToArray(), TestPlatform.PlayMode, UnityTestAssemblyBuilder.GetNUnitTestBuilderSettings(TestPlatform.PlayMode)); + return nUnitTestAssemblyRunner; + } + + protected static void ReopenOriginalScene(string originalSceneName) + { + EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects); + if (!string.IsNullOrEmpty(originalSceneName)) + { + EditorSceneManager.OpenScene(originalSceneName); + } + } + } + + internal static class PlaymodeTestsControllerExtensions + { + internal static T AddEventHandlerMonoBehaviour(this PlaymodeTestsController controller) where T : MonoBehaviour, ITestRunnerListener + { + var eventHandler = controller.gameObject.AddComponent(); + SetListeners(controller, eventHandler); + return eventHandler; + } + + internal static T AddEventHandlerScriptableObject(this PlaymodeTestsController controller) where T : ScriptableObject, ITestRunnerListener + { + var eventListener = ScriptableObject.CreateInstance(); + AddEventHandlerScriptableObject(controller, eventListener); + return eventListener; + } + + internal static void AddEventHandlerScriptableObject(this PlaymodeTestsController controller, ITestRunnerListener obj) + { + SetListeners(controller, obj); + } + + private static void SetListeners(PlaymodeTestsController controller, ITestRunnerListener eventHandler) + { + UnityEventTools.AddPersistentListener(controller.testStartedEvent, eventHandler.TestStarted); + UnityEventTools.AddPersistentListener(controller.testFinishedEvent, eventHandler.TestFinished); + UnityEventTools.AddPersistentListener(controller.runStartedEvent, eventHandler.RunStarted); + UnityEventTools.AddPersistentListener(controller.runFinishedEvent, eventHandler.RunFinished); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RuntimeTestLauncherBase.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RuntimeTestLauncherBase.cs.meta new file mode 100644 index 0000000..2c6ca4e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/RuntimeTestLauncherBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0efb23ecb373b6d4bbe5217485785138 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/TestLauncherBase.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/TestLauncherBase.cs new file mode 100644 index 0000000..beeba27 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/TestLauncherBase.cs @@ -0,0 +1,85 @@ +using System; +using System.Linq; +using NUnit.Framework.Interfaces; +using UnityEngine; +using UnityEngine.TestTools; +using UnityEngine.TestTools.Logging; +using UnityEngine.TestTools.TestRunner; + +namespace UnityEditor.TestTools.TestRunner +{ + internal abstract class TestLauncherBase + { + public abstract void Run(); + + protected virtual RuntimePlatform? TestTargetPlatform + { + get { return Application.platform; } + } + + protected bool ExecutePreBuildSetupMethods(ITest tests, ITestFilter testRunnerFilter) + { + var attributeFinder = new PrebuildSetupAttributeFinder(); + var logString = "Executing setup for: {0}"; + return ExecuteMethods(tests, testRunnerFilter, attributeFinder, logString, targetClass => targetClass.Setup(), TestTargetPlatform); + } + + public void ExecutePostBuildCleanupMethods(ITest tests, ITestFilter testRunnerFilter) + { + ExecutePostBuildCleanupMethods(tests, testRunnerFilter, TestTargetPlatform); + } + + public static void ExecutePostBuildCleanupMethods(ITest tests, ITestFilter testRunnerFilter, RuntimePlatform? testTargetPlatform) + { + var attributeFinder = new PostbuildCleanupAttributeFinder(); + var logString = "Executing cleanup for: {0}"; + ExecuteMethods(tests, testRunnerFilter, attributeFinder, logString, targetClass => targetClass.Cleanup(), testTargetPlatform); + } + + private static bool ExecuteMethods(ITest tests, ITestFilter testRunnerFilter, AttributeFinderBase attributeFinder, string logString, Action action, RuntimePlatform? testTargetPlatform) + { + var exceptionsThrown = false; + + if (testTargetPlatform == null) + { + Debug.LogError("Could not determine test target platform from build target " + EditorUserBuildSettings.activeBuildTarget); + return true; + } + + foreach (var targetClassType in attributeFinder.Search(tests, testRunnerFilter, testTargetPlatform.Value)) + { + try + { + var targetClass = (T)Activator.CreateInstance(targetClassType); + + Debug.LogFormat(logString, targetClassType.FullName); + + using (var logScope = new LogScope()) + { + action(targetClass); + + if (logScope.AnyFailingLogs()) + { + var failingLog = logScope.FailingLogs.First(); + throw new UnhandledLogMessageException(failingLog); + } + + if (logScope.ExpectedLogs.Any()) + { + var expectedLogs = logScope.ExpectedLogs.First(); + throw new UnexpectedLogMessageException(expectedLogs); + } + } + } + catch (InvalidCastException) {} + catch (Exception e) + { + Debug.LogException(e); + exceptionsThrown = true; + } + } + + return exceptionsThrown; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/TestLauncherBase.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/TestLauncherBase.cs.meta new file mode 100644 index 0000000..1297804 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestLaunchers/TestLauncherBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1cddf785b0d07434d8e0607c97b09135 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestResultSerializer.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestResultSerializer.cs new file mode 100644 index 0000000..7617553 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestResultSerializer.cs @@ -0,0 +1,71 @@ +using System; +using System.Reflection; +using System.Text; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner +{ + [Serializable] + internal class TestResultSerializer + { + private static readonly BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Public | + BindingFlags.Instance | BindingFlags.FlattenHierarchy; + + [SerializeField] public string id; + + [SerializeField] public string fullName; + + [SerializeField] private double duration; + + [SerializeField] private string label; + + [SerializeField] private string message; + + [SerializeField] private string output; + + [SerializeField] private string site; + + [SerializeField] private string stacktrace; + + [SerializeField] private double startTimeAO; + + [SerializeField] private string status; + + public static TestResultSerializer MakeFromTestResult(ITestResult result) + { + var wrapper = new TestResultSerializer(); + wrapper.id = result.Test.Id; + wrapper.fullName = result.FullName; + wrapper.status = result.ResultState.Status.ToString(); + wrapper.label = result.ResultState.Label; + wrapper.site = result.ResultState.Site.ToString(); + wrapper.output = result.Output; + wrapper.duration = result.Duration; + wrapper.stacktrace = result.StackTrace; + wrapper.message = result.Message; + wrapper.startTimeAO = result.StartTime.ToOADate(); + return wrapper; + } + + public void RestoreTestResult(TestResult result) + { + var resultState = new ResultState((TestStatus)Enum.Parse(typeof(TestStatus), status), label, + (FailureSite)Enum.Parse(typeof(FailureSite), site)); + result.GetType().BaseType.GetField("_resultState", flags).SetValue(result, resultState); + result.GetType().BaseType.GetField("_output", flags).SetValue(result, new StringBuilder(output)); + result.GetType().BaseType.GetField("_duration", flags).SetValue(result, duration); + result.GetType().BaseType.GetField("_message", flags).SetValue(result, message); + result.GetType().BaseType.GetField("_stackTrace", flags).SetValue(result, stacktrace); + result.GetType() + .BaseType.GetProperty("StartTime", flags) + .SetValue(result, DateTime.FromOADate(startTimeAO), null); + } + + public bool IsPassed() + { + return status == TestStatus.Passed.ToString(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestResultSerializer.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestResultSerializer.cs.meta new file mode 100644 index 0000000..0e4eed4 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestResultSerializer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 559482fe33c79e44882d3a6cedc55fb5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun.meta new file mode 100644 index 0000000..9be01d6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8721cb2237d4a564a94a51f56243bdac +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks.meta new file mode 100644 index 0000000..d1a1aeb --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6dba53789da15814387fa5b1445e81e0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/BuildActionTaskBase.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/BuildActionTaskBase.cs new file mode 100644 index 0000000..016ea54 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/BuildActionTaskBase.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework.Interfaces; +using UnityEngine; +using UnityEngine.TestTools.Logging; +using UnityEngine.TestTools.TestRunner; + +namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks +{ + internal abstract class BuildActionTaskBase : TestTaskBase + { + private string typeName; + internal IAttributeFinder attributeFinder; + internal RuntimePlatform targetPlatform = Application.platform; + internal Action logAction = Debug.Log; + internal Func logScopeProvider = () => new LogScope(); + internal Func createInstance = Activator.CreateInstance; + + protected BuildActionTaskBase(IAttributeFinder attributeFinder) + { + this.attributeFinder = attributeFinder; + typeName = typeof(T).Name; + } + + protected abstract void Action(T target); + + public override IEnumerator Execute(TestJobData testJobData) + { + if (testJobData.testTree == null) + { + throw new Exception($"Test tree is not available for {GetType().Name}."); + } + + var enumerator = ExecuteMethods(testJobData.testTree, testJobData.executionSettings.BuildNUnitFilter()); + while (enumerator.MoveNext()) + { + yield return null; + } + } + + protected IEnumerator ExecuteMethods(ITest testTree, ITestFilter testRunnerFilter) + { + var exceptions = new List(); + + foreach (var targetClassType in attributeFinder.Search(testTree, testRunnerFilter, targetPlatform)) + { + try + { + var targetClass = (T) createInstance(targetClassType); + + logAction($"Executing {typeName} for: {targetClassType.FullName}."); + + using (var logScope = logScopeProvider()) + { + Action(targetClass); + + if (logScope.AnyFailingLogs()) + { + var failingLog = logScope.FailingLogs.First(); + throw new UnhandledLogMessageException(failingLog); + } + + if (logScope.ExpectedLogs.Any()) + { + var expectedLogs = logScope.ExpectedLogs.First(); + throw new UnexpectedLogMessageException(expectedLogs); + } + } + } + catch (Exception ex) + { + exceptions.Add(ex); + } + + yield return null; + } + + if (exceptions.Count > 0) + { + throw new AggregateException($"One or more exceptions when executing {typeName}.", exceptions); + } + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/BuildActionTaskBase.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/BuildActionTaskBase.cs.meta new file mode 100644 index 0000000..e4fd79f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/BuildActionTaskBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c2441d353f9c42a44af6e224e4901b52 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/BuildTestTreeTask.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/BuildTestTreeTask.cs new file mode 100644 index 0000000..fa45752 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/BuildTestTreeTask.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections; +using System.Linq; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine.TestRunner.NUnitExtensions; +using UnityEngine.TestTools; +using UnityEngine.TestTools.NUnitExtensions; + +namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks +{ + internal class BuildTestTreeTask : TestTaskBase + { + private TestPlatform m_TestPlatform; + + public BuildTestTreeTask(TestPlatform testPlatform) + { + m_TestPlatform = testPlatform; + } + + internal IEditorLoadedTestAssemblyProvider m_testAssemblyProvider = new EditorLoadedTestAssemblyProvider(new EditorCompilationInterfaceProxy(), new EditorAssembliesProxy()); + internal IAsyncTestAssemblyBuilder m_testAssemblyBuilder = new UnityTestAssemblyBuilder(); + internal ICallbacksDelegator m_CallbacksDelegator = CallbacksDelegator.instance; + + public override IEnumerator Execute(TestJobData testJobData) + { + if (testJobData.testTree != null) + { + yield break; + } + + var assembliesEnumerator = m_testAssemblyProvider.GetAssembliesGroupedByTypeAsync(m_TestPlatform); + while (assembliesEnumerator.MoveNext()) + { + yield return null; + } + + if (assembliesEnumerator.Current == null) + { + throw new Exception("Assemblies not retrieved."); + } + + var assemblies = assembliesEnumerator.Current.Where(pair => m_TestPlatform.IsFlagIncluded(pair.Key)).SelectMany(pair => pair.Value).Select(x => x.Assembly).ToArray(); + var buildSettings = UnityTestAssemblyBuilder.GetNUnitTestBuilderSettings(m_TestPlatform); + var enumerator = m_testAssemblyBuilder.BuildAsync(assemblies, Enumerable.Repeat(m_TestPlatform, assemblies.Length).ToArray(), buildSettings); + while (enumerator.MoveNext()) + { + yield return null; + } + + var testList = enumerator.Current; + if (testList== null) + { + throw new Exception("Test list not retrieved."); + } + + testList.ParseForNameDuplicates(); + testJobData.testTree = testList; + m_CallbacksDelegator.TestTreeRebuild(testList); + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/BuildTestTreeTask.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/BuildTestTreeTask.cs.meta new file mode 100644 index 0000000..ff4c0f7 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/BuildTestTreeTask.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a0288e1c9324e824bab7e2044a72a434 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/CleanupVerificationTask.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/CleanupVerificationTask.cs new file mode 100644 index 0000000..3da9a30 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/CleanupVerificationTask.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections; +using System.IO; +using System.Linq; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks +{ + internal class CleanupVerificationTask : FileCleanupVerifierTaskBase + { + private const string k_Indent = " "; + + internal Action logAction = Debug.LogWarning; + + public override IEnumerator Execute(TestJobData testJobData) + { + var currentFiles = GetAllFilesInAssetsDirectory(); + var existingFiles = testJobData.existingFiles; + + if (currentFiles.Length != existingFiles.Length) + { + LogWarningForFilesIfAny(currentFiles.Where(file => !testJobData.existingFiles.Contains(file)).ToArray()); + } + + yield return null; + } + + private void LogWarningForFilesIfAny(string[] filePaths) + { + if (!filePaths.Any()) + { + return; + } + + var stringWriter = new StringWriter(); + stringWriter.WriteLine("Files generated by test without cleanup."); + stringWriter.WriteLine(k_Indent + "Found {0} new files.", filePaths.Length); + + foreach (var filePath in filePaths) + { + stringWriter.WriteLine(k_Indent + filePath); + } + + logAction(stringWriter.ToString()); + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/CleanupVerificationTask.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/CleanupVerificationTask.cs.meta new file mode 100644 index 0000000..749b832 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/CleanupVerificationTask.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 93eb6389f4fb6924987867ce0bc339ee +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/FileCleanupVerifierTaskBase.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/FileCleanupVerifierTaskBase.cs new file mode 100644 index 0000000..18dc47b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/FileCleanupVerifierTaskBase.cs @@ -0,0 +1,14 @@ +using System; + +namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks +{ + internal abstract class FileCleanupVerifierTaskBase : TestTaskBase + { + internal Func GetAllAssetPathsAction = AssetDatabase.GetAllAssetPaths; + + protected string[] GetAllFilesInAssetsDirectory() + { + return GetAllAssetPathsAction(); + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/FileCleanupVerifierTaskBase.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/FileCleanupVerifierTaskBase.cs.meta new file mode 100644 index 0000000..64b8002 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/FileCleanupVerifierTaskBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ad7bb166069f8414e9ad26606b305e66 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyEditModeRunTask.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyEditModeRunTask.cs new file mode 100644 index 0000000..2186048 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyEditModeRunTask.cs @@ -0,0 +1,26 @@ +using System.Collections; +using UnityEngine; +using UnityEngine.TestTools; + +namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks +{ + internal class LegacyEditModeRunTask : TestTaskBase + { + public LegacyEditModeRunTask() : base(true) + { + + } + + public override IEnumerator Execute(TestJobData testJobData) + { + var testLauncher = new EditModeLauncher(testJobData.executionSettings.filters, TestPlatform.EditMode, testJobData.executionSettings.runSynchronously); + testJobData.editModeRunner = testLauncher.m_EditModeRunner; + testLauncher.Run(); + + while (testJobData.editModeRunner != null && !testJobData.editModeRunner.RunFinished) + { + yield return null; + } + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyEditModeRunTask.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyEditModeRunTask.cs.meta new file mode 100644 index 0000000..a4f66d6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyEditModeRunTask.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b4246555189b5ee43b4857220f9fd29b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyPlayModeRunTask.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyPlayModeRunTask.cs new file mode 100644 index 0000000..1be2a80 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyPlayModeRunTask.cs @@ -0,0 +1,26 @@ +using System.Collections; +using System.Linq; +using UnityEngine.TestTools.TestRunner; + +namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks +{ + internal class LegacyPlayModeRunTask : TestTaskBase + { + public LegacyPlayModeRunTask() : base(true) + { + + } + public override IEnumerator Execute(TestJobData testJobData) + { + var settings = PlaymodeTestsControllerSettings.CreateRunnerSettings(testJobData.executionSettings.filters.Select(filter => filter.ToTestRunnerFilter()).ToArray()); + var launcher = new PlaymodeLauncher(settings); + + launcher.Run(); + + while (PlaymodeLauncher.IsRunning) + { + yield return null; + } + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyPlayModeRunTask.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyPlayModeRunTask.cs.meta new file mode 100644 index 0000000..f37f78d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyPlayModeRunTask.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4769fe1e7475c8843b092338acbcad25 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyPlayerRunTask.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyPlayerRunTask.cs new file mode 100644 index 0000000..7ee1913 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyPlayerRunTask.cs @@ -0,0 +1,18 @@ +using System.Collections; +using System.Linq; +using UnityEngine.TestTools.TestRunner; + +namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks +{ + internal class LegacyPlayerRunTask : TestTaskBase + { + public override IEnumerator Execute(TestJobData testJobData) + { + var executionSettings = testJobData.executionSettings; + var settings = PlaymodeTestsControllerSettings.CreateRunnerSettings(executionSettings.filters.Select(filter => filter.ToTestRunnerFilter()).ToArray()); + var launcher = new PlayerLauncher(settings, executionSettings.targetPlatform, executionSettings.overloadTestRunSettings, executionSettings.playerHeartbeatTimeout); + launcher.Run(); + yield return null; + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyPlayerRunTask.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyPlayerRunTask.cs.meta new file mode 100644 index 0000000..e2046bb --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/LegacyPlayerRunTask.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b93fe5bbea454ae438fcec241c5fa85b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/PerformUndoTask.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/PerformUndoTask.cs new file mode 100644 index 0000000..df64442 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/PerformUndoTask.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks +{ + internal class PerformUndoTask : TestTaskBase + { + private const double warningThreshold = 1000; + + internal Action RevertAllDownToGroup = Undo.RevertAllDownToGroup; + internal Action LogWarning = Debug.LogWarning; + internal Action DisplayProgressBar = EditorUtility.DisplayProgressBar; + internal Action ClearProgressBar = EditorUtility.ClearProgressBar; + internal Func TimeNow = () => DateTime.Now; + + public override IEnumerator Execute(TestJobData testJobData) + { + if (testJobData.undoGroup < 0) + { + yield break; + } + + DisplayProgressBar("Undo", "Reverting changes to the scene", 0); + + var undoStartTime = TimeNow(); + + RevertAllDownToGroup(testJobData.undoGroup); + + var timeDelta = TimeNow() - undoStartTime; + if (timeDelta.TotalMilliseconds >= warningThreshold) + { + LogWarning($"Undo after editor test run took {timeDelta.Seconds} second{(timeDelta.Seconds == 1 ? "" : "s")}."); + } + + ClearProgressBar(); + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/PerformUndoTask.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/PerformUndoTask.cs.meta new file mode 100644 index 0000000..be55331 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/PerformUndoTask.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fb1abebffd37bd4458c84e15a5d7ab04 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/PrebuildSetupTask.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/PrebuildSetupTask.cs new file mode 100644 index 0000000..34e03e3 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/PrebuildSetupTask.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections; +using NUnit.Framework.Interfaces; +using UnityEngine; +using UnityEngine.TestTools; + +namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks +{ + internal class PrebuildSetupTask : BuildActionTaskBase + { + public PrebuildSetupTask() : base(new PrebuildSetupAttributeFinder()) + { + } + + protected override void Action(IPrebuildSetup target) + { + target.Setup(); + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/PrebuildSetupTask.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/PrebuildSetupTask.cs.meta new file mode 100644 index 0000000..009894d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/PrebuildSetupTask.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fc039194235714f48a39bd364885e744 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/RegisterFilesForCleanupVerificationTask.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/RegisterFilesForCleanupVerificationTask.cs new file mode 100644 index 0000000..7a4cf64 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/RegisterFilesForCleanupVerificationTask.cs @@ -0,0 +1,13 @@ +using System.Collections; + +namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks +{ + internal class RegisterFilesForCleanupVerificationTask : FileCleanupVerifierTaskBase + { + public override IEnumerator Execute(TestJobData testJobData) + { + testJobData.existingFiles = GetAllFilesInAssetsDirectory(); + yield return null; + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/RegisterFilesForCleanupVerificationTask.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/RegisterFilesForCleanupVerificationTask.cs.meta new file mode 100644 index 0000000..a2ef8c8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/RegisterFilesForCleanupVerificationTask.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a398fde47a0349a40a9bdf8988c392c9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/SaveModiedSceneTask.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/SaveModiedSceneTask.cs new file mode 100644 index 0000000..a2ec975 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/SaveModiedSceneTask.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections; +using UnityEditor.SceneManagement; + +namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks +{ + internal class SaveModiedSceneTask : TestTaskBase + { + internal Func SaveCurrentModifiedScenesIfUserWantsTo = + EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo; + public override IEnumerator Execute(TestJobData testJobData) + { + var cancelled = !SaveCurrentModifiedScenesIfUserWantsTo(); + if (cancelled) + { + throw new TestRunCanceledException(); + } + + yield break; + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/SaveModiedSceneTask.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/SaveModiedSceneTask.cs.meta new file mode 100644 index 0000000..b710751 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/SaveModiedSceneTask.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c321246872d389b469bd0cb86d3701ed +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/SaveUndoIndexTask.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/SaveUndoIndexTask.cs new file mode 100644 index 0000000..45b1227 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/SaveUndoIndexTask.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections; + +namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks +{ + internal class SaveUndoIndexTask : TestTaskBase + { + internal Func GetUndoGroup = Undo.GetCurrentGroup; + public override IEnumerator Execute(TestJobData testJobData) + { + testJobData.undoGroup = GetUndoGroup(); + yield break; + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/SaveUndoIndexTask.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/SaveUndoIndexTask.cs.meta new file mode 100644 index 0000000..d79dc22 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/SaveUndoIndexTask.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cc0ce06a7515c044bb8db4c75db84114 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/TestTaskBase.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/TestTaskBase.cs new file mode 100644 index 0000000..d83490b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/TestTaskBase.cs @@ -0,0 +1,16 @@ +using System.Collections; + +namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks +{ + internal abstract class TestTaskBase + { + public bool SupportsResumingEnumerator; + + protected TestTaskBase(bool supportsResumingEnumerator = false) + { + SupportsResumingEnumerator = supportsResumingEnumerator; + } + + public abstract IEnumerator Execute(TestJobData testJobData); + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/TestTaskBase.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/TestTaskBase.cs.meta new file mode 100644 index 0000000..89edb19 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/Tasks/TestTaskBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 342d9ef4da0a19b49877f576c2deec14 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobData.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobData.cs new file mode 100644 index 0000000..06358df --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobData.cs @@ -0,0 +1,49 @@ +using System; +using NUnit.Framework.Interfaces; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner.TestRun +{ + [Serializable] + internal class TestJobData + { + [SerializeField] + public string guid; + + [SerializeField] + public int taskIndex; + + [SerializeField] + public int taskPC; + + [SerializeField] + public bool isRunning; + + [SerializeField] + public ExecutionSettings executionSettings; + + [SerializeField] + public string[] existingFiles; + + [SerializeField] + public int undoGroup = -1; + + [SerializeField] + public EditModeRunner editModeRunner; + + [NonSerialized] + public bool isHandledByRunner; + + public ITest testTree; + + public TestJobData(ExecutionSettings settings) + { + guid = Guid.NewGuid().ToString(); + executionSettings = settings; + isRunning = false; + taskIndex = 0; + taskPC = 0; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobData.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobData.cs.meta new file mode 100644 index 0000000..34a3c41 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 80ac8f5b2a7fa904dbc80111be88c8be +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobDataHolder.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobDataHolder.cs new file mode 100644 index 0000000..8f1309e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobDataHolder.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner.TestRun +{ + internal class TestJobDataHolder : ScriptableSingleton + { + [SerializeField] + public List TestRuns = new List(); + + [InitializeOnLoadMethod] + private static void ResumeRunningJobs() + { + foreach (var testRun in instance.TestRuns.ToArray()) + { + if (testRun.isRunning) + { + var runner = new TestJobRunner(); + runner.RunJob(testRun); + } + else + { + instance.TestRuns.Remove(testRun); + } + } + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobDataHolder.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobDataHolder.cs.meta new file mode 100644 index 0000000..fdc9a90 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobDataHolder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 612b00d793cac3c49808ab3ee5428f16 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobRunner.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobRunner.cs new file mode 100644 index 0000000..5485688 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobRunner.cs @@ -0,0 +1,166 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEditor.TestTools.TestRunner.TestRun.Tasks; +using UnityEngine; +using UnityEngine.TestTools; + +namespace UnityEditor.TestTools.TestRunner.TestRun +{ + internal class TestJobRunner + { + private static IEnumerable GetTaskList(ExecutionSettings settings) + { + if (settings == null) + { + yield break; + } + + if (settings.EditModeIncluded() || (PlayerSettings.runPlayModeTestAsEditModeTest && settings.PlayModeInEditorIncluded())) + { + yield return new SaveModiedSceneTask(); + yield return new RegisterFilesForCleanupVerificationTask(); + yield return new SaveUndoIndexTask(); + yield return new BuildTestTreeTask(TestPlatform.EditMode); + yield return new PrebuildSetupTask(); + yield return new LegacyEditModeRunTask(); + yield return new PerformUndoTask(); + yield return new CleanupVerificationTask(); + yield break; + } + + if (settings.PlayModeInEditorIncluded() && !PlayerSettings.runPlayModeTestAsEditModeTest) + { + yield return new SaveModiedSceneTask(); + yield return new LegacyPlayModeRunTask(); + yield break; + } + + if (settings.PlayerIncluded()) + { + yield return new LegacyPlayerRunTask(); + yield break; + } + } + + internal List SavedTestJobData = TestJobDataHolder.instance.TestRuns; + internal Action SubscribeCallback = (callback) => EditorApplication.update += callback; + // ReSharper disable once DelegateSubtraction + internal Action UnsubscribeCallback = (callback) => EditorApplication.update -= callback; + internal TestCommandPcHelper PcHelper = new EditModePcHelper(); + internal Func> GetTasks = GetTaskList; + internal Action LogException = Debug.LogException; + internal Action LogError = Debug.LogError; + internal Action ReportRunFailed = CallbacksDelegator.instance.RunFailed; + + private TestJobData m_JobData; + private TestTaskBase[] Tasks; + private IEnumerator m_Enumerator = null; + + public string RunJob(TestJobData data) + { + if (data == null) + { + throw new ArgumentException(null, nameof(data)); + } + + if (m_JobData != null && m_JobData.isRunning) + { + throw new Exception("TestJobRunner is already running a job."); + } + + if (data.isHandledByRunner) + { + throw new Exception("Test job is already being handled."); + } + + m_JobData = data; + m_JobData.isHandledByRunner = true; + + if (!m_JobData.isRunning) + { + m_JobData.isRunning = true; + SavedTestJobData.Add(m_JobData); + } + + Tasks = GetTasks(data.executionSettings).ToArray(); + if (!data.executionSettings.runSynchronously) + { + SubscribeCallback(ExecuteStep); + } + else + { + while (data.isRunning) + { + ExecuteStep(); + } + } + + return data.guid; + } + + private void ExecuteStep() + { + try + { + if (m_JobData.taskIndex >= Tasks.Length) + { + StopRun(); + return; + } + + if (m_Enumerator == null) + { + var task = Tasks[m_JobData.taskIndex]; + m_Enumerator = task.Execute(m_JobData); + if (task.SupportsResumingEnumerator) + { + PcHelper.SetEnumeratorPC(m_Enumerator, m_JobData.taskPC); + } + } + + if (!m_Enumerator.MoveNext()) + { + m_JobData.taskIndex++; + m_JobData.taskPC = 0; + m_Enumerator = null; + return; + } + + if (Tasks[m_JobData.taskIndex].SupportsResumingEnumerator) + { + m_JobData.taskPC = PcHelper.GetEnumeratorPC(m_Enumerator); + } + } + catch (TestRunCanceledException) + { + StopRun(); + } + catch (AggregateException ex) + { + StopRun(); + LogError(ex.Message); + foreach (var innerException in ex.InnerExceptions) + { + LogException(innerException); + } + ReportRunFailed("Multiple unexpected errors happened while running tests."); + } + catch (Exception ex) + { + StopRun(); + LogException(ex); + ReportRunFailed("An unexpected error happened while running tests."); + } + } + + private void StopRun() + { + m_JobData.isRunning = false; + UnsubscribeCallback(ExecuteStep); + SavedTestJobData.Remove(m_JobData); + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobRunner.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobRunner.cs.meta new file mode 100644 index 0000000..bb3f48d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestJobRunner.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0b677ddfd54046c498a20446baa4f932 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestRunCanceledException.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestRunCanceledException.cs new file mode 100644 index 0000000..faf67f6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestRunCanceledException.cs @@ -0,0 +1,9 @@ +using System; + +namespace UnityEditor.TestTools.TestRunner.TestRun +{ + internal class TestRunCanceledException : Exception + { + + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestRunCanceledException.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestRunCanceledException.cs.meta new file mode 100644 index 0000000..bf2f3f0 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRun/TestRunCanceledException.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1d45b9d3cf85bee4f99c1492fca8438a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner.meta new file mode 100644 index 0000000..0b4efe9 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 49d4c2ab7ff0f4442af256bad7c9d57c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks.meta new file mode 100644 index 0000000..d7be998 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5d7f0d6acfced954682a89e7002c04d9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/EditModeRunnerCallback.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/EditModeRunnerCallback.cs new file mode 100644 index 0000000..7d026fa --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/EditModeRunnerCallback.cs @@ -0,0 +1,178 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using UnityEditor.SceneManagement; +using UnityEngine; +using UnityEngine.TestTools.TestRunner; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class EditModeRunnerCallback : ScriptableObject, ITestRunnerListener + { + private EditModeLauncherContextSettings m_Settings; + public SceneSetup[] previousSceneSetup; + public EditModeRunner runner; + + private bool m_Canceled; + private ITest m_CurrentTest; + private int m_TotalTests; + + [SerializeField] + private List m_PendingTests; + [SerializeField] + private string m_LastCountedTestName; + [SerializeField] + private bool m_RunRestarted; + + public void OnDestroy() + { + CleanUp(); + } + + public void RunStarted(ITest testsToRun) + { + Setup(); + if (m_PendingTests == null) + { + m_PendingTests = GetTestsExpectedToRun(testsToRun, runner.GetFilter()); + m_TotalTests = m_PendingTests.Count; + } + } + + public void OnEnable() + { + if (m_RunRestarted) + { + Setup(); + } + } + + private void Setup() + { + m_Settings = new EditModeLauncherContextSettings(); + Application.logMessageReceivedThreaded += LogReceived; + EditorApplication.playModeStateChanged += WaitForExitPlaymode; + EditorApplication.update += DisplayProgressBar; + AssemblyReloadEvents.beforeAssemblyReload += BeforeAssemblyReload; + } + + private void BeforeAssemblyReload() + { + if (m_CurrentTest != null) + { + m_LastCountedTestName = m_CurrentTest.FullName; + m_RunRestarted = true; + } + } + + private void DisplayProgressBar() + { + if (m_CurrentTest == null) + return; + if (!m_Canceled && EditorUtility.DisplayCancelableProgressBar("Test Runner", "Running test " + m_CurrentTest.Name, Math.Min(1.0f, (float)(m_TotalTests - m_PendingTests.Count) / m_TotalTests))) + { + EditorApplication.update -= DisplayProgressBar; + m_Canceled = true; + EditorUtility.ClearProgressBar(); + runner.OnRunCancel(); + } + } + + private static void LogReceived(string message, string stacktrace, LogType type) + { + if (TestContext.Out != null) + TestContext.Out.WriteLine(message); + } + + private static void WaitForExitPlaymode(PlayModeStateChange state) + { + if (state == PlayModeStateChange.EnteredEditMode) + { + EditorApplication.playModeStateChanged -= WaitForExitPlaymode; + //because logMessage is reset on Enter EditMode + //we remove and add the callback + //because Unity + Application.logMessageReceivedThreaded -= LogReceived; + Application.logMessageReceivedThreaded += LogReceived; + } + } + + public void RunFinished(ITestResult result) + { + if (previousSceneSetup != null && previousSceneSetup.Length > 0) + { + try + { + EditorSceneManager.RestoreSceneManagerSetup(previousSceneSetup); + } + catch (ArgumentException e) + { + Debug.LogWarning(e.Message); + } + } + else + { + EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects, NewSceneMode.Single); + } + CleanUp(); + } + + private void CleanUp() + { + m_CurrentTest = null; + EditorUtility.ClearProgressBar(); + if (m_Settings != null) + { + m_Settings.Dispose(); + } + Application.logMessageReceivedThreaded -= LogReceived; + EditorApplication.update -= DisplayProgressBar; + } + + public void TestStarted(ITest test) + { + if (test.IsSuite || !(test is TestMethod)) + { + return; + } + + m_CurrentTest = test; + + if (m_RunRestarted) + { + if (test.FullName == m_LastCountedTestName) + m_RunRestarted = false; + } + } + + public void TestFinished(ITestResult result) + { + if (result.Test is TestMethod) + { + m_PendingTests.Remove(result.Test.FullName); + } + } + + private static List GetTestsExpectedToRun(ITest test, ITestFilter filter) + { + var expectedTests = new List(); + + if (filter.Pass(test)) + { + if (test.IsSuite) + { + expectedTests.AddRange(test.Tests.SelectMany(subTest => GetTestsExpectedToRun(subTest, filter))); + } + else + { + expectedTests.Add(test.FullName); + } + } + + return expectedTests; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/EditModeRunnerCallback.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/EditModeRunnerCallback.cs.meta new file mode 100644 index 0000000..5c5501b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/EditModeRunnerCallback.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cc456ba93311a3a43ad896449fee9868 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallback.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallback.cs new file mode 100644 index 0000000..2515ea7 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallback.cs @@ -0,0 +1,86 @@ +using UnityEditor.TestTools.TestRunner.Api; +using UnityEditor.TestTools.TestRunner.CommandLineTest; +using UnityEngine.TestTools.TestRunner.GUI; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class RerunCallback : ScriptableObject, ICallbacks + { + public static bool useMockRunFilter = false; + public static TestRunnerFilter mockRunFilter = null; + + public void RunFinished(ITestResultAdaptor result) + { + if (RerunCallbackData.instance.runFilters == null || RerunCallbackData.instance.runFilters.Length == 0) + RerunCallbackData.instance.runFilters = new[] {new TestRunnerFilter()}; + + var runFilter = RerunCallbackData.instance.runFilters[0]; + + if (useMockRunFilter) + { + runFilter = mockRunFilter; + } + + runFilter.testRepetitions--; + if (runFilter.testRepetitions <= 0 || result.TestStatus != TestStatus.Passed) + { + ExitCallbacks.preventExit = false; + return; + } + + ExitCallbacks.preventExit = true; + if (EditorApplication.isPlaying) + { + EditorApplication.playModeStateChanged += WaitForExitPlaymode; + return; + } + + if (!useMockRunFilter) + { + ExecuteTestRunnerAPI(); + } + } + + private static void WaitForExitPlaymode(PlayModeStateChange state) + { + if (state == PlayModeStateChange.EnteredEditMode) + { + ExecuteTestRunnerAPI(); + } + } + + private static void ExecuteTestRunnerAPI() + { + var runFilter = RerunCallbackData.instance.runFilters[0]; + var testMode = RerunCallbackData.instance.testMode; + + var testRunnerApi = ScriptableObject.CreateInstance(); + testRunnerApi.Execute(new Api.ExecutionSettings() + { + filters = new[] + { + new Filter() + { + categoryNames = runFilter.categoryNames, + groupNames = runFilter.groupNames, + testMode = testMode, + testNames = runFilter.testNames + } + } + }); + } + + public void TestStarted(ITestAdaptor test) + { + } + + public void TestFinished(ITestResultAdaptor result) + { + } + + public void RunStarted(ITestAdaptor testsToRun) + { + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallback.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallback.cs.meta new file mode 100644 index 0000000..b4fc0e2 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallback.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b7ff2b2e91321ff4381d4ab45870a32e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallbackData.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallbackData.cs new file mode 100644 index 0000000..8aeeeec --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallbackData.cs @@ -0,0 +1,15 @@ +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine; +using UnityEngine.TestTools.TestRunner.GUI; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class RerunCallbackData : ScriptableSingleton + { + [SerializeField] + internal TestRunnerFilter[] runFilters; + + [SerializeField] + internal TestMode testMode; + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallbackData.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallbackData.cs.meta new file mode 100644 index 0000000..bc911fe --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallbackData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 087cba9fa6ac867479a0b0fdc0a5864b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallbackInitializer.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallbackInitializer.cs new file mode 100644 index 0000000..86be497 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallbackInitializer.cs @@ -0,0 +1,17 @@ +using UnityEngine; +using UnityEditor.TestTools.TestRunner.Api; + +namespace UnityEditor.TestTools.TestRunner +{ + [InitializeOnLoad] + static class RerunCallbackInitializer + { + static RerunCallbackInitializer() + { + var testRunnerApi = ScriptableObject.CreateInstance(); + + var rerunCallback = ScriptableObject.CreateInstance(); + testRunnerApi.RegisterCallbacks(rerunCallback); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallbackInitializer.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallbackInitializer.cs.meta new file mode 100644 index 0000000..1f50bcc --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/RerunCallbackInitializer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f73fc901e4b0f2d4daf11f46506054ba +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/TestRunnerCallback.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/TestRunnerCallback.cs new file mode 100644 index 0000000..6e89c21 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/TestRunnerCallback.cs @@ -0,0 +1,37 @@ +using NUnit.Framework.Interfaces; +using UnityEngine; +using UnityEngine.TestTools.TestRunner; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class TestRunnerCallback : ScriptableObject, ITestRunnerListener + { + public void RunStarted(ITest testsToRun) + { + EditorApplication.playModeStateChanged += OnPlayModeStateChanged; + } + + private void OnPlayModeStateChanged(PlayModeStateChange state) + { + if (state == PlayModeStateChange.ExitingPlayMode) + { + EditorApplication.playModeStateChanged -= OnPlayModeStateChanged; + //We need to make sure we don't block NUnit thread in case we exit PlayMode earlier + PlaymodeTestsController.TryCleanup(); + } + } + + public void RunFinished(ITestResult testResults) + { + EditorApplication.isPlaying = false; + } + + public void TestStarted(ITest testName) + { + } + + public void TestFinished(ITestResult test) + { + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/TestRunnerCallback.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/TestRunnerCallback.cs.meta new file mode 100644 index 0000000..a592975 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/TestRunnerCallback.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d44e6804bc58be84ea71a619b468f150 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/WindowResultUpdater.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/WindowResultUpdater.cs new file mode 100644 index 0000000..831d769 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/WindowResultUpdater.cs @@ -0,0 +1,44 @@ +using UnityEditor.TestTools.TestRunner.Api; + +namespace UnityEditor.TestTools.TestRunner.GUI +{ + internal class WindowResultUpdater : ICallbacks, ITestTreeRebuildCallbacks + { + public void RunStarted(ITestAdaptor testsToRun) + { + } + + public void RunFinished(ITestResultAdaptor testResults) + { + if (TestRunnerWindow.s_Instance != null) + { + TestRunnerWindow.s_Instance.RebuildUIFilter(); + } + } + + public void TestStarted(ITestAdaptor testName) + { + } + + public void TestFinished(ITestResultAdaptor test) + { + if (TestRunnerWindow.s_Instance == null) + { + return; + } + + var result = new TestRunnerResult(test); + TestRunnerWindow.s_Instance.m_SelectedTestTypes.UpdateResult(result); + } + + public void TestTreeRebuild(ITestAdaptor test) + { + if (TestRunnerWindow.s_Instance == null) + { + return; + } + + TestRunnerWindow.s_Instance.m_SelectedTestTypes.UpdateTestTree(test); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/WindowResultUpdater.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/WindowResultUpdater.cs.meta new file mode 100644 index 0000000..5273cf4 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Callbacks/WindowResultUpdater.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6d468ee3657be7a43a2ef2178ec14239 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditModePCHelper.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditModePCHelper.cs new file mode 100644 index 0000000..7968041 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditModePCHelper.cs @@ -0,0 +1,32 @@ +using System.Collections; +using System.Reflection; +using UnityEngine.TestTools; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class EditModePcHelper : TestCommandPcHelper + { + public override void SetEnumeratorPC(IEnumerator enumerator, int pc) + { + GetPCFieldInfo(enumerator).SetValue(enumerator, pc); + } + + public override int GetEnumeratorPC(IEnumerator enumerator) + { + if (enumerator == null) + { + return 0; + } + return (int)GetPCFieldInfo(enumerator).GetValue(enumerator); + } + + private FieldInfo GetPCFieldInfo(IEnumerator enumerator) + { + var field = enumerator.GetType().GetField("$PC", BindingFlags.NonPublic | BindingFlags.Instance); + if (field == null) // Roslyn + field = enumerator.GetType().GetField("<>1__state", BindingFlags.NonPublic | BindingFlags.Instance); + + return field; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditModePCHelper.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditModePCHelper.cs.meta new file mode 100644 index 0000000..2bb2d0b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditModePCHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6d16f2e78a356d34c9a32108929de932 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditModeRunner.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditModeRunner.cs new file mode 100644 index 0000000..c0d72b4 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditModeRunner.cs @@ -0,0 +1,438 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Filters; +using UnityEngine; +using UnityEngine.TestTools.NUnitExtensions; +using UnityEngine.TestTools.TestRunner; +using UnityEngine.TestTools; +using UnityEngine.TestTools.TestRunner.GUI; +using UnityEditor.Callbacks; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine.TestRunner.NUnitExtensions; +using UnityEngine.TestRunner.NUnitExtensions.Runner; + +namespace UnityEditor.TestTools.TestRunner +{ + internal interface IUnityTestAssemblyRunnerFactory + { + IUnityTestAssemblyRunner Create(TestPlatform testPlatform, WorkItemFactory factory); + } + + internal class UnityTestAssemblyRunnerFactory : IUnityTestAssemblyRunnerFactory + { + public IUnityTestAssemblyRunner Create(TestPlatform testPlatform, WorkItemFactory factory) + { + return new UnityTestAssemblyRunner(new UnityTestAssemblyBuilder(), factory); + } + } + + [Serializable] + internal class EditModeRunner : ScriptableObject, IDisposable + { + [SerializeField] + private Filter[] m_Filters; + + //The counter from the IEnumerator object + [SerializeField] + private int m_CurrentPC; + + [SerializeField] + private bool m_ExecuteOnEnable; + + [SerializeField] + private List m_AlreadyStartedTests; + + [SerializeField] + private List m_ExecutedTests; + + [SerializeField] + private List m_CallbackObjects = new List(); + + [SerializeField] + private TestStartedEvent m_TestStartedEvent = new TestStartedEvent(); + + [SerializeField] + private TestFinishedEvent m_TestFinishedEvent = new TestFinishedEvent(); + + [SerializeField] + private RunStartedEvent m_RunStartedEvent = new RunStartedEvent(); + + [SerializeField] + private RunFinishedEvent m_RunFinishedEvent = new RunFinishedEvent(); + + [SerializeField] + private TestRunnerStateSerializer m_TestRunnerStateSerializer = new TestRunnerStateSerializer(); + + [SerializeField] + private bool m_RunningTests; + + [SerializeField] + private TestPlatform m_TestPlatform; + + [SerializeField] + private object m_CurrentYieldObject; + + [SerializeField] + private BeforeAfterTestCommandState m_SetUpTearDownState; + [SerializeField] + private BeforeAfterTestCommandState m_OuterUnityTestActionState; + + [SerializeField] + public bool RunFinished = false; + + public bool RunningSynchronously { get; private set; } + + internal IUnityTestAssemblyRunner m_Runner; + + private ConstructDelegator m_ConstructDelegator; + + private IEnumerator m_RunStep; + + public IUnityTestAssemblyRunnerFactory UnityTestAssemblyRunnerFactory { get; set; } + + public void Init(Filter[] filters, TestPlatform platform, bool runningSynchronously) + { + m_Filters = filters; + m_TestPlatform = platform; + m_AlreadyStartedTests = new List(); + m_ExecutedTests = new List(); + RunningSynchronously = runningSynchronously; + InitRunner(); + } + + private void InitRunner() + { + //We give the EditMode platform here so we dont suddenly create Playmode work items in the test Runner. + m_Runner = (UnityTestAssemblyRunnerFactory ?? new UnityTestAssemblyRunnerFactory()).Create(TestPlatform.EditMode, new EditmodeWorkItemFactory()); + var testAssemblyProvider = new EditorLoadedTestAssemblyProvider(new EditorCompilationInterfaceProxy(), new EditorAssembliesProxy()); + var assemblies = testAssemblyProvider.GetAssembliesGroupedByType(m_TestPlatform).Select(x => x.Assembly).ToArray(); + var loadedTests = m_Runner.Load(assemblies, TestPlatform.EditMode, + UnityTestAssemblyBuilder.GetNUnitTestBuilderSettings(m_TestPlatform)); + loadedTests.ParseForNameDuplicates(); + CallbacksDelegator.instance.TestTreeRebuild(loadedTests); + hideFlags |= HideFlags.DontSave; + EnumerableSetUpTearDownCommand.ActivePcHelper = new EditModePcHelper(); + OuterUnityTestActionCommand.ActivePcHelper = new EditModePcHelper(); + } + + public void OnEnable() + { + if (m_ExecuteOnEnable) + { + InitRunner(); + m_ExecuteOnEnable = false; + foreach (var callback in m_CallbackObjects) + { + AddListeners(callback as ITestRunnerListener); + } + m_ConstructDelegator = new ConstructDelegator(m_TestRunnerStateSerializer); + + EnumeratorStepHelper.SetEnumeratorPC(m_CurrentPC); + + UnityWorkItemDataHolder.alreadyExecutedTests = m_ExecutedTests.Select(x => x.fullName).ToList(); + UnityWorkItemDataHolder.alreadyStartedTests = m_AlreadyStartedTests; + Run(); + } + } + + public void TestStartedEvent(ITest test) + { + m_AlreadyStartedTests.Add(test.FullName); + } + + public void TestFinishedEvent(ITestResult testResult) + { + m_AlreadyStartedTests.Remove(testResult.FullName); + m_ExecutedTests.Add(TestResultSerializer.MakeFromTestResult(testResult)); + } + + public void Run() + { + EditModeTestCallbacks.RestoringTestContext += OnRestoringTest; + var context = m_Runner.GetCurrentContext(); + if (m_SetUpTearDownState == null) + { + m_SetUpTearDownState = CreateInstance(); + } + context.SetUpTearDownState = m_SetUpTearDownState; + + if (m_OuterUnityTestActionState == null) + { + m_OuterUnityTestActionState = CreateInstance(); + } + context.OuterUnityTestActionState = m_OuterUnityTestActionState; + + if (!m_RunningTests) + { + m_RunStartedEvent.Invoke(m_Runner.LoadedTest); + } + + if (m_ConstructDelegator == null) + m_ConstructDelegator = new ConstructDelegator(m_TestRunnerStateSerializer); + + Reflect.ConstructorCallWrapper = m_ConstructDelegator.Delegate; + m_TestStartedEvent.AddListener(TestStartedEvent); + m_TestFinishedEvent.AddListener(TestFinishedEvent); + + AssemblyReloadEvents.beforeAssemblyReload += OnBeforeAssemblyReload; + + RunningTests = true; + + EditorApplication.LockReloadAssemblies(); + + var testListenerWrapper = new TestListenerWrapper(m_TestStartedEvent, m_TestFinishedEvent); + m_RunStep = m_Runner.Run(testListenerWrapper, GetFilter()).GetEnumerator(); + m_RunningTests = true; + + if (!RunningSynchronously) + EditorApplication.update += TestConsumer; + } + + public void CompleteSynchronously() + { + while (!m_Runner.IsTestComplete) + TestConsumer(); + } + + private void OnBeforeAssemblyReload() + { + EditorApplication.update -= TestConsumer; + + if (m_ExecuteOnEnable) + { + AssemblyReloadEvents.beforeAssemblyReload -= OnBeforeAssemblyReload; + return; + } + + if (m_Runner != null && m_Runner.TopLevelWorkItem != null) + m_Runner.TopLevelWorkItem.ResultedInDomainReload = true; + + if (RunningTests) + { + Debug.LogError("TestRunner: Unexpected assembly reload happened while running tests"); + + EditorUtility.ClearProgressBar(); + + if (m_Runner.GetCurrentContext() != null && m_Runner.GetCurrentContext().CurrentResult != null) + { + m_Runner.GetCurrentContext().CurrentResult.SetResult(ResultState.Cancelled, "Unexpected assembly reload happened"); + } + OnRunCancel(); + } + } + + private bool RunningTests; + + private Stack StepStack = new Stack(); + + private bool MoveNextAndUpdateYieldObject() + { + var result = m_RunStep.MoveNext(); + + if (result) + { + m_CurrentYieldObject = m_RunStep.Current; + while (m_CurrentYieldObject is IEnumerator) // going deeper + { + var currentEnumerator = (IEnumerator)m_CurrentYieldObject; + + // go deeper and add parent to stack + StepStack.Push(m_RunStep); + + m_RunStep = currentEnumerator; + m_CurrentYieldObject = m_RunStep.Current; + } + + if (StepStack.Count > 0 && m_CurrentYieldObject != null) // not null and not IEnumerator, nested + { + Debug.LogError("EditMode test can only yield null, but not <" + m_CurrentYieldObject.GetType().Name + ">"); + } + + return true; + } + + if (StepStack.Count == 0) // done + return false; + + m_RunStep = StepStack.Pop(); // going up + return MoveNextAndUpdateYieldObject(); + } + + private void TestConsumer() + { + var moveNext = MoveNextAndUpdateYieldObject(); + + if (m_CurrentYieldObject != null) + { + InvokeDelegator(); + } + + if (!moveNext && !m_Runner.IsTestComplete) + { + CompleteTestRun(); + throw new IndexOutOfRangeException("There are no more elements to process and IsTestComplete is false"); + } + + if (m_Runner.IsTestComplete) + { + CompleteTestRun(); + } + } + + private void CompleteTestRun() + { + if (!RunningSynchronously) + EditorApplication.update -= TestConsumer; + + TestLauncherBase.ExecutePostBuildCleanupMethods(this.GetLoadedTests(), this.GetFilter(), Application.platform); + + m_RunFinishedEvent.Invoke(m_Runner.Result); + RunFinished = true; + + if (m_ConstructDelegator != null) + m_ConstructDelegator.DestroyCurrentTestObjectIfExists(); + Dispose(); + UnityWorkItemDataHolder.alreadyExecutedTests = null; + } + + private void OnRestoringTest() + { + var item = m_ExecutedTests.Find(t => t.fullName == UnityTestExecutionContext.CurrentContext.CurrentTest.FullName); + if (item != null) + { + item.RestoreTestResult(UnityTestExecutionContext.CurrentContext.CurrentResult); + } + } + + private static bool IsCancelled() + { + return UnityTestExecutionContext.CurrentContext.ExecutionStatus == TestExecutionStatus.AbortRequested || UnityTestExecutionContext.CurrentContext.ExecutionStatus == TestExecutionStatus.StopRequested; + } + + private void InvokeDelegator() + { + if (m_CurrentYieldObject == null) + { + return; + } + + if (IsCancelled()) + { + return; + } + + if (m_CurrentYieldObject is RestoreTestContextAfterDomainReload) + { + if (m_TestRunnerStateSerializer.ShouldRestore()) + { + m_TestRunnerStateSerializer.RestoreContext(); + } + + return; + } + + try + { + if (m_CurrentYieldObject is IEditModeTestYieldInstruction) + { + var editModeTestYieldInstruction = (IEditModeTestYieldInstruction)m_CurrentYieldObject; + if (editModeTestYieldInstruction.ExpectDomainReload) + { + PrepareForDomainReload(); + } + return; + } + } + catch (Exception e) + { + UnityTestExecutionContext.CurrentContext.CurrentResult.RecordException(e); + return; + } + + Debug.LogError("EditMode test can only yield null"); + } + + private void CompilationFailureWatch() + { + if (EditorApplication.isCompiling) + return; + + EditorApplication.update -= CompilationFailureWatch; + + if (EditorUtility.scriptCompilationFailed) + { + EditorUtility.ClearProgressBar(); + OnRunCancel(); + } + } + + private void PrepareForDomainReload() + { + m_TestRunnerStateSerializer.SaveContext(); + m_CurrentPC = EnumeratorStepHelper.GetEnumeratorPC(TestEnumerator.Enumerator); + m_ExecuteOnEnable = true; + + RunningTests = false; + } + + public T AddEventHandler() where T : ScriptableObject, ITestRunnerListener + { + var eventHandler = CreateInstance(); + eventHandler.hideFlags |= HideFlags.DontSave; + m_CallbackObjects.Add(eventHandler); + + AddListeners(eventHandler); + + return eventHandler; + } + + private void AddListeners(ITestRunnerListener eventHandler) + { + m_TestStartedEvent.AddListener(eventHandler.TestStarted); + m_TestFinishedEvent.AddListener(eventHandler.TestFinished); + m_RunStartedEvent.AddListener(eventHandler.RunStarted); + m_RunFinishedEvent.AddListener(eventHandler.RunFinished); + } + + public void Dispose() + { + Reflect.MethodCallWrapper = null; + EditorApplication.update -= TestConsumer; + + DestroyImmediate(this); + + if (m_CallbackObjects != null) + { + foreach (var obj in m_CallbackObjects) + { + DestroyImmediate(obj); + } + m_CallbackObjects.Clear(); + } + RunningTests = false; + EditorApplication.UnlockReloadAssemblies(); + } + + public void OnRunCancel() + { + UnityWorkItemDataHolder.alreadyExecutedTests = null; + m_ExecuteOnEnable = false; + m_Runner.StopRun(); + RunFinished = true; + } + + public ITest GetLoadedTests() + { + return m_Runner.LoadedTest; + } + + public ITestFilter GetFilter() + { + return new OrFilter(m_Filters.Select(filter => filter.BuildNUnitFilter(RunningSynchronously)).ToArray()); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditModeRunner.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditModeRunner.cs.meta new file mode 100644 index 0000000..faf2358 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditModeRunner.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c9219e99d466b7741a057132d1994f35 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditmodeWorkItemFactory.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditmodeWorkItemFactory.cs new file mode 100644 index 0000000..a81fcdc --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditmodeWorkItemFactory.cs @@ -0,0 +1,14 @@ +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using UnityEngine.TestRunner.NUnitExtensions.Runner; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class EditmodeWorkItemFactory : WorkItemFactory + { + protected override UnityWorkItem Create(TestMethod method, ITestFilter filter, ITest loadedTest) + { + return new EditorEnumeratorTestWorkItem(method, filter); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditmodeWorkItemFactory.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditmodeWorkItemFactory.cs.meta new file mode 100644 index 0000000..d775d1f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditmodeWorkItemFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3dde15f260b0dd1469e60d16eaa795dc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditorEnumeratorTestWorkItem.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditorEnumeratorTestWorkItem.cs new file mode 100644 index 0000000..14d12c2 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditorEnumeratorTestWorkItem.cs @@ -0,0 +1,179 @@ +using System; +using System.Collections; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Commands; +using NUnit.Framework.Internal.Execution; +using UnityEngine; +using UnityEngine.TestRunner.NUnitExtensions.Runner; +using UnityEngine.TestTools; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class EditorEnumeratorTestWorkItem : UnityWorkItem + { + private TestCommand m_Command; + + public EditorEnumeratorTestWorkItem(TestMethod test, ITestFilter filter) + : base(test, null) + { + m_Command = TestCommandBuilder.BuildTestCommand(test, filter); + } + + private static IEnumerableTestMethodCommand FindFirstIEnumerableTestMethodCommand(TestCommand command) + { + if (command == null) + { + return null; + } + + if (command is IEnumerableTestMethodCommand) + { + return (IEnumerableTestMethodCommand)command; + } + + if (command is DelegatingTestCommand) + { + var delegatingTestCommand = (DelegatingTestCommand)command; + return FindFirstIEnumerableTestMethodCommand(delegatingTestCommand.GetInnerCommand()); + } + return null; + } + + protected override IEnumerable PerformWork() + { + if (IsCancelledRun()) + { + yield break; + } + + if (m_DontRunRestoringResult) + { + if (EditModeTestCallbacks.RestoringTestContext == null) + { + throw new NullReferenceException("RestoringTestContext is not set"); + } + EditModeTestCallbacks.RestoringTestContext(); + Result = Context.CurrentResult; + yield break; + } + + try + { + if (IsCancelledRun()) + { + yield break; + } + + if (m_Command is SkipCommand) + { + m_Command.Execute(Context); + Result = Context.CurrentResult; + yield break; + } + + //Check if we can execute this test + var firstEnumerableCommand = FindFirstIEnumerableTestMethodCommand(m_Command); + if (firstEnumerableCommand == null) + { + Context.CurrentResult.SetResult(ResultState.Error, "Returning IEnumerator but not using test attribute supporting this"); + yield break; + } + + if (m_Command.Test.Method.ReturnType.IsType(typeof(IEnumerator))) + { + if (m_Command is ApplyChangesToContextCommand) + { + var applyChangesToContextCommand = ((ApplyChangesToContextCommand)m_Command); + applyChangesToContextCommand.ApplyChanges(Context); + m_Command = applyChangesToContextCommand.GetInnerCommand(); + } + + var innerCommand = m_Command as IEnumerableTestMethodCommand; + if (innerCommand == null) + { + Debug.Log("failed getting innerCommand"); + throw new Exception("Tests returning IEnumerator can only use test attributes handling those"); + } + + foreach (var workItemStep in innerCommand.ExecuteEnumerable(Context)) + { + if (IsCancelledRun()) + { + yield break; + } + + if (workItemStep is TestEnumerator) + { + if (EnumeratorStepHelper.UpdateEnumeratorPcIfNeeded(TestEnumerator.Enumerator)) + { + yield return new RestoreTestContextAfterDomainReload(); + } + continue; + } + + if (workItemStep is AsyncOperation) + { + var asyncOperation = (AsyncOperation)workItemStep; + while (!asyncOperation.isDone) + { + if (IsCancelledRun()) + { + yield break; + } + + yield return null; + } + continue; + } + + ResultedInDomainReload = false; + + if (workItemStep is IEditModeTestYieldInstruction) + { + var editModeTestYieldInstruction = (IEditModeTestYieldInstruction)workItemStep; + yield return editModeTestYieldInstruction; + var enumerator = editModeTestYieldInstruction.Perform(); + while (true) + { + bool moveNext; + try + { + moveNext = enumerator.MoveNext(); + } + catch (Exception e) + { + Context.CurrentResult.RecordException(e); + break; + } + + if (!moveNext) + { + break; + } + yield return null; + } + } + else + { + yield return workItemStep; + } + } + + Result = Context.CurrentResult; + EditorApplication.isPlaying = false; + yield return null; + } + } + finally + { + WorkItemComplete(); + } + } + + private bool IsCancelledRun() + { + return Context.ExecutionStatus == TestExecutionStatus.AbortRequested || Context.ExecutionStatus == TestExecutionStatus.StopRequested; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditorEnumeratorTestWorkItem.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditorEnumeratorTestWorkItem.cs.meta new file mode 100644 index 0000000..9007130 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EditorEnumeratorTestWorkItem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1ebc1994f9a3d5649a1201d3a84b38df +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EnumeratorStepHelper.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EnumeratorStepHelper.cs new file mode 100644 index 0000000..0809a6f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EnumeratorStepHelper.cs @@ -0,0 +1,51 @@ +using System.Collections; +using System.Reflection; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class EnumeratorStepHelper + { + private static int m_PC; + + public static void SetEnumeratorPC(int pc) + { + m_PC = pc; + } + + /// + /// Gets the current enumerator PC + /// + /// + /// The PC + /// 0 if no current Enumeration + /// + public static int GetEnumeratorPC(IEnumerator enumerator) + { + if (enumerator == null) + { + return 0; + } + return (int)GetPCFieldInfo(enumerator).GetValue(enumerator); + } + + public static bool UpdateEnumeratorPcIfNeeded(IEnumerator enumerator) + { + if (m_PC > 0) + { + GetPCFieldInfo(enumerator).SetValue(enumerator, m_PC); + m_PC = 0; + return true; + } + return false; + } + + private static FieldInfo GetPCFieldInfo(IEnumerator enumerator) + { + var field = enumerator.GetType().GetField("$PC", BindingFlags.NonPublic | BindingFlags.Instance); + if (field == null) // Roslyn + field = enumerator.GetType().GetField("<>1__state", BindingFlags.NonPublic | BindingFlags.Instance); + + return field; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EnumeratorStepHelper.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EnumeratorStepHelper.cs.meta new file mode 100644 index 0000000..92e993b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/EnumeratorStepHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 901b761c5c1e22d4e8a3ba7d95bc1f5d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages.meta new file mode 100644 index 0000000..64ff2d2 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d9682e749d3efc642af54d789d9090a6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs new file mode 100644 index 0000000..e1ad8c7 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections; +using UnityEditor; + +namespace UnityEngine.TestTools +{ + public class EnterPlayMode : IEditModeTestYieldInstruction + { + public bool ExpectDomainReload { get; } + public bool ExpectedPlaymodeState { get; private set; } + + public EnterPlayMode(bool expectDomainReload = true) + { + ExpectDomainReload = expectDomainReload; + } + + public IEnumerator Perform() + { + if (EditorApplication.isPlaying) + { + throw new Exception("Editor is already in PlayMode"); + } + if (EditorUtility.scriptCompilationFailed) + { + throw new Exception("Script compilation failed"); + } + yield return null; + ExpectedPlaymodeState = true; + + EditorApplication.UnlockReloadAssemblies(); + EditorApplication.isPlaying = true; + + while (!EditorApplication.isPlaying) + { + yield return null; + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs.meta new file mode 100644 index 0000000..f1775e7 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9bd5a110ed89025499ddee8c7e73778e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/ExitPlayMode.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/ExitPlayMode.cs new file mode 100644 index 0000000..85ef889 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/ExitPlayMode.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections; +using UnityEditor; + +namespace UnityEngine.TestTools +{ + public class ExitPlayMode : IEditModeTestYieldInstruction + { + public bool ExpectDomainReload { get; } + public bool ExpectedPlaymodeState { get; private set; } + + public ExitPlayMode() + { + ExpectDomainReload = false; + ExpectedPlaymodeState = false; + } + + public IEnumerator Perform() + { + if (!EditorApplication.isPlayingOrWillChangePlaymode) + { + throw new Exception("Editor is already in EditMode"); + } + + EditorApplication.isPlaying = false; + while (EditorApplication.isPlaying) + { + yield return null; + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/ExitPlayMode.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/ExitPlayMode.cs.meta new file mode 100644 index 0000000..19c058a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/ExitPlayMode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 408674d91d506a54aac9a7f07951c018 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/RecompileScripts.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/RecompileScripts.cs new file mode 100644 index 0000000..96dc8f3 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/RecompileScripts.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections; +using UnityEditor; + +namespace UnityEngine.TestTools +{ + public class RecompileScripts : IEditModeTestYieldInstruction + { + public RecompileScripts() : this(true) + { + } + + public RecompileScripts(bool expectScriptCompilation) : this(expectScriptCompilation, true) + { + } + + public RecompileScripts(bool expectScriptCompilation, bool expectScriptCompilationSuccess) + { + ExpectScriptCompilation = expectScriptCompilation; + ExpectScriptCompilationSuccess = expectScriptCompilationSuccess; + ExpectDomainReload = true; + } + + public bool ExpectDomainReload { get; private set; } + public bool ExpectedPlaymodeState { get; } + public bool ExpectScriptCompilation { get; private set; } + public bool ExpectScriptCompilationSuccess { get; private set; } + public static RecompileScripts Current { get; private set; } + + public IEnumerator Perform() + { + Current = this; + + // We need to yield, to give the test runner a chance to prepare for the domain reload + // If the script compilation happens very fast, then EditModeRunner.MoveNextAndUpdateYieldObject will not have a chance to set m_CurrentYieldObject + // This really should be fixed in EditModeRunner.MoveNextAndUpdateYieldObject + yield return null; + + AssetDatabase.Refresh(); + + if (ExpectScriptCompilation && !EditorApplication.isCompiling) + { + Current = null; + throw new Exception("Editor does not need to recompile scripts"); + } + + EditorApplication.UnlockReloadAssemblies(); + + while (EditorApplication.isCompiling) + { + yield return null; + } + + Current = null; + + if (ExpectScriptCompilationSuccess && EditorUtility.scriptCompilationFailed) + { + EditorApplication.LockReloadAssemblies(); + throw new Exception("Script compilation failed"); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/RecompileScripts.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/RecompileScripts.cs.meta new file mode 100644 index 0000000..07895f3 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/RecompileScripts.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9202fbba95ea8294cb5e718f028f21b0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/WaitForDomainReload.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/WaitForDomainReload.cs new file mode 100644 index 0000000..19920a1 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/WaitForDomainReload.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections; +using UnityEditor; + +namespace UnityEngine.TestTools +{ + public class WaitForDomainReload : IEditModeTestYieldInstruction + { + public WaitForDomainReload() + { + ExpectDomainReload = true; + } + + public bool ExpectDomainReload { get;  } + public bool ExpectedPlaymodeState { get; } + + public IEnumerator Perform() + { + EditorApplication.UnlockReloadAssemblies(); + + // Detect if AssetDatabase.Refresh was called (true) or if it will be called on next tick + bool isAsync = EditorApplication.isCompiling; + + yield return null; + + if (!isAsync) + { + EditorApplication.LockReloadAssemblies(); + throw new Exception("Expected domain reload, but it did not occur"); + } + + while (EditorApplication.isCompiling) + { + yield return null; + } + + if (EditorUtility.scriptCompilationFailed) + { + EditorApplication.LockReloadAssemblies(); + throw new Exception("Script compilation failed"); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/WaitForDomainReload.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/WaitForDomainReload.cs.meta new file mode 100644 index 0000000..b827ea8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/WaitForDomainReload.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5df3c21c5237c994db89660fbdfee07d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils.meta new file mode 100644 index 0000000..9c23303 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1f5bbb88ca730434483440cbc0278ef6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/CachingTestListProvider.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/CachingTestListProvider.cs new file mode 100644 index 0000000..9ec2333 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/CachingTestListProvider.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine.TestRunner.NUnitExtensions; +using UnityEngine.TestTools; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class CachingTestListProvider + { + private readonly ITestListProvider m_InnerTestListProvider; + private readonly ITestListCache m_TestListCache; + private readonly ITestAdaptorFactory m_TestAdaptorFactory; + public CachingTestListProvider(ITestListProvider innerTestListProvider, ITestListCache testListCache, ITestAdaptorFactory testAdaptorFactory) + { + m_InnerTestListProvider = innerTestListProvider; + m_TestListCache = testListCache; + m_TestAdaptorFactory = testAdaptorFactory; + } + + public IEnumerator GetTestListAsync(TestPlatform platform) + { + var testFromCache = m_TestListCache.GetTestFromCacheAsync(platform); + while (testFromCache.MoveNext()) + { + yield return null; + } + + + if (testFromCache.Current != null) + { + yield return testFromCache.Current; + } + else + { + var test = m_InnerTestListProvider.GetTestListAsync(platform); + while (test.MoveNext()) + { + yield return null; + } + + test.Current.ParseForNameDuplicates(); + m_TestListCache.CacheTest(platform, test.Current); + yield return m_TestAdaptorFactory.Create(test.Current); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/CachingTestListProvider.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/CachingTestListProvider.cs.meta new file mode 100644 index 0000000..2a44a64 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/CachingTestListProvider.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 26f3e7301af463c4ca72fa98d59b429e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorAssembliesProxy.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorAssembliesProxy.cs new file mode 100644 index 0000000..ee0e5dc --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorAssembliesProxy.cs @@ -0,0 +1,13 @@ +using System.Linq; +using UnityEngine.TestTools.Utils; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class EditorAssembliesProxy : IEditorAssembliesProxy + { + public IAssemblyWrapper[] loadedAssemblies + { + get { return EditorAssemblies.loadedAssemblies.OrderBy(a => a.FullName).Select(x => new EditorAssemblyWrapper(x)).ToArray(); } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorAssembliesProxy.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorAssembliesProxy.cs.meta new file mode 100644 index 0000000..711a965 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorAssembliesProxy.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f96d0ea807c081145a1170ed1b6d71e0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorAssemblyWrapper.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorAssemblyWrapper.cs new file mode 100644 index 0000000..8a18b12 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorAssemblyWrapper.cs @@ -0,0 +1,18 @@ +using System.Reflection; +using UnityEngine.TestTools.Utils; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class EditorAssemblyWrapper : AssemblyWrapper + { + public EditorAssemblyWrapper(Assembly assembly) + : base(assembly) {} + + public override AssemblyName[] GetReferencedAssemblies() + { + return Assembly.GetReferencedAssemblies(); + } + + public override string Location { get { return Assembly.Location; } } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorAssemblyWrapper.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorAssemblyWrapper.cs.meta new file mode 100644 index 0000000..14a03af --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorAssemblyWrapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 20cdb37e6fea6d946bbb84d2c923db85 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorCompilationInterfaceProxy.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorCompilationInterfaceProxy.cs new file mode 100644 index 0000000..5420719 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorCompilationInterfaceProxy.cs @@ -0,0 +1,17 @@ +using UnityEditor.Scripting.ScriptCompilation; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class EditorCompilationInterfaceProxy : IEditorCompilationInterfaceProxy + { + public ScriptAssembly[] GetAllEditorScriptAssemblies() + { + return EditorCompilationInterface.Instance.GetAllEditorScriptAssemblies(EditorCompilationInterface.GetAdditionalEditorScriptCompilationOptions()); + } + + public PrecompiledAssembly[] GetAllPrecompiledAssemblies() + { + return EditorCompilationInterface.Instance.GetAllPrecompiledAssemblies(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorCompilationInterfaceProxy.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorCompilationInterfaceProxy.cs.meta new file mode 100644 index 0000000..41e354d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorCompilationInterfaceProxy.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c9b23632c77de204abfe8bf7168d48c0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorLoadedTestAssemblyProvider.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorLoadedTestAssemblyProvider.cs new file mode 100644 index 0000000..cffe42d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorLoadedTestAssemblyProvider.cs @@ -0,0 +1,69 @@ +using System.Collections.Generic; +using System.IO; +using System.Linq; +using UnityEditor.Scripting.ScriptCompilation; +using UnityEngine.TestTools; +using UnityEngine.TestTools.Utils; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class EditorLoadedTestAssemblyProvider : IEditorLoadedTestAssemblyProvider + { + private const string k_NunitAssemblyName = "nunit.framework"; + private const string k_TestRunnerAssemblyName = "UnityEngine.TestRunner"; + internal const string k_PerformanceTestingAssemblyName = "Unity.PerformanceTesting"; + + private readonly IEditorAssembliesProxy m_EditorAssembliesProxy; + private readonly ScriptAssembly[] m_AllEditorScriptAssemblies; + private readonly PrecompiledAssembly[] m_AllPrecompiledAssemblies; + + public EditorLoadedTestAssemblyProvider(IEditorCompilationInterfaceProxy compilationInterfaceProxy, IEditorAssembliesProxy editorAssembliesProxy) + { + m_EditorAssembliesProxy = editorAssembliesProxy; + m_AllEditorScriptAssemblies = compilationInterfaceProxy.GetAllEditorScriptAssemblies(); + m_AllPrecompiledAssemblies = compilationInterfaceProxy.GetAllPrecompiledAssemblies(); + } + + public List GetAssembliesGroupedByType(TestPlatform mode) + { + var assemblies = GetAssembliesGroupedByTypeAsync(mode); + while (assemblies.MoveNext()) + { + } + + return assemblies.Current.Where(pair => mode.IsFlagIncluded(pair.Key)).SelectMany(pair => pair.Value).ToList(); + } + + public IEnumerator>> GetAssembliesGroupedByTypeAsync(TestPlatform mode) + { + IAssemblyWrapper[] loadedAssemblies = m_EditorAssembliesProxy.loadedAssemblies; + + IDictionary> result = new Dictionary>() + { + {TestPlatform.EditMode, new List() }, + {TestPlatform.PlayMode, new List() } + }; + + foreach (var loadedAssembly in loadedAssemblies) + { + if (loadedAssembly.GetReferencedAssemblies().Any(x => x.Name == k_NunitAssemblyName || x.Name == k_TestRunnerAssemblyName || x.Name == k_PerformanceTestingAssemblyName)) + { + var assemblyName = new FileInfo(loadedAssembly.Location).Name; + var scriptAssemblies = m_AllEditorScriptAssemblies.Where(x => x.Filename == assemblyName).ToList(); + var precompiledAssemblies = m_AllPrecompiledAssemblies.Where(x => new FileInfo(x.Path).Name == assemblyName).ToList(); + if (scriptAssemblies.Count < 1 && precompiledAssemblies.Count < 1) + { + continue; + } + + var assemblyFlags = scriptAssemblies.Any() ? scriptAssemblies.Single().Flags : precompiledAssemblies.Single().Flags; + var assemblyType = (assemblyFlags & AssemblyFlags.EditorOnly) == AssemblyFlags.EditorOnly ? TestPlatform.EditMode : TestPlatform.PlayMode; + result[assemblyType].Add(loadedAssembly); + yield return null; + } + } + + yield return result; + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorLoadedTestAssemblyProvider.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorLoadedTestAssemblyProvider.cs.meta new file mode 100644 index 0000000..e2634ad --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/EditorLoadedTestAssemblyProvider.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 033c884ba52437d49bc55935939ef1c6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorAssembliesProxy.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorAssembliesProxy.cs new file mode 100644 index 0000000..30dc758 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorAssembliesProxy.cs @@ -0,0 +1,9 @@ +using UnityEngine.TestTools.Utils; + +namespace UnityEditor.TestTools.TestRunner +{ + internal interface IEditorAssembliesProxy + { + IAssemblyWrapper[] loadedAssemblies { get; } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorAssembliesProxy.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorAssembliesProxy.cs.meta new file mode 100644 index 0000000..51988c7 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorAssembliesProxy.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 98808b11e78f6c84a841a6b4bc5a29d2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorCompilationInterfaceProxy.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorCompilationInterfaceProxy.cs new file mode 100644 index 0000000..330e83b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorCompilationInterfaceProxy.cs @@ -0,0 +1,10 @@ +using UnityEditor.Scripting.ScriptCompilation; + +namespace UnityEditor.TestTools.TestRunner +{ + internal interface IEditorCompilationInterfaceProxy + { + ScriptAssembly[] GetAllEditorScriptAssemblies(); + PrecompiledAssembly[] GetAllPrecompiledAssemblies(); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorCompilationInterfaceProxy.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorCompilationInterfaceProxy.cs.meta new file mode 100644 index 0000000..d6a3b78 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorCompilationInterfaceProxy.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 28c8fcb831e6e734a9f564bc4f495eba +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorLoadedTestAssemblyProvider.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorLoadedTestAssemblyProvider.cs new file mode 100644 index 0000000..1e06494 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorLoadedTestAssemblyProvider.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; +using UnityEngine.TestTools; +using UnityEngine.TestTools.Utils; + +namespace UnityEditor.TestTools.TestRunner +{ + internal interface IEditorLoadedTestAssemblyProvider + { + List GetAssembliesGroupedByType(TestPlatform mode); + IEnumerator>> GetAssembliesGroupedByTypeAsync(TestPlatform mode); + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorLoadedTestAssemblyProvider.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorLoadedTestAssemblyProvider.cs.meta new file mode 100644 index 0000000..fa0b20b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/IEditorLoadedTestAssemblyProvider.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 936b6288befc460409cfdff3ac92fc95 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListCache.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListCache.cs new file mode 100644 index 0000000..9d61724 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListCache.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using NUnit.Framework.Interfaces; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine.TestTools; + +namespace UnityEditor.TestTools.TestRunner +{ + interface ITestListCache + { + void CacheTest(TestPlatform platform, ITest test); + IEnumerator GetTestFromCacheAsync(TestPlatform platform); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListCache.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListCache.cs.meta new file mode 100644 index 0000000..6a5a615 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListCache.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a704c010bcdb1ec4a9f3417b3c393164 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListCacheData.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListCacheData.cs new file mode 100644 index 0000000..3aa14e6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListCacheData.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using NUnit.Framework.Interfaces; +using UnityEngine.TestRunner.TestLaunchers; +using UnityEngine.TestTools; + +namespace UnityEditor.TestTools.TestRunner +{ + interface ITestListCacheData + { + List platforms { get; } + List cachedData { get; } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListCacheData.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListCacheData.cs.meta new file mode 100644 index 0000000..fd02cd0 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListCacheData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7043e9a330ac2d84a80a965ada4589ad +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListProvider.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListProvider.cs new file mode 100644 index 0000000..5657aca --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListProvider.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using NUnit.Framework.Interfaces; +using UnityEngine.TestTools; + +namespace UnityEditor.TestTools.TestRunner +{ + interface ITestListProvider + { + IEnumerator GetTestListAsync(TestPlatform platform); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListProvider.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListProvider.cs.meta new file mode 100644 index 0000000..1d84e76 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/ITestListProvider.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 64689f8b25eadac4da519e96f514b653 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListCache.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListCache.cs new file mode 100644 index 0000000..897b6b3 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListCache.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; +using NUnit.Framework.Interfaces; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine.TestRunner.TestLaunchers; +using UnityEngine.TestTools; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class TestListCache : ITestListCache + { + private readonly ITestAdaptorFactory m_TestAdaptorFactory; + private readonly IRemoteTestResultDataFactory m_TestResultDataFactory; + private readonly ITestListCacheData m_TestListCacheData; + + public TestListCache(ITestAdaptorFactory testAdaptorFactory, IRemoteTestResultDataFactory testResultDataFactory, ITestListCacheData testListCacheData) + { + m_TestAdaptorFactory = testAdaptorFactory; + m_TestResultDataFactory = testResultDataFactory; + m_TestListCacheData = testListCacheData; + } + + public void CacheTest(TestPlatform platform, ITest test) + { + var index = m_TestListCacheData.platforms.IndexOf(platform); + if (index < 0) + { + m_TestListCacheData.cachedData.Add(test); + m_TestListCacheData.platforms.Add(platform); + } + else + { + m_TestListCacheData.cachedData[index] = test; + } + } + + public IEnumerator GetTestFromCacheAsync(TestPlatform platform) + { + var index = m_TestListCacheData.platforms.IndexOf(platform); + if (index < 0) + { + yield return null; + yield break; + } + + var testData = m_TestListCacheData.cachedData[index]; + yield return m_TestAdaptorFactory.Create(testData); + } + + [Callbacks.DidReloadScripts] + private static void ScriptReloaded() + { + TestListCacheData.instance.cachedData.Clear(); + TestListCacheData.instance.platforms.Clear(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListCache.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListCache.cs.meta new file mode 100644 index 0000000..fae5fd1 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListCache.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d685d97a1eb004f49afea0cc982ff728 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListCacheData.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListCacheData.cs new file mode 100644 index 0000000..8081b57 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListCacheData.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using NUnit.Framework.Interfaces; +using UnityEngine; +using UnityEngine.TestRunner.TestLaunchers; +using UnityEngine.TestTools; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class TestListCacheData : ScriptableSingleton, ITestListCacheData + { + [SerializeField] + private List m_Platforms = new List(); + + [SerializeField] + private List m_CachedData = new List(); + + public List platforms + { + get { return m_Platforms; } + } + + public List cachedData + { + get { return m_CachedData; } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListCacheData.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListCacheData.cs.meta new file mode 100644 index 0000000..ba5bab6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListCacheData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f1b6399349763114d9361bc6dfcd025b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListJob.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListJob.cs new file mode 100644 index 0000000..1864c78 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListJob.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine.TestTools; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class TestListJob + { + private CachingTestListProvider m_TestListProvider; + private TestPlatform m_Platform; + private Action m_Callback; + private IEnumerator m_ResultEnumerator; + public TestListJob(CachingTestListProvider testListProvider, TestPlatform platform, Action callback) + { + m_TestListProvider = testListProvider; + m_Platform = platform; + m_Callback = callback; + } + + public void Start() + { + m_ResultEnumerator = m_TestListProvider.GetTestListAsync(m_Platform); + EditorApplication.update += EditorUpdate; + } + + private void EditorUpdate() + { + if (!m_ResultEnumerator.MoveNext()) + { + m_Callback(m_ResultEnumerator.Current); + EditorApplication.update -= EditorUpdate; + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListJob.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListJob.cs.meta new file mode 100644 index 0000000..38f8af8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListJob.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dec9066d4afefe444be0dad3f137730d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListProvider.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListProvider.cs new file mode 100644 index 0000000..e1402a6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListProvider.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework.Interfaces; +using UnityEngine.TestTools; +using UnityEngine.TestTools.NUnitExtensions; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class TestListProvider : ITestListProvider + { + private readonly EditorLoadedTestAssemblyProvider m_AssemblyProvider; + private readonly UnityTestAssemblyBuilder m_AssemblyBuilder; + + public TestListProvider(EditorLoadedTestAssemblyProvider assemblyProvider, UnityTestAssemblyBuilder assemblyBuilder) + { + m_AssemblyProvider = assemblyProvider; + m_AssemblyBuilder = assemblyBuilder; + } + + public IEnumerator GetTestListAsync(TestPlatform platform) + { + var assembliesTask = m_AssemblyProvider.GetAssembliesGroupedByTypeAsync(platform); + while (assembliesTask.MoveNext()) + { + yield return null; + } + + var assemblies = assembliesTask.Current.Where(pair => platform.IsFlagIncluded(pair.Key)) + .SelectMany(pair => pair.Value.Select(assemblyInfo => Tuple.Create(assemblyInfo.Assembly, pair.Key))).ToArray(); + + var settings = UnityTestAssemblyBuilder.GetNUnitTestBuilderSettings(platform); + var test = m_AssemblyBuilder.BuildAsync(assemblies.Select(a => a.Item1).ToArray(), assemblies.Select(a => a.Item2).ToArray(), settings); + while (test.MoveNext()) + { + yield return null; + } + + yield return test.Current; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListProvider.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListProvider.cs.meta new file mode 100644 index 0000000..975a1a3 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Utils/TestListProvider.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f15cbb987069826429540d0ea0937442 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunnerWindow.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunnerWindow.cs new file mode 100644 index 0000000..45eab30 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunnerWindow.cs @@ -0,0 +1,263 @@ +using System; +using UnityEditor.Callbacks; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEditor.TestTools.TestRunner.GUI; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner +{ + [Serializable] + internal class TestRunnerWindow : EditorWindow, IHasCustomMenu + { + internal static class Styles + { + public static GUIStyle info; + public static GUIStyle testList; + + static Styles() + { + info = new GUIStyle(EditorStyles.wordWrappedLabel); + info.wordWrap = false; + info.stretchHeight = true; + info.margin.right = 15; + + testList = new GUIStyle("CN Box"); + testList.margin.top = 0; + testList.padding.left = 3; + } + } + + private readonly GUIContent m_GUIHorizontalSplit = EditorGUIUtility.TrTextContent("Horizontal layout"); + private readonly GUIContent m_GUIVerticalSplit = EditorGUIUtility.TrTextContent("Vertical layout"); + private readonly GUIContent m_GUIEnableaPlaymodeTestsRunner = EditorGUIUtility.TrTextContent("Enable playmode tests for all assemblies"); + private readonly GUIContent m_GUIDisablePlaymodeTestsRunner = EditorGUIUtility.TrTextContent("Disable playmode tests for all assemblies"); + private readonly GUIContent m_GUIRunPlayModeTestAsEditModeTests = EditorGUIUtility.TrTextContent("Run playmode tests as editmode tests"); + + internal static TestRunnerWindow s_Instance; + private bool m_IsBuilding; + [NonSerialized] + private bool m_Enabled; + public TestFilterSettings filterSettings; + + [SerializeField] + private SplitterState m_Spl = new SplitterState(new float[] { 75, 25 }, new[] { 32, 32 }, null); + + private TestRunnerWindowSettings m_Settings; + + private enum TestRunnerMenuLabels + { + PlayMode = 0, + EditMode = 1 + } + [SerializeField] + private int m_TestTypeToolbarIndex = (int)TestRunnerMenuLabels.EditMode; + [SerializeField] + private PlayModeTestListGUI m_PlayModeTestListGUI; + [SerializeField] + private EditModeTestListGUI m_EditModeTestListGUI; + + internal TestListGUI m_SelectedTestTypes; + + private ITestRunnerApi m_testRunnerApi; + + private WindowResultUpdater m_WindowResultUpdater; + + [MenuItem("Window/General/Test Runner", false, 201, false)] + public static void ShowPlaymodeTestsRunnerWindowCodeBased() + { + s_Instance = GetWindow("Test Runner"); + s_Instance.Show(); + } + + static TestRunnerWindow() + { + InitBackgroundRunners(); + } + + private static void InitBackgroundRunners() + { + EditorApplication.playModeStateChanged -= OnPlayModeStateChanged; + EditorApplication.playModeStateChanged += OnPlayModeStateChanged; + } + + [DidReloadScripts] + private static void CompilationCallback() + { + UpdateWindow(); + } + + private static void OnPlayModeStateChanged(PlayModeStateChange state) + { + if (s_Instance && state == PlayModeStateChange.EnteredEditMode && s_Instance.m_SelectedTestTypes.HasTreeData()) + { + //repaint message details after exit playmode + s_Instance.m_SelectedTestTypes.TestSelectionCallback(s_Instance.m_SelectedTestTypes.m_TestListState.selectedIDs.ToArray()); + s_Instance.Repaint(); + } + } + + public void OnDestroy() + { + EditorApplication.playModeStateChanged -= OnPlayModeStateChanged; + if (m_testRunnerApi != null) + { + m_testRunnerApi.UnregisterCallbacks(m_WindowResultUpdater); + } + } + + private void OnEnable() + { + s_Instance = this; + SelectTestListGUI(m_TestTypeToolbarIndex); + + m_testRunnerApi = ScriptableObject.CreateInstance(); + m_WindowResultUpdater = new WindowResultUpdater(); + m_testRunnerApi.RegisterCallbacks(m_WindowResultUpdater); + } + + private void Enable() + { + m_Settings = new TestRunnerWindowSettings("UnityEditor.PlaymodeTestsRunnerWindow"); + filterSettings = new TestFilterSettings("UnityTest.IntegrationTestsRunnerWindow"); + + if (m_SelectedTestTypes == null) + { + SelectTestListGUI(m_TestTypeToolbarIndex); + } + + StartRetrieveTestList(); + m_SelectedTestTypes.Reload(); + m_Enabled = true; + } + + private void SelectTestListGUI(int testTypeToolbarIndex) + { + if (testTypeToolbarIndex == (int)TestRunnerMenuLabels.PlayMode) + { + if (m_PlayModeTestListGUI == null) + { + m_PlayModeTestListGUI = new PlayModeTestListGUI(); + } + m_SelectedTestTypes = m_PlayModeTestListGUI; + } + else if (testTypeToolbarIndex == (int)TestRunnerMenuLabels.EditMode) + { + if (m_EditModeTestListGUI == null) + { + m_EditModeTestListGUI = new EditModeTestListGUI(); + } + m_SelectedTestTypes = m_EditModeTestListGUI; + } + } + + private void StartRetrieveTestList() + { + if (!m_SelectedTestTypes.HasTreeData()) + { + m_testRunnerApi.RetrieveTestList(m_SelectedTestTypes.TestMode, (rootTest) => + { + m_SelectedTestTypes.Init(this, rootTest); + m_SelectedTestTypes.Reload(); + }); + } + } + + public void OnGUI() + { + if (!m_Enabled) + { + Enable(); + } + + if (BuildPipeline.isBuildingPlayer) + { + m_IsBuilding = true; + } + else if (m_IsBuilding) + { + m_IsBuilding = false; + Repaint(); + } + + EditorGUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + var selectedIndex = m_TestTypeToolbarIndex; + m_TestTypeToolbarIndex = GUILayout.Toolbar(m_TestTypeToolbarIndex, Enum.GetNames(typeof(TestRunnerMenuLabels)), "LargeButton", UnityEngine.GUI.ToolbarButtonSize.FitToContents); + GUILayout.FlexibleSpace(); + EditorGUILayout.EndHorizontal(); + + if (selectedIndex != m_TestTypeToolbarIndex) + { + SelectTestListGUI(m_TestTypeToolbarIndex); + StartRetrieveTestList(); + } + + EditorGUILayout.BeginVertical(); + using (new EditorGUI.DisabledScope(EditorApplication.isPlayingOrWillChangePlaymode)) + { + m_SelectedTestTypes.PrintHeadPanel(); + } + EditorGUILayout.EndVertical(); + + if (m_Settings.verticalSplit) + SplitterGUILayout.BeginVerticalSplit(m_Spl); + else + SplitterGUILayout.BeginHorizontalSplit(m_Spl); + + EditorGUILayout.BeginVertical(); + EditorGUILayout.BeginVertical(Styles.testList); + m_SelectedTestTypes.RenderTestList(); + EditorGUILayout.EndVertical(); + EditorGUILayout.EndVertical(); + + m_SelectedTestTypes.RenderDetails(); + + if (m_Settings.verticalSplit) + SplitterGUILayout.EndVerticalSplit(); + else + SplitterGUILayout.EndHorizontalSplit(); + } + + public void AddItemsToMenu(GenericMenu menu) + { + menu.AddItem(m_GUIVerticalSplit, m_Settings.verticalSplit, m_Settings.ToggleVerticalSplit); + menu.AddItem(m_GUIHorizontalSplit, !m_Settings.verticalSplit, m_Settings.ToggleVerticalSplit); + + menu.AddSeparator(null); + + var playModeTestRunnerEnabled = PlayerSettings.playModeTestRunnerEnabled; + var currentActive = playModeTestRunnerEnabled ? m_GUIDisablePlaymodeTestsRunner : m_GUIEnableaPlaymodeTestsRunner; + + if (EditorPrefs.GetBool("InternalMode", false)) + { + menu.AddItem(m_GUIRunPlayModeTestAsEditModeTests, PlayerSettings.runPlayModeTestAsEditModeTest, () => + { + PlayerSettings.runPlayModeTestAsEditModeTest = !PlayerSettings.runPlayModeTestAsEditModeTest; + }); + } + + menu.AddItem(currentActive, false, () => + { + PlayerSettings.playModeTestRunnerEnabled = !playModeTestRunnerEnabled; + EditorUtility.DisplayDialog(currentActive.text, "You need to restart the editor now", "Ok"); + }); + } + + public void RebuildUIFilter() + { + if (m_SelectedTestTypes != null && m_SelectedTestTypes.HasTreeData()) + { + m_SelectedTestTypes.RebuildUIFilter(); + } + } + + public static void UpdateWindow() + { + if (s_Instance != null && s_Instance.m_SelectedTestTypes != null) + { + s_Instance.m_SelectedTestTypes.Repaint(); + s_Instance.Repaint(); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunnerWindow.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunnerWindow.cs.meta new file mode 100644 index 0000000..d4c89a5 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunnerWindow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4dfcd3a631f61d248b7cc0b845d40345 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunnerWindowSettings.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunnerWindowSettings.cs new file mode 100644 index 0000000..2a52354 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunnerWindowSettings.cs @@ -0,0 +1,26 @@ +namespace UnityEditor.TestTools.TestRunner +{ + internal class TestRunnerWindowSettings + { + public bool verticalSplit; + + private readonly string m_PrefsKey; + + public TestRunnerWindowSettings(string prefsKey) + { + m_PrefsKey = prefsKey; + verticalSplit = EditorPrefs.GetBool(m_PrefsKey + ".verticalSplit", true); + } + + public void ToggleVerticalSplit() + { + verticalSplit = !verticalSplit; + Save(); + } + + private void Save() + { + EditorPrefs.SetBool(m_PrefsKey + ".verticalSplit", verticalSplit); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunnerWindowSettings.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunnerWindowSettings.cs.meta new file mode 100644 index 0000000..24a596d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunnerWindowSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2b301b727225f1941974d69e61a55620 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings.meta new file mode 100644 index 0000000..002779a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 95b719082a664ea45bb56759eed1f271 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/ITestSettings.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/ITestSettings.cs new file mode 100644 index 0000000..f5b97a4 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/ITestSettings.cs @@ -0,0 +1,22 @@ +using System; + +namespace UnityEditor.TestTools.TestRunner +{ + internal interface ITestSettings : IDisposable + { + ScriptingImplementation? scriptingBackend { get; set; } + + string Architecture { get; set; } + + ApiCompatibilityLevel? apiProfile { get; set; } + + bool? appleEnableAutomaticSigning { get; set; } + string appleDeveloperTeamID { get; set; } + ProvisioningProfileType? iOSManualProvisioningProfileType { get; set; } + string iOSManualProvisioningProfileID { get; set; } + ProvisioningProfileType? tvOSManualProvisioningProfileType { get; set; } + string tvOSManualProvisioningProfileID { get; set; } + + void SetupProjectParameters(); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/ITestSettings.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/ITestSettings.cs.meta new file mode 100644 index 0000000..bcdad73 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/ITestSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 83eda34b7da01e04aa894f268158b0c0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/ITestSettingsDeserializer.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/ITestSettingsDeserializer.cs new file mode 100644 index 0000000..ac3845e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/ITestSettingsDeserializer.cs @@ -0,0 +1,7 @@ +namespace UnityEditor.TestTools.TestRunner +{ + interface ITestSettingsDeserializer + { + ITestSettings GetSettingsFromJsonFile(string jsonFilePath); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/ITestSettingsDeserializer.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/ITestSettingsDeserializer.cs.meta new file mode 100644 index 0000000..57ca510 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/ITestSettingsDeserializer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d208a1684f8aa6a40ad91d6aa9600c14 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/TestSettings.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/TestSettings.cs new file mode 100644 index 0000000..6964d22 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/TestSettings.cs @@ -0,0 +1,160 @@ +using System; + +namespace UnityEditor.TestTools.TestRunner +{ + internal class TestSettings : ITestSettings + { + private readonly TestSetting[] m_Settings = + { + new TestSetting( + settings => settings.scriptingBackend, + () => PlayerSettings.GetScriptingBackend(EditorUserBuildSettings.activeBuildTargetGroup), + implementation => PlayerSettings.SetScriptingBackend(EditorUserBuildSettings.activeBuildTargetGroup, implementation.Value)), + new TestSetting( + settings => settings.Architecture, + () => EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android ? PlayerSettings.Android.targetArchitectures.ToString() : null, + architecture => + { + if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android) + { + if (!string.IsNullOrEmpty(architecture)) + { + var targetArchitectures = (AndroidArchitecture)Enum.Parse(typeof(AndroidArchitecture), architecture, true); + PlayerSettings.Android.targetArchitectures = targetArchitectures; + } + } + }), + new TestSetting( + settings => settings.apiProfile, + () => PlayerSettings.GetApiCompatibilityLevel(EditorUserBuildSettings.activeBuildTargetGroup), + implementation => + { + if (Enum.IsDefined(typeof(ApiCompatibilityLevel), implementation.Value)) + { + PlayerSettings.SetApiCompatibilityLevel(EditorUserBuildSettings.activeBuildTargetGroup, + implementation.Value); + } + }), + new TestSetting( + settings => settings.appleEnableAutomaticSigning, + () => PlayerSettings.iOS.appleEnableAutomaticSigning, + enableAutomaticSigning => + { + if (enableAutomaticSigning != null) + PlayerSettings.iOS.appleEnableAutomaticSigning = enableAutomaticSigning.Value; + }), + new TestSetting( + settings => settings.appleDeveloperTeamID, + () => PlayerSettings.iOS.appleDeveloperTeamID, + developerTeam => + { + if (developerTeam != null) + PlayerSettings.iOS.appleDeveloperTeamID = developerTeam; + }), + new TestSetting( + settings => settings.iOSManualProvisioningProfileType, + () => PlayerSettings.iOS.iOSManualProvisioningProfileType, + profileType => + { + if (profileType != null) + PlayerSettings.iOS.iOSManualProvisioningProfileType = profileType.Value; + }), + new TestSetting( + settings => settings.iOSManualProvisioningProfileID, + () => PlayerSettings.iOS.iOSManualProvisioningProfileID, + provisioningUUID => + { + if (provisioningUUID != null) + PlayerSettings.iOS.iOSManualProvisioningProfileID = provisioningUUID; + }), + new TestSetting( + settings => settings.tvOSManualProvisioningProfileType, + () => PlayerSettings.iOS.tvOSManualProvisioningProfileType, + profileType => + { + if (profileType != null) + PlayerSettings.iOS.tvOSManualProvisioningProfileType = profileType.Value; + }), + new TestSetting( + settings => settings.tvOSManualProvisioningProfileID, + () => PlayerSettings.iOS.tvOSManualProvisioningProfileID, + provisioningUUID => + { + if (provisioningUUID != null) + PlayerSettings.iOS.tvOSManualProvisioningProfileID = provisioningUUID; + }), + }; + + private bool m_Disposed; + + public ScriptingImplementation? scriptingBackend { get; set; } + + public string Architecture { get; set; } + + public ApiCompatibilityLevel? apiProfile { get; set; } + + public bool? appleEnableAutomaticSigning { get; set; } + public string appleDeveloperTeamID { get; set; } + public ProvisioningProfileType? iOSManualProvisioningProfileType { get; set; } + public string iOSManualProvisioningProfileID { get; set; } + public ProvisioningProfileType? tvOSManualProvisioningProfileType { get; set; } + public string tvOSManualProvisioningProfileID { get; set; } + + public void Dispose() + { + if (!m_Disposed) + { + foreach (var testSetting in m_Settings) + { + testSetting.Cleanup(); + } + + m_Disposed = true; + } + } + + public void SetupProjectParameters() + { + foreach (var testSetting in m_Settings) + { + testSetting.Setup(this); + } + } + + private abstract class TestSetting + { + public abstract void Setup(TestSettings settings); + public abstract void Cleanup(); + } + + private class TestSetting : TestSetting + { + private T m_ValueBeforeSetup; + private Func m_GetFromSettings; + private Func m_GetCurrentValue; + private Action m_SetValue; + + public TestSetting(Func getFromSettings, Func getCurrentValue, Action setValue) + { + m_GetFromSettings = getFromSettings; + m_GetCurrentValue = getCurrentValue; + m_SetValue = setValue; + } + + public override void Setup(TestSettings settings) + { + m_ValueBeforeSetup = m_GetCurrentValue(); + var newValue = m_GetFromSettings(settings); + if (newValue != null) + { + m_SetValue(newValue); + } + } + + public override void Cleanup() + { + m_SetValue(m_ValueBeforeSetup); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/TestSettings.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/TestSettings.cs.meta new file mode 100644 index 0000000..37a7522 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/TestSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6b32b6725087a0d4bb1670818d26996e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/TestSettingsDeserializer.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/TestSettingsDeserializer.cs new file mode 100644 index 0000000..c59ec57 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/TestSettingsDeserializer.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner +{ + /// + /// Handles deserialization of TestSettings from a provided json file path. + /// + internal class TestSettingsDeserializer : ITestSettingsDeserializer + { + private static readonly SettingsMap[] s_SettingsMapping = + { + new SettingsMap("scriptingBackend", (settings, value) => settings.scriptingBackend = value), + new SettingsMap("architecture", (settings, value) => settings.Architecture = value), + new SettingsMap("apiProfile", (settings, value) => settings.apiProfile = value), + new SettingsMap("appleEnableAutomaticSigning", (settings, value) => settings.appleEnableAutomaticSigning = value), + new SettingsMap("appleDeveloperTeamID", (settings, value) => settings.appleDeveloperTeamID = value), + new SettingsMap("iOSManualProvisioningProfileType", (settings, value) => settings.iOSManualProvisioningProfileType = value), + new SettingsMap("iOSManualProvisioningProfileID", (settings, value) => settings.iOSManualProvisioningProfileID = value), + new SettingsMap("tvOSManualProvisioningProfileType", (settings, value) => settings.tvOSManualProvisioningProfileType = value), + new SettingsMap("tvOSManualProvisioningProfileID", (settings, value) => settings.tvOSManualProvisioningProfileID = value), + }; + + private readonly Func m_TestSettingsFactory; + public TestSettingsDeserializer(Func testSettingsFactory) + { + m_TestSettingsFactory = testSettingsFactory; + } + + public ITestSettings GetSettingsFromJsonFile(string jsonFilePath) + { + var text = File.ReadAllText(jsonFilePath); + var settingsDictionary = Json.Deserialize(text) as Dictionary; + + var testSettings = m_TestSettingsFactory(); + if (settingsDictionary == null) + { + return testSettings; + } + + foreach (var settingsMap in s_SettingsMapping) + { + if (!settingsDictionary.ContainsKey(settingsMap.Key)) + { + continue; + } + + if (settingsMap.Type.IsEnum) + { + SetEnumValue(settingsMap.Key, settingsDictionary[settingsMap.Key], settingsMap.Type, value => settingsMap.ApplyToSettings(testSettings, value)); + } + else + { + SetValue(settingsMap.Key, settingsDictionary[settingsMap.Key], settingsMap.Type, value => settingsMap.ApplyToSettings(testSettings, value)); + } + } + + return testSettings; + } + + private abstract class SettingsMap + { + public string Key { get; } + public Type Type { get; } + protected SettingsMap(string key, Type type) + { + Key = key; + Type = type; + } + + public abstract void ApplyToSettings(ITestSettings settings, object value); + } + + private class SettingsMap : SettingsMap + { + private Action m_Setter; + public SettingsMap(string key, Action setter) : base(key, typeof(T)) + { + m_Setter = setter; + } + + public override void ApplyToSettings(ITestSettings settings, object value) + { + m_Setter(settings, (T)value); + } + } + + private static void SetEnumValue(string key, object value, Type type, Action setter) + { + object enumValue; + if (TryGetEnum(value as string, type, out enumValue)) + { + setter(enumValue); + return; + } + + var acceptedValues = string.Join(", ", Enum.GetValues(type).OfType().Select(val => val.ToString()).ToArray()); + + Debug.LogFormat("Could not convert '{0}' argument '{1}' to a valid {2}. Accepted values: {3}.", key, value, type.Name, acceptedValues); + } + + private static bool TryGetEnum(string value, Type type, out object enumValue) + { + try + { + enumValue = Enum.Parse(type, value, true); + return true; + } + catch (Exception) + { + enumValue = null; + return false; + } + } + + private static void SetValue(string key, object value, Type type, Action setter) + { + if (type.IsInstanceOfType(value)) + { + setter(value); + return; + } + + Debug.LogFormat("Could not convert '{0}' argument '{1}' to a valid {2}.", key, value, type.Name); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/TestSettingsDeserializer.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/TestSettingsDeserializer.cs.meta new file mode 100644 index 0000000..decd785 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestSettings/TestSettingsDeserializer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 75e7d7a9a57458841a85fe42d9c9141f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityEditor.TestRunner.asmdef b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityEditor.TestRunner.asmdef new file mode 100644 index 0000000..f28e7e1 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityEditor.TestRunner.asmdef @@ -0,0 +1,21 @@ +{ + "name": "UnityEditor.TestRunner", + "references": [ + "UnityEngine.TestRunner" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll", + "Mono.Cecil.dll", + "Mono.Cecil.Pdb.dll", + "Mono.Cecil.Mdb.dll", + "Mono.Cecil.Rocks.dll" + ], + "autoReferenced": false, + "defineConstraints": [] +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityEditor.TestRunner.asmdef.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityEditor.TestRunner.asmdef.meta new file mode 100644 index 0000000..452d7bb --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityEditor.TestRunner.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0acc523941302664db1f4e527237feb3 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol.meta new file mode 100644 index 0000000..cdf1813 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 936c6340f3468444ebb1785b4c311126 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/AssemblyCompilationErrorsMessage.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/AssemblyCompilationErrorsMessage.cs new file mode 100644 index 0000000..8ed6b3c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/AssemblyCompilationErrorsMessage.cs @@ -0,0 +1,13 @@ +namespace UnityEditor.TestTools.TestRunner.UnityTestProtocol +{ + internal class AssemblyCompilationErrorsMessage : Message + { + public string assembly; + public string[] errors; + + public AssemblyCompilationErrorsMessage() + { + type = "AssemblyCompilationErrors"; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/AssemblyCompilationErrorsMessage.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/AssemblyCompilationErrorsMessage.cs.meta new file mode 100644 index 0000000..8c0fea1 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/AssemblyCompilationErrorsMessage.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c346a7445959bba46a96de0747e77c2a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/ITestRunnerApiMapper.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/ITestRunnerApiMapper.cs new file mode 100644 index 0000000..231fe4b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/ITestRunnerApiMapper.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using UnityEditor.TestTools.TestRunner.Api; + +namespace UnityEditor.TestTools.TestRunner.UnityTestProtocol +{ + interface ITestRunnerApiMapper + { + string GetRunStateFromResultNunitXml(ITestResultAdaptor result); + TestState GetTestStateFromResult(ITestResultAdaptor result); + List FlattenTestNames(ITestAdaptor testsToRun); + TestPlanMessage MapTestToTestPlanMessage(ITestAdaptor testsToRun); + TestStartedMessage MapTestToTestStartedMessage(ITestAdaptor test); + TestFinishedMessage TestResultToTestFinishedMessage(ITestResultAdaptor result); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/ITestRunnerApiMapper.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/ITestRunnerApiMapper.cs.meta new file mode 100644 index 0000000..af6635c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/ITestRunnerApiMapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6de79ae237e51554da96fd28f68b66a6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/IUtpLogger.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/IUtpLogger.cs new file mode 100644 index 0000000..4d7fb71 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/IUtpLogger.cs @@ -0,0 +1,7 @@ +namespace UnityEditor.TestTools.TestRunner.UnityTestProtocol +{ + interface IUtpLogger + { + void Log(Message msg); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/IUtpLogger.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/IUtpLogger.cs.meta new file mode 100644 index 0000000..82b7277 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/IUtpLogger.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9014630255533ed42915965b4065cde8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/IUtpMessageReporter.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/IUtpMessageReporter.cs new file mode 100644 index 0000000..c134615 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/IUtpMessageReporter.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; +using UnityEditor.Compilation; +using UnityEditor.TestTools.TestRunner.Api; + +namespace UnityEditor.TestTools.TestRunner.UnityTestProtocol +{ + internal interface IUtpMessageReporter + { + void ReportAssemblyCompilationErrors(string assembly, IEnumerable errorCompilerMessages); + void ReportTestFinished(ITestResultAdaptor result); + void ReportTestRunStarted(ITestAdaptor testsToRun); + void ReportTestStarted(ITestAdaptor test); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/IUtpMessageReporter.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/IUtpMessageReporter.cs.meta new file mode 100644 index 0000000..d966c9a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/IUtpMessageReporter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 952b3dc7b47846947b37c8d3ae46579a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/Message.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/Message.cs new file mode 100644 index 0000000..a654b7e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/Message.cs @@ -0,0 +1,29 @@ +using System; +using System.Diagnostics; + +namespace UnityEditor.TestTools.TestRunner.UnityTestProtocol +{ + [Serializable] + internal abstract class Message + { + public string type; + // Milliseconds since unix epoch + public ulong time; + public int version; + public string phase; + public int processId; + + protected Message() + { + version = 2; + phase = "Immediate"; + processId = Process.GetCurrentProcess().Id; + AddTimeStamp(); + } + + public void AddTimeStamp() + { + time = Convert.ToUInt64((DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalMilliseconds); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/Message.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/Message.cs.meta new file mode 100644 index 0000000..6f55024 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/Message.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 321dc2c0720f8dd4f9396ecdc12b8746 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestFinishedMessage.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestFinishedMessage.cs new file mode 100644 index 0000000..63d7daf --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestFinishedMessage.cs @@ -0,0 +1,18 @@ +namespace UnityEditor.TestTools.TestRunner.UnityTestProtocol +{ + internal class TestFinishedMessage : Message + { + public string name; + public TestState state; + public string message; + public ulong duration; // milliseconds + public ulong durationMicroseconds; + public string stackTrace; + + public TestFinishedMessage() + { + type = "TestStatus"; + phase = "End"; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestFinishedMessage.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestFinishedMessage.cs.meta new file mode 100644 index 0000000..581ee84 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestFinishedMessage.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 423fe2ef878fa1140a7e1f7f9e365815 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestPlanMessage.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestPlanMessage.cs new file mode 100644 index 0000000..7e4ea41 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestPlanMessage.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; + +namespace UnityEditor.TestTools.TestRunner.UnityTestProtocol +{ + internal class TestPlanMessage : Message + { + public List tests; + + public TestPlanMessage() + { + type = "TestPlan"; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestPlanMessage.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestPlanMessage.cs.meta new file mode 100644 index 0000000..5dcc09d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestPlanMessage.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 28f79a0d7e64c2345bc46f8c4cf788f8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestRunnerApiMapper.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestRunnerApiMapper.cs new file mode 100644 index 0000000..494646f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestRunnerApiMapper.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml; +using UnityEditor.TestTools.TestRunner.Api; + +namespace UnityEditor.TestTools.TestRunner.UnityTestProtocol +{ + internal class TestRunnerApiMapper : ITestRunnerApiMapper + { + public TestPlanMessage MapTestToTestPlanMessage(ITestAdaptor testsToRun) + { + var testsNames = testsToRun != null ? FlattenTestNames(testsToRun) : new List(); + + var msg = new TestPlanMessage + { + tests = testsNames + }; + + return msg; + } + + public TestStartedMessage MapTestToTestStartedMessage(ITestAdaptor test) + { + return new TestStartedMessage + { + name = test.FullName + }; + } + + public TestFinishedMessage TestResultToTestFinishedMessage(ITestResultAdaptor result) + { + return new TestFinishedMessage + { + name = result.Test.FullName, + duration = Convert.ToUInt64(result.Duration * 1000), + durationMicroseconds = Convert.ToUInt64(result.Duration * 1000000), + message = result.Message, + state = GetTestStateFromResult(result), + stackTrace = result.StackTrace + }; + } + + public string GetRunStateFromResultNunitXml(ITestResultAdaptor result) + { + var doc = new XmlDocument(); + doc.LoadXml(result.ToXml().OuterXml); + return doc.FirstChild.Attributes["runstate"].Value; + } + + public TestState GetTestStateFromResult(ITestResultAdaptor result) + { + var state = TestState.Failure; + + if (result.TestStatus == TestStatus.Passed) + { + state = TestState.Success; + + var runstate = GetRunStateFromResultNunitXml(result); + runstate = runstate ?? String.Empty; + + if (runstate.ToLowerInvariant().Equals("explicit")) + state = TestState.Skipped; + } + else if (result.TestStatus == TestStatus.Skipped) + { + state = TestState.Skipped; + + if (result.ResultState.ToLowerInvariant().EndsWith("ignored")) + state = TestState.Ignored; + } + else + { + if (result.ResultState.ToLowerInvariant().Equals("inconclusive")) + state = TestState.Inconclusive; + + if (result.ResultState.ToLowerInvariant().EndsWith("cancelled") || + result.ResultState.ToLowerInvariant().EndsWith("error")) + state = TestState.Error; + } + + return state; + } + + public List FlattenTestNames(ITestAdaptor test) + { + var results = new List(); + + if (!test.IsSuite) + results.Add(test.FullName); + + if (test.Children != null && test.Children.Any()) + foreach (var child in test.Children) + results.AddRange(FlattenTestNames(child)); + + return results; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestRunnerApiMapper.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestRunnerApiMapper.cs.meta new file mode 100644 index 0000000..619f384 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestRunnerApiMapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2011a59d3f76b3d4a85cb53f945fceee +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestStartedMessage.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestStartedMessage.cs new file mode 100644 index 0000000..7a878a6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestStartedMessage.cs @@ -0,0 +1,15 @@ +namespace UnityEditor.TestTools.TestRunner.UnityTestProtocol +{ + internal class TestStartedMessage : Message + { + public string name; + public TestState state; + + public TestStartedMessage() + { + type = "TestStatus"; + phase = "Begin"; + state = TestState.Inconclusive; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestStartedMessage.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestStartedMessage.cs.meta new file mode 100644 index 0000000..28492e7 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestStartedMessage.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bd3e81baa10021f4d877fa36382bab16 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestState.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestState.cs new file mode 100644 index 0000000..111813a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestState.cs @@ -0,0 +1,13 @@ +namespace UnityEditor.TestTools.TestRunner.UnityTestProtocol +{ + // This matches the state definitions expected by the Perl code, which in turn matches the NUnit 2 values... + internal enum TestState + { + Inconclusive = 0, + Skipped = 2, + Ignored = 3, + Success = 4, + Failure = 5, + Error = 6 + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestState.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestState.cs.meta new file mode 100644 index 0000000..125e419 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/TestState.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 77f432980bb30084299a138e15c6f571 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UnityTestProtocolListener.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UnityTestProtocolListener.cs new file mode 100644 index 0000000..8ba3d7f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UnityTestProtocolListener.cs @@ -0,0 +1,35 @@ +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner.UnityTestProtocol +{ + internal class UnityTestProtocolListener : ScriptableObject, ICallbacks + { + private IUtpMessageReporter m_UtpMessageReporter; + + public UnityTestProtocolListener() + { + m_UtpMessageReporter = new UtpMessageReporter(new UtpDebugLogger()); + } + + public void RunStarted(ITestAdaptor testsToRun) + { + m_UtpMessageReporter.ReportTestRunStarted(testsToRun); + } + + public void RunFinished(ITestResultAdaptor testResults) + { + // Apparently does nothing :) + } + + public void TestStarted(ITestAdaptor test) + { + m_UtpMessageReporter.ReportTestStarted(test); + } + + public void TestFinished(ITestResultAdaptor result) + { + m_UtpMessageReporter.ReportTestFinished(result); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UnityTestProtocolListener.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UnityTestProtocolListener.cs.meta new file mode 100644 index 0000000..e369442 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UnityTestProtocolListener.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 900aac3710bc14542a8d164e3f0ff820 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UnityTestProtocolStarter.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UnityTestProtocolStarter.cs new file mode 100644 index 0000000..8d16ca5 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UnityTestProtocolStarter.cs @@ -0,0 +1,37 @@ +using System; +using System.Linq; +using UnityEditor.Compilation; +using UnityEditor.TestTools.TestRunner.Api; +using UnityEngine; +using UnityEngine.TestTools; + +namespace UnityEditor.TestTools.TestRunner.UnityTestProtocol +{ + [InitializeOnLoad] + internal static class UnityTestProtocolStarter + { + static UnityTestProtocolStarter() + { + var commandLineArgs = Environment.GetCommandLineArgs(); + if (commandLineArgs.Contains("-automated") && commandLineArgs.Contains("-runTests")) // wanna have it only for utr run + { + var api = ScriptableObject.CreateInstance(); + var listener = ScriptableObject.CreateInstance(); + api.RegisterCallbacks(listener); + CompilationPipeline.assemblyCompilationFinished += OnAssemblyCompilationFinished; + } + } + + public static void OnAssemblyCompilationFinished(string assembly, CompilerMessage[] messages) + { + bool checkCompileErrors = RecompileScripts.Current == null || RecompileScripts.Current.ExpectScriptCompilationSuccess; + + if (checkCompileErrors && messages.Any(x => x.type == CompilerMessageType.Error)) + { + var compilerErrorMessages = messages.Where(x => x.type == CompilerMessageType.Error); + var utpMessageReporter = new UtpMessageReporter(new UtpDebugLogger()); + utpMessageReporter.ReportAssemblyCompilationErrors(assembly, compilerErrorMessages); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UnityTestProtocolStarter.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UnityTestProtocolStarter.cs.meta new file mode 100644 index 0000000..8d65f46 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UnityTestProtocolStarter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1ac58cb55fc8daf4abd3945a2bbbb0c5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UtpDebuglogger.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UtpDebuglogger.cs new file mode 100644 index 0000000..537e350 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UtpDebuglogger.cs @@ -0,0 +1,13 @@ +using UnityEngine; + +namespace UnityEditor.TestTools.TestRunner.UnityTestProtocol +{ + class UtpDebugLogger : IUtpLogger + { + public void Log(Message msg) + { + var msgJson = JsonUtility.ToJson(msg); + Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, "\n##utp:{0}", msgJson); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UtpDebuglogger.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UtpDebuglogger.cs.meta new file mode 100644 index 0000000..eb25630 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UtpDebuglogger.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d0abdd8cb6b29a24c8ee19626ef741b9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UtpMessageReporter.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UtpMessageReporter.cs new file mode 100644 index 0000000..22450c8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UtpMessageReporter.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEditor.Compilation; +using UnityEditor.TestTools.TestRunner.Api; + +namespace UnityEditor.TestTools.TestRunner.UnityTestProtocol +{ + internal class UtpMessageReporter : IUtpMessageReporter + { + public ITestRunnerApiMapper TestRunnerApiMapper; + public IUtpLogger Logger; + + public UtpMessageReporter(IUtpLogger utpLogger) + { + TestRunnerApiMapper = new TestRunnerApiMapper(); + Logger = utpLogger; + } + + public void ReportAssemblyCompilationErrors(string assembly, IEnumerable errorCompilerMessages) + { + var compilationErrorMessage = new AssemblyCompilationErrorsMessage + { + assembly = assembly, + errors = errorCompilerMessages.Select(x => x.message).ToArray() + }; + + Logger.Log(compilationErrorMessage); + } + + public void ReportTestRunStarted(ITestAdaptor testsToRun) + { + var msg = TestRunnerApiMapper.MapTestToTestPlanMessage(testsToRun); + + Logger.Log(msg); + } + + public void ReportTestStarted(ITestAdaptor test) + { + if (test.IsSuite) + return; + + var msg = TestRunnerApiMapper.MapTestToTestStartedMessage(test); + + Logger.Log(msg); + } + + public void ReportTestFinished(ITestResultAdaptor result) + { + if (result.Test.IsSuite) + return; + + var msg = TestRunnerApiMapper.TestResultToTestFinishedMessage(result); + + Logger.Log(msg); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UtpMessageReporter.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UtpMessageReporter.cs.meta new file mode 100644 index 0000000..02cccdf --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/UnityTestProtocol/UtpMessageReporter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ebcc5f899d9277642868aeda9a17cbaf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner.meta new file mode 100644 index 0000000..2b554fc --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 950890083f4907541a6ed06d70959e49 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/AssemblyInfo.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/AssemblyInfo.cs new file mode 100644 index 0000000..8c3afaa --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/AssemblyInfo.cs @@ -0,0 +1,16 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle("UnityEngine.TestRunner")] + +[assembly: InternalsVisibleTo("UnityEditor.TestRunner")] +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] +[assembly: InternalsVisibleTo("Unity.PerformanceTesting")] +[assembly: InternalsVisibleTo("Unity.PerformanceTesting.Editor")] +[assembly: InternalsVisibleTo("Assembly-CSharp-testable")] +[assembly: InternalsVisibleTo("Assembly-CSharp-Editor-testable")] +[assembly: InternalsVisibleTo("UnityEngine.TestRunner.Tests")] +[assembly: InternalsVisibleTo("UnityEditor.TestRunner.Tests")] +[assembly: InternalsVisibleTo("Unity.PackageManagerUI.Editor")] + +[assembly: AssemblyVersion("1.0.0")] diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/AssemblyInfo.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/AssemblyInfo.cs.meta new file mode 100644 index 0000000..47de243 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/AssemblyInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cc22cc13b69c1094c85e176c008b9ef8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions.meta new file mode 100644 index 0000000..c1fd9d7 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1ad55f5ad04d1d045a1f287409c650dd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/AllocatingGCMemoryConstraint.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/AllocatingGCMemoryConstraint.cs new file mode 100644 index 0000000..d765cdb --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/AllocatingGCMemoryConstraint.cs @@ -0,0 +1,83 @@ +using System; +using NUnit.Framework; +using NUnit.Framework.Constraints; +using UnityEngine.Profiling; + +namespace UnityEngine.TestTools.Constraints +{ + public class AllocatingGCMemoryConstraint : Constraint + { + private class AllocatingGCMemoryResult : ConstraintResult + { + private readonly int diff; + public AllocatingGCMemoryResult(IConstraint constraint, object actualValue, int diff) : base(constraint, actualValue, diff > 0) + { + this.diff = diff; + } + + public override void WriteMessageTo(MessageWriter writer) + { + if (diff == 0) + writer.WriteMessageLine("The provided delegate did not make any GC allocations."); + else + writer.WriteMessageLine("The provided delegate made {0} GC allocation(s).", diff); + } + } + + private ConstraintResult ApplyTo(Action action, object original) + { + var recorder = Recorder.Get("GC.Alloc"); + + // The recorder was created enabled, which means it captured the creation of the Recorder object itself, etc. + // Disabling it flushes its data, so that we can retrieve the sample block count and have it correctly account + // for these initial allocations. + recorder.enabled = false; + +#if !UNITY_WEBGL + recorder.FilterToCurrentThread(); +#endif + + recorder.enabled = true; + + try + { + action(); + } + finally + { + recorder.enabled = false; +#if !UNITY_WEBGL + recorder.CollectFromAllThreads(); +#endif + } + + return new AllocatingGCMemoryResult(this, original, recorder.sampleBlockCount); + } + + public override ConstraintResult ApplyTo(object obj) + { + if (obj == null) + throw new ArgumentNullException(); + + TestDelegate d = obj as TestDelegate; + if (d == null) + throw new ArgumentException(string.Format("The actual value must be a TestDelegate but was {0}", + obj.GetType())); + + return ApplyTo(() => d.Invoke(), obj); + } + + public override ConstraintResult ApplyTo(ActualValueDelegate del) + { + if (del == null) + throw new ArgumentNullException(); + + return ApplyTo(() => del.Invoke(), del); + } + + public override string Description + { + get { return "allocates GC memory"; } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/AllocatingGCMemoryConstraint.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/AllocatingGCMemoryConstraint.cs.meta new file mode 100644 index 0000000..e38d0b4 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/AllocatingGCMemoryConstraint.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d09858396dd7adb4bbdb22ea0c8c3a37 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/ConstraintsExtensions.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/ConstraintsExtensions.cs new file mode 100644 index 0000000..54b8e64 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/ConstraintsExtensions.cs @@ -0,0 +1,14 @@ +using NUnit.Framework.Constraints; + +namespace UnityEngine.TestTools.Constraints +{ + public static class ConstraintExtensions + { + public static AllocatingGCMemoryConstraint AllocatingGCMemory(this ConstraintExpression chain) + { + var constraint = new AllocatingGCMemoryConstraint(); + chain.Append(constraint); + return constraint; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/ConstraintsExtensions.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/ConstraintsExtensions.cs.meta new file mode 100644 index 0000000..b0fc061 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/ConstraintsExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 68a48d1900320ed458e118415857faf6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/InvalidSignatureException.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/InvalidSignatureException.cs new file mode 100644 index 0000000..b9c132b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/InvalidSignatureException.cs @@ -0,0 +1,18 @@ +using NUnit.Framework; +using NUnit.Framework.Interfaces; + +namespace UnityEngine.TestTools.TestRunner +{ + internal class InvalidSignatureException : ResultStateException + { + public InvalidSignatureException(string message) + : base(message) + { + } + + public override ResultState ResultState + { + get { return ResultState.NotRunnable; } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/InvalidSignatureException.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/InvalidSignatureException.cs.meta new file mode 100644 index 0000000..a995fcf --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/InvalidSignatureException.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9650d910fcaefb34cb45f121c1993892 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/Is.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/Is.cs new file mode 100644 index 0000000..4cdc715 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/Is.cs @@ -0,0 +1,10 @@ +namespace UnityEngine.TestTools.Constraints +{ + public class Is : NUnit.Framework.Is + { + public static AllocatingGCMemoryConstraint AllocatingGCMemory() + { + return new AllocatingGCMemoryConstraint(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/Is.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/Is.cs.meta new file mode 100644 index 0000000..636110b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/Is.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6d5833966abeadb429de247e4316eef4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogAssert.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogAssert.cs new file mode 100644 index 0000000..32900eb --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogAssert.cs @@ -0,0 +1,39 @@ +using System.Text.RegularExpressions; +using UnityEngine.TestTools.Logging; + +namespace UnityEngine.TestTools +{ + public static class LogAssert + { + public static void Expect(LogType type, string message) + { + LogScope.Current.ExpectedLogs.Enqueue(new LogMatch() { LogType = type, Message = message }); + } + + public static void Expect(LogType type, Regex message) + { + LogScope.Current.ExpectedLogs.Enqueue(new LogMatch() { LogType = type, MessageRegex = message }); + } + + public static void NoUnexpectedReceived() + { + LogScope.Current.NoUnexpectedReceived(); + } + + public static bool ignoreFailingMessages + { + get + { + return LogScope.Current.IgnoreFailingMessages; + } + set + { + if (value != LogScope.Current.IgnoreFailingMessages) + { + Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, "\nIgnoreFailingMessages:" + (value? "true":"false")); + } + LogScope.Current.IgnoreFailingMessages = value; + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogAssert.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogAssert.cs.meta new file mode 100644 index 0000000..222bb52 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogAssert.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c97b794b51780d349a16826a4c7898d7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope.meta new file mode 100644 index 0000000..a225ac0 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b1d8465ba1376b148bdab58965101f47 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/ILogScope.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/ILogScope.cs new file mode 100644 index 0000000..efd00f7 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/ILogScope.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; + +namespace UnityEngine.TestTools.Logging +{ + internal interface ILogScope : IDisposable + { + Queue ExpectedLogs { get; set; } + List AllLogs { get; } + List FailingLogs { get; } + bool IgnoreFailingMessages { get; set; } + bool IsNUnitException { get; } + bool IsNUnitSuccessException { get; } + bool IsNUnitInconclusiveException { get; } + bool IsNUnitIgnoreException { get; } + string NUnitExceptionMessage { get; } + void AddLog(string message, string stacktrace, LogType type); + bool AnyFailingLogs(); + void ProcessExpectedLogs(); + void NoUnexpectedReceived(); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/ILogScope.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/ILogScope.cs.meta new file mode 100644 index 0000000..97b0e2c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/ILogScope.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3504aa04cda851b44a65973f9aead6f7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogEvent.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogEvent.cs new file mode 100644 index 0000000..49f58cb --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogEvent.cs @@ -0,0 +1,18 @@ +namespace UnityEngine.TestTools.Logging +{ + internal class LogEvent + { + public string Message { get; set; } + + public string StackTrace { get; set; } + + public LogType LogType { get; set; } + + public bool IsHandled { get; set; } + + public override string ToString() + { + return string.Format("[{0}] {1}", LogType, Message); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogEvent.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogEvent.cs.meta new file mode 100644 index 0000000..1609325 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogEvent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0c56471f08a0f6846afc792f0b4205b9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogMatch.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogMatch.cs new file mode 100644 index 0000000..05df048 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogMatch.cs @@ -0,0 +1,103 @@ +using System; +using System.Text.RegularExpressions; + +namespace UnityEngine.TestTools.Logging +{ + [Serializable] + internal class LogMatch + { + [SerializeField] + private bool m_UseRegex; + [SerializeField] + private string m_Message; + [SerializeField] + private string m_MessageRegex; + [SerializeField] + private string m_LogType; + + public string Message + { + get { return m_Message; } + set + { + m_Message = value; + m_UseRegex = false; + } + } + + public Regex MessageRegex + { + get + { + if (!m_UseRegex) + { + return null; + } + + return new Regex(m_MessageRegex); + } + set + { + if (value != null) + { + m_MessageRegex = value.ToString(); + m_UseRegex = true; + } + else + { + m_MessageRegex = null; + m_UseRegex = false; + } + } + } + + public LogType? LogType + { + get + { + if (!string.IsNullOrEmpty(m_LogType)) + { + return Enum.Parse(typeof(LogType), m_LogType) as LogType ? ; + } + + return null; + } + set + { + if (value != null) + { + m_LogType = value.Value.ToString(); + } + else + { + m_LogType = null; + } + } + } + + public bool Matches(LogEvent log) + { + if (LogType != null && LogType != log.LogType) + { + return false; + } + + if (m_UseRegex) + { + return MessageRegex.IsMatch(log.Message); + } + else + { + return Message.Equals(log.Message); + } + } + + public override string ToString() + { + if (m_UseRegex) + return string.Format("[{0}] Regex: {1}", LogType, MessageRegex); + else + return string.Format("[{0}] {1}", LogType, Message); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogMatch.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogMatch.cs.meta new file mode 100644 index 0000000..12f2cf8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogMatch.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9945ffed4692c6044b6d3acf81efd694 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogScope.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogScope.cs new file mode 100644 index 0000000..6f429c9 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogScope.cs @@ -0,0 +1,223 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine.TestTools.TestRunner; + +namespace UnityEngine.TestTools.Logging +{ + sealed class LogScope : ILogScope + { + static List s_ActiveScopes = new List(); + + readonly object m_Lock = new object(); + bool m_Disposed; + bool m_NeedToProcessLogs; + + public Queue ExpectedLogs { get; set; } + public List AllLogs { get; } + public List FailingLogs { get; } + public bool IgnoreFailingMessages { get; set; } + public bool IsNUnitException { get; private set; } + public bool IsNUnitSuccessException { get; private set; } + public bool IsNUnitInconclusiveException { get; private set; } + public bool IsNUnitIgnoreException { get; private set; } + public string NUnitExceptionMessage { get; private set; } + + public static LogScope Current + { + get + { + if (s_ActiveScopes.Count == 0) + throw new InvalidOperationException("No log scope is available"); + return s_ActiveScopes[0]; + } + } + + public static bool HasCurrentLogScope() + { + return s_ActiveScopes.Count > 0; + } + + public LogScope() + { + AllLogs = new List(); + FailingLogs = new List(); + ExpectedLogs = new Queue(); + IgnoreFailingMessages = false; + Activate(); + } + + void Activate() + { + s_ActiveScopes.Insert(0, this); + RegisterScope(this); + Application.logMessageReceivedThreaded -= AddLog; + Application.logMessageReceivedThreaded += AddLog; + } + + void Deactivate() + { + Application.logMessageReceivedThreaded -= AddLog; + s_ActiveScopes.Remove(this); + UnregisterScope(this); + } + + static void RegisterScope(LogScope logScope) + { + Application.logMessageReceivedThreaded += logScope.AddLog; + } + + static void UnregisterScope(LogScope logScope) + { + Application.logMessageReceivedThreaded -= logScope.AddLog; + } + + public void AddLog(string message, string stacktrace, LogType type) + { + lock (m_Lock) + { + m_NeedToProcessLogs = true; + var log = new LogEvent + { + LogType = type, + Message = message, + StackTrace = stacktrace, + }; + + AllLogs.Add(log); + + if (IsNUnitResultStateException(stacktrace, type)) + { + if (message.StartsWith("SuccessException")) + { + IsNUnitException = true; + IsNUnitSuccessException = true; + if (message.StartsWith("SuccessException: ")) + { + NUnitExceptionMessage = message.Substring("SuccessException: ".Length); + return; + } + } + else if (message.StartsWith("InconclusiveException")) + { + IsNUnitException = true; + IsNUnitInconclusiveException = true; + if (message.StartsWith("InconclusiveException: ")) + { + NUnitExceptionMessage = message.Substring("InconclusiveException: ".Length); + return; + } + } + else if (message.StartsWith("IgnoreException")) + { + IsNUnitException = true; + IsNUnitIgnoreException = true; + if (message.StartsWith("IgnoreException: ")) + { + NUnitExceptionMessage = message.Substring("IgnoreException: ".Length); + return; + } + } + } + + if (IsFailingLog(type) && !IgnoreFailingMessages) + { + FailingLogs.Add(log); + } + } + } + + static bool IsNUnitResultStateException(string stacktrace, LogType logType) + { + if (logType != LogType.Exception) + return false; + + return string.IsNullOrEmpty(stacktrace) || stacktrace.StartsWith("NUnit.Framework.Assert."); + } + + static bool IsFailingLog(LogType type) + { + switch (type) + { + case LogType.Assert: + case LogType.Error: + case LogType.Exception: + return true; + default: + return false; + } + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + void Dispose(bool disposing) + { + if (m_Disposed) + { + return; + } + + m_Disposed = true; + + if (disposing) + { + Deactivate(); + } + } + + public bool AnyFailingLogs() + { + ProcessExpectedLogs(); + return FailingLogs.Any(); + } + + public void ProcessExpectedLogs() + { + lock (m_Lock) + { + if (!m_NeedToProcessLogs || !ExpectedLogs.Any()) + return; + + LogMatch expectedLog = null; + foreach (var logEvent in AllLogs) + { + if (!ExpectedLogs.Any()) + break; + if (expectedLog == null && ExpectedLogs.Any()) + expectedLog = ExpectedLogs.Peek(); + + if (expectedLog != null && expectedLog.Matches(logEvent)) + { + ExpectedLogs.Dequeue(); + logEvent.IsHandled = true; + if (FailingLogs.Any(expectedLog.Matches)) + { + var failingLog = FailingLogs.First(expectedLog.Matches); + FailingLogs.Remove(failingLog); + } + expectedLog = null; + } + } + m_NeedToProcessLogs = false; + } + } + + public void NoUnexpectedReceived() + { + lock (m_Lock) + { + ProcessExpectedLogs(); + + var unhandledLog = AllLogs.FirstOrDefault(x => !x.IsHandled); + if (unhandledLog != null) + { + throw new UnhandledLogMessageException(unhandledLog); + } + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogScope.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogScope.cs.meta new file mode 100644 index 0000000..876c080 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/LogScope/LogScope.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4bbc17b35884fdf468e4b52ae4222882 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnexpectedLogMessageException.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnexpectedLogMessageException.cs new file mode 100644 index 0000000..4a491be --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnexpectedLogMessageException.cs @@ -0,0 +1,29 @@ +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using UnityEngine.TestTools.Logging; + +namespace UnityEngine.TestTools.TestRunner +{ + internal class UnexpectedLogMessageException : ResultStateException + { + public LogMatch LogEvent; + + public UnexpectedLogMessageException(LogMatch log) + : base(BuildMessage(log)) + { + LogEvent = log; + } + + private static string BuildMessage(LogMatch log) + { + return string.Format("Expected log did not appear: {0}", log); + } + + public override ResultState ResultState + { + get { return ResultState.Failure; } + } + + public override string StackTrace { get { return null; } } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnexpectedLogMessageException.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnexpectedLogMessageException.cs.meta new file mode 100644 index 0000000..57673e2 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnexpectedLogMessageException.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5b2eeca598284bd4abb4a15c30df1576 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnhandledLogMessageException.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnhandledLogMessageException.cs new file mode 100644 index 0000000..5a7ab33 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnhandledLogMessageException.cs @@ -0,0 +1,35 @@ +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using UnityEngine.TestTools.Logging; +using UnityEngine.TestTools.Utils; + +namespace UnityEngine.TestTools.TestRunner +{ + internal class UnhandledLogMessageException : ResultStateException + { + public LogEvent LogEvent; + private readonly string m_CustomStackTrace; + + public UnhandledLogMessageException(LogEvent log) + : base(BuildMessage(log)) + { + LogEvent = log; + m_CustomStackTrace = StackTraceFilter.Filter(log.StackTrace); + } + + private static string BuildMessage(LogEvent log) + { + return string.Format("Unhandled log message: '{0}'. Use UnityEngine.TestTools.LogAssert.Expect", log); + } + + public override ResultState ResultState + { + get { return ResultState.Failure; } + } + + public override string StackTrace + { + get { return m_CustomStackTrace; } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnhandledLogMessageException.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnhandledLogMessageException.cs.meta new file mode 100644 index 0000000..6394a8d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnhandledLogMessageException.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a8ed4063f2beecd41a234a582202f3c4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnityTestTimeoutException.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnityTestTimeoutException.cs new file mode 100644 index 0000000..56566d7 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnityTestTimeoutException.cs @@ -0,0 +1,28 @@ +using NUnit.Framework; +using NUnit.Framework.Interfaces; + +namespace UnityEngine.TestTools.TestRunner +{ + internal class UnityTestTimeoutException : ResultStateException + { + public UnityTestTimeoutException(int timeout) + : base(BuildMessage(timeout)) + { + } + + private static string BuildMessage(int timeout) + { + return string.Format("UnityTest exceeded Timeout value of {0}ms", timeout); + } + + public override ResultState ResultState + { + get { return ResultState.Failure; } + } + + public override string StackTrace + { + get { return ""; } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnityTestTimeoutException.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnityTestTimeoutException.cs.meta new file mode 100644 index 0000000..188de19 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Assertions/UnityTestTimeoutException.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ffb335140c799c4408411d81789fb05c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions.meta new file mode 100644 index 0000000..ac6f127 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3e8d6af343b383544ba5743d119f4062 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/ActionDelegator.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/ActionDelegator.cs new file mode 100644 index 0000000..d13a7e0 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/ActionDelegator.cs @@ -0,0 +1,79 @@ +using System; +using System.Linq; +using UnityEngine.TestRunner.NUnitExtensions.Runner; +using UnityEngine.TestTools.Logging; +using UnityEngine.TestTools.TestRunner; + +namespace UnityEngine.TestTools.NUnitExtensions +{ + /// + /// This class delegates actions from the NUnit thread that should be executed on the main thread. + /// NUnit thread calls Delegate which blocks the execution on the thread until the action is executed. + /// The main thread will poll for awaiting actions (HasAction) and invoke them (Execute). + /// Once the action is executed, the main thread releases the lock and executino on the NUnit thread is continued. + /// + internal class ActionDelegator : BaseDelegator + { + private Func m_Action; + public object Delegate(Action action) + { + return Delegate(() => { action(); return null; }); + } + + public object Delegate(Func action) + { + if (m_Aborted) + { + return null; + } + + AssertState(); + m_Context = UnityTestExecutionContext.CurrentContext; + + m_Signal.Reset(); + m_Action = action; + + WaitForSignal(); + + return HandleResult(); + } + + private void AssertState() + { + if (m_Action != null) + { + throw new Exception("Action not executed yet"); + } + } + + public bool HasAction() + { + return m_Action != null; + } + + public void Execute(LogScope logScope) + { + try + { + SetCurrentTestContext(); + m_Result = m_Action(); + if (logScope.AnyFailingLogs()) + { + var failingLog = logScope.FailingLogs.First(); + throw new UnhandledLogMessageException(failingLog); + } + if (logScope.ExpectedLogs.Any()) + throw new UnexpectedLogMessageException(LogScope.Current.ExpectedLogs.Peek()); + } + catch (Exception e) + { + m_Exception = e; + } + finally + { + m_Action = null; + m_Signal.Set(); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/ActionDelegator.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/ActionDelegator.cs.meta new file mode 100644 index 0000000..4800886 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/ActionDelegator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4f939b9e23a0946439b812551e07ac81 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes.meta new file mode 100644 index 0000000..d2d34f6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0cb14878543cf3d4f8472b15f7ecf0e3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/ConditionalIgnoreAttribute.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/ConditionalIgnoreAttribute.cs new file mode 100644 index 0000000..3cf9714 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/ConditionalIgnoreAttribute.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; + +namespace UnityEngine.TestTools +{ + public class ConditionalIgnoreAttribute : NUnitAttribute, IApplyToTest + { + string m_ConditionKey; + string m_IgnoreReason; + + public ConditionalIgnoreAttribute(string conditionKey, string ignoreReason) + { + m_ConditionKey = conditionKey; + m_IgnoreReason = ignoreReason; + } + + public void ApplyToTest(Test test) + { + var key = m_ConditionKey.ToLowerInvariant(); + if (m_ConditionMap.ContainsKey(key) && m_ConditionMap[key]) + { + test.RunState = RunState.Ignored; + string skipReason = string.Format(m_IgnoreReason); + test.Properties.Add(PropertyNames.SkipReason, skipReason); + } + } + + static Dictionary m_ConditionMap = new Dictionary(); + public static void AddConditionalIgnoreMapping(string key, bool value) + { + m_ConditionMap.Add(key.ToLowerInvariant(), value); + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/ConditionalIgnoreAttribute.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/ConditionalIgnoreAttribute.cs.meta new file mode 100644 index 0000000..b1601ee --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/ConditionalIgnoreAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c82a8473f4a8f7b42a004c91e06d2f2b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/TestEnumerator.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/TestEnumerator.cs new file mode 100644 index 0000000..18bb46c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/TestEnumerator.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections; +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; + +namespace UnityEngine.TestTools +{ + internal class TestEnumerator + { + private readonly ITestExecutionContext m_Context; + private static IEnumerator m_TestEnumerator; + + public static IEnumerator Enumerator { get { return m_TestEnumerator; } } + + public TestEnumerator(ITestExecutionContext context, IEnumerator testEnumerator) + { + m_Context = context; + m_TestEnumerator = testEnumerator; + } + + public IEnumerator Execute() + { + m_Context.CurrentResult.SetResult(ResultState.Success); + + while (true) + { + object current = null; + try + { + if (!m_TestEnumerator.MoveNext()) + { + yield break; + } + + if (!m_Context.CurrentResult.ResultState.Equals(ResultState.Success)) + { + yield break; + } + + current = m_TestEnumerator.Current; + } + catch (Exception exception) + { + m_Context.CurrentResult.RecordException(exception); + yield break; + } + yield return current; + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/TestEnumerator.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/TestEnumerator.cs.meta new file mode 100644 index 0000000..3a6022e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/TestEnumerator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 750aad009559b814dbc27001341fc1c3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/TestMustExpectAllLogsAttribute.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/TestMustExpectAllLogsAttribute.cs new file mode 100644 index 0000000..8f2ea0f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/TestMustExpectAllLogsAttribute.cs @@ -0,0 +1,28 @@ +using System; + +namespace UnityEngine.TestTools +{ + /// + /// The presence of this attribute will cause the test runner to require that every single log is expected. By + /// default, the runner will only automatically fail on any error logs, so this adds warnings and infos as well. + /// It is the same as calling `LogAssert.NoUnexpectedReceived()` at the bottom of every affected test. + /// + /// This attribute can be applied to test assemblies (will affect every test in the assembly), fixtures (will + /// affect every test in the fixture), or on individual test methods. It is also automatically inherited from base + /// fixtures. + /// + /// The MustExpect property (on by default) lets you selectively enable or disable the higher level value. For + /// example when migrating an assembly to this more strict checking method, you might attach + /// `[assembly:TestMustExpectAllLogs]` to the assembly itself, but then whitelist failing fixtures and test methods + /// with `[TestMustExpectAllLogs(MustExpect=false)]` until they can be migrated. This also means new tests in that + /// assembly would be required to have the more strict checking. + /// + [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)] + public class TestMustExpectAllLogsAttribute : Attribute + { + public TestMustExpectAllLogsAttribute(bool mustExpect = true) + => MustExpect = mustExpect; + + public bool MustExpect { get; } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/TestMustExpectAllLogsAttribute.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/TestMustExpectAllLogsAttribute.cs.meta new file mode 100644 index 0000000..6ae8514 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/TestMustExpectAllLogsAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3803f736886e77842995ddbc3531afaa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityCombinatorialStrategy.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityCombinatorialStrategy.cs new file mode 100644 index 0000000..144f78c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityCombinatorialStrategy.cs @@ -0,0 +1,20 @@ +using System.Collections; +using System.Collections.Generic; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal.Builders; + +namespace UnityEngine.TestTools +{ + internal class UnityCombinatorialStrategy : CombinatorialStrategy, ICombiningStrategy + { + public new IEnumerable GetTestCases(IEnumerable[] sources) + { + var testCases = base.GetTestCases(sources); + foreach (var testCase in testCases) + { + testCase.GetType().GetProperty("ExpectedResult").SetValue(testCase, new object(), null); + } + return testCases; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityCombinatorialStrategy.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityCombinatorialStrategy.cs.meta new file mode 100644 index 0000000..422dd17 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityCombinatorialStrategy.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7af6ac3e6b51b8d4aab04adc85b8de2f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityPlatformAttribute.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityPlatformAttribute.cs new file mode 100644 index 0000000..68f7816 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityPlatformAttribute.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; + +namespace UnityEngine.TestTools +{ + [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = false)] + public class UnityPlatformAttribute : NUnitAttribute, IApplyToTest + { + public RuntimePlatform[] include { get; set; } + public RuntimePlatform[] exclude { get; set; } + + private string m_skippedReason; + + public UnityPlatformAttribute() + { + include = new List().ToArray(); + exclude = new List().ToArray(); + } + + public UnityPlatformAttribute(params RuntimePlatform[] include) + : this() + { + this.include = include; + } + + public void ApplyToTest(Test test) + { + if (test.RunState == RunState.NotRunnable || test.RunState == RunState.Ignored || IsPlatformSupported(Application.platform)) + { + return; + } + test.RunState = RunState.Skipped; + test.Properties.Add("_SKIPREASON", m_skippedReason); + } + + internal bool IsPlatformSupported(RuntimePlatform testTargetPlatform) + { + if (include.Any() && !include.Any(x => x == testTargetPlatform)) + { + m_skippedReason = string.Format("Only supported on {0}", string.Join(", ", include.Select(x => x.ToString()).ToArray())); + return false; + } + + if (exclude.Any(x => x == testTargetPlatform)) + { + m_skippedReason = string.Format("Not supported on {0}", string.Join(", ", include.Select(x => x.ToString()).ToArray())); + return false; + } + return true; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityPlatformAttribute.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityPlatformAttribute.cs.meta new file mode 100644 index 0000000..bb41d89 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityPlatformAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5440c1153b397e14c9c7b1d6eb83b9f9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnitySetUpAttribute.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnitySetUpAttribute.cs new file mode 100644 index 0000000..cdb8a82 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnitySetUpAttribute.cs @@ -0,0 +1,10 @@ +using System; +using NUnit.Framework; + +namespace UnityEngine.TestTools +{ + [AttributeUsage(AttributeTargets.Method)] + public class UnitySetUpAttribute : NUnitAttribute + { + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnitySetUpAttribute.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnitySetUpAttribute.cs.meta new file mode 100644 index 0000000..1668931 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnitySetUpAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cc6401f13df54ba44bfd7cdc93c7d64d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityTearDownAttribute.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityTearDownAttribute.cs new file mode 100644 index 0000000..d159d39 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityTearDownAttribute.cs @@ -0,0 +1,10 @@ +using System; +using NUnit.Framework; + +namespace UnityEngine.TestTools +{ + [AttributeUsage(AttributeTargets.Method)] + public class UnityTearDownAttribute : NUnitAttribute + { + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityTearDownAttribute.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityTearDownAttribute.cs.meta new file mode 100644 index 0000000..169eefb --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityTearDownAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 600f4b74746dbf944901257f81a8af6d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityTestAttribute.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityTestAttribute.cs new file mode 100644 index 0000000..5d2b5f1 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityTestAttribute.cs @@ -0,0 +1,33 @@ +using System; +using NUnit.Framework; +using NUnit.Framework.Internal.Commands; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Builders; +using UnityEngine.TestRunner.NUnitExtensions.Runner; + +namespace UnityEngine.TestTools +{ + [AttributeUsage(AttributeTargets.Method)] + public class UnityTestAttribute : CombiningStrategyAttribute, ISimpleTestBuilder, IImplyFixture + { + public UnityTestAttribute() : base(new UnityCombinatorialStrategy(), new ParameterDataSourceProvider()) {} + + private readonly NUnitTestCaseBuilder _builder = new NUnitTestCaseBuilder(); + + TestMethod ISimpleTestBuilder.BuildFrom(IMethodInfo method, Test suite) + { + TestCaseParameters parms = new TestCaseParameters + { + ExpectedResult = new object(), + HasExpectedResult = true + }; + + var t = _builder.BuildTestMethod(method, suite, parms); + + if (t.parms != null) + t.parms.HasExpectedResult = false; + return t; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityTestAttribute.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityTestAttribute.cs.meta new file mode 100644 index 0000000..a7572d4 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Attributes/UnityTestAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fedb0f9e5006b1943abae52f52f08a1a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/BaseDelegator.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/BaseDelegator.cs new file mode 100644 index 0000000..596c000 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/BaseDelegator.cs @@ -0,0 +1,58 @@ +using System; +using System.Threading; +using NUnit.Framework.Internal; + +namespace UnityEngine.TestTools.NUnitExtensions +{ + internal abstract class BaseDelegator + { + protected ManualResetEvent m_Signal = new ManualResetEvent(false); + + protected object m_Result; + protected Exception m_Exception; + protected ITestExecutionContext m_Context; + + protected bool m_Aborted; + + protected object HandleResult() + { + SetCurrentTestContext(); + if (m_Exception != null) + { + var temp = m_Exception; + m_Exception = null; + throw temp; + } + var tempResult = m_Result; + m_Result = null; + return tempResult; + } + + protected void WaitForSignal() + { + while (!m_Signal.WaitOne(100)) + { + if (m_Aborted) + { + m_Aborted = false; + Reflect.MethodCallWrapper = null; + throw new Exception(); + } + } + } + + public void Abort() + { + m_Aborted = true; + } + + protected void SetCurrentTestContext() + { + var prop = typeof(TestExecutionContext).GetProperty("CurrentContext"); + if (prop != null) + { + prop.SetValue(null, m_Context, null); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/BaseDelegator.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/BaseDelegator.cs.meta new file mode 100644 index 0000000..3c1a81a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/BaseDelegator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 37cea569bfefafe49a1513c4d7f0e9eb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands.meta new file mode 100644 index 0000000..3d3cf4a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6b72875690e0f7343911e06af3145bd5 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/BeforeAfterTestCommandBase.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/BeforeAfterTestCommandBase.cs new file mode 100644 index 0000000..aef740a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/BeforeAfterTestCommandBase.cs @@ -0,0 +1,196 @@ +using System; +using System.Collections; +using System.Linq; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Commands; +using UnityEngine.TestRunner.NUnitExtensions; +using UnityEngine.TestRunner.NUnitExtensions.Runner; +using UnityEngine.TestTools.Logging; +using UnityEngine.TestTools.TestRunner; + +namespace UnityEngine.TestTools +{ + internal abstract class BeforeAfterTestCommandBase : DelegatingTestCommand, IEnumerableTestMethodCommand + { + private string m_BeforeErrorPrefix; + private string m_AfterErrorPrefix; + private bool m_SkipYieldAfterActions; + protected BeforeAfterTestCommandBase(TestCommand innerCommand, string beforeErrorPrefix, string afterErrorPrefix, bool skipYieldAfterActions = false) + : base(innerCommand) + { + m_BeforeErrorPrefix = beforeErrorPrefix; + m_AfterErrorPrefix = afterErrorPrefix; + m_SkipYieldAfterActions = skipYieldAfterActions; + } + + protected T[] BeforeActions = new T[0]; + + protected T[] AfterActions = new T[0]; + + protected abstract IEnumerator InvokeBefore(T action, Test test, UnityTestExecutionContext context); + + protected abstract IEnumerator InvokeAfter(T action, Test test, UnityTestExecutionContext context); + + protected abstract BeforeAfterTestCommandState GetState(UnityTestExecutionContext context); + + public IEnumerable ExecuteEnumerable(ITestExecutionContext context) + { + var unityContext = (UnityTestExecutionContext)context; + var state = GetState(unityContext); + + if (state == null) + { + // We do not expect a state to exist in playmode + state = ScriptableObject.CreateInstance(); + } + + state.ApplyTestResult(context.CurrentResult); + + while (state.NextBeforeStepIndex < BeforeActions.Length) + { + var action = BeforeActions[state.NextBeforeStepIndex]; + var enumerator = InvokeBefore(action, Test, unityContext); + ActivePcHelper.SetEnumeratorPC(enumerator, state.NextBeforeStepPc); + + using (var logScope = new LogScope()) + { + while (true) + { + try + { + if (!enumerator.MoveNext()) + { + break; + } + } + catch (Exception ex) + { + state.TestHasRun = true; + context.CurrentResult.RecordPrefixedException(m_BeforeErrorPrefix, ex); + state.StoreTestResult(context.CurrentResult); + break; + } + + state.NextBeforeStepPc = ActivePcHelper.GetEnumeratorPC(enumerator); + state.StoreTestResult(context.CurrentResult); + if (m_SkipYieldAfterActions) + { + break; + } + else + { + yield return enumerator.Current; + } + } + + if (logScope.AnyFailingLogs()) + { + state.TestHasRun = true; + context.CurrentResult.RecordPrefixedError(m_BeforeErrorPrefix, new UnhandledLogMessageException(logScope.FailingLogs.First()).Message); + state.StoreTestResult(context.CurrentResult); + } + } + + state.NextBeforeStepIndex++; + state.NextBeforeStepPc = 0; + } + + if (!state.TestHasRun) + { + if (innerCommand is IEnumerableTestMethodCommand) + { + var executeEnumerable = ((IEnumerableTestMethodCommand)innerCommand).ExecuteEnumerable(context); + foreach (var iterator in executeEnumerable) + { + state.StoreTestResult(context.CurrentResult); + yield return iterator; + } + } + else + { + context.CurrentResult = innerCommand.Execute(context); + state.StoreTestResult(context.CurrentResult); + } + + state.TestHasRun = true; + } + + while (state.NextAfterStepIndex < AfterActions.Length) + { + state.TestAfterStarted = true; + var action = AfterActions[state.NextAfterStepIndex]; + var enumerator = InvokeAfter(action, Test, unityContext); + ActivePcHelper.SetEnumeratorPC(enumerator, state.NextAfterStepPc); + + using (var logScope = new LogScope()) + { + while (true) + { + try + { + if (!enumerator.MoveNext()) + { + break; + } + } + catch (Exception ex) + { + context.CurrentResult.RecordPrefixedException(m_AfterErrorPrefix, ex); + state.StoreTestResult(context.CurrentResult); + break; + } + + state.NextAfterStepPc = ActivePcHelper.GetEnumeratorPC(enumerator); + state.StoreTestResult(context.CurrentResult); + + if (m_SkipYieldAfterActions) + { + break; + } + else + { + yield return enumerator.Current; + } + } + + if (logScope.AnyFailingLogs()) + { + state.TestHasRun = true; + context.CurrentResult.RecordPrefixedError(m_AfterErrorPrefix, new UnhandledLogMessageException(logScope.FailingLogs.First()).Message); + state.StoreTestResult(context.CurrentResult); + } + } + + state.NextAfterStepIndex++; + state.NextAfterStepPc = 0; + } + + state.Reset(); + } + + public override TestResult Execute(ITestExecutionContext context) + { + throw new NotImplementedException("Use ExecuteEnumerable"); + } + + private static TestCommandPcHelper pcHelper; + + internal static TestCommandPcHelper ActivePcHelper + { + get + { + if (pcHelper == null) + { + pcHelper = new TestCommandPcHelper(); + } + + return pcHelper; + } + set + { + pcHelper = value; + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/BeforeAfterTestCommandBase.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/BeforeAfterTestCommandBase.cs.meta new file mode 100644 index 0000000..21b2681 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/BeforeAfterTestCommandBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cbbca1d8a0434be4bbc7f165523763ac +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/BeforeAfterTestCommandState.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/BeforeAfterTestCommandState.cs new file mode 100644 index 0000000..daed396 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/BeforeAfterTestCommandState.cs @@ -0,0 +1,49 @@ +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; + +namespace UnityEngine.TestTools +{ + internal class BeforeAfterTestCommandState : ScriptableObject + { + public int NextBeforeStepIndex; + public int NextBeforeStepPc; + public int NextAfterStepIndex; + public int NextAfterStepPc; + public bool TestHasRun; + public TestStatus CurrentTestResultStatus; + public string CurrentTestResultLabel; + public FailureSite CurrentTestResultSite; + public string CurrentTestMessage; + public string CurrentTestStrackTrace; + public bool TestAfterStarted; + + public void Reset() + { + NextBeforeStepIndex = 0; + NextBeforeStepPc = 0; + NextAfterStepIndex = 0; + NextAfterStepPc = 0; + TestHasRun = false; + CurrentTestResultStatus = TestStatus.Inconclusive; + CurrentTestResultLabel = null; + CurrentTestResultSite = default(FailureSite); + CurrentTestMessage = null; + CurrentTestStrackTrace = null; + TestAfterStarted = false; + } + + public void StoreTestResult(TestResult result) + { + CurrentTestResultStatus = result.ResultState.Status; + CurrentTestResultLabel = result.ResultState.Label; + CurrentTestResultSite = result.ResultState.Site; + CurrentTestMessage = result.Message; + CurrentTestStrackTrace = result.StackTrace; + } + + public void ApplyTestResult(TestResult result) + { + result.SetResult(new ResultState(CurrentTestResultStatus, CurrentTestResultLabel, CurrentTestResultSite), CurrentTestMessage, CurrentTestStrackTrace); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/BeforeAfterTestCommandState.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/BeforeAfterTestCommandState.cs.meta new file mode 100644 index 0000000..8e304ac --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/BeforeAfterTestCommandState.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7f65567c9026afb4db5de3355accc636 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableApplyChangesToContextCommand.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableApplyChangesToContextCommand.cs new file mode 100644 index 0000000..81a672a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableApplyChangesToContextCommand.cs @@ -0,0 +1,34 @@ + +using System.Collections; +using System.Collections.Generic; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Commands; +using UnityEngine.TestRunner.NUnitExtensions.Runner; + +namespace UnityEngine.TestTools +{ + internal class EnumerableApplyChangesToContextCommand : ApplyChangesToContextCommand, IEnumerableTestMethodCommand + { + public EnumerableApplyChangesToContextCommand(TestCommand innerCommand, IEnumerable changes) + : base(innerCommand, changes) { } + + public IEnumerable ExecuteEnumerable(ITestExecutionContext context) + { + ApplyChanges(context); + + if (innerCommand is IEnumerableTestMethodCommand) + { + var executeEnumerable = ((IEnumerableTestMethodCommand)innerCommand).ExecuteEnumerable(context); + foreach (var iterator in executeEnumerable) + { + yield return iterator; + } + } + else + { + context.CurrentResult = innerCommand.Execute(context); + } + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableApplyChangesToContextCommand.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableApplyChangesToContextCommand.cs.meta new file mode 100644 index 0000000..f652088 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableApplyChangesToContextCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3b4429eff9fcffb48b006e8edcc90338 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableRepeatedTestCommand.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableRepeatedTestCommand.cs new file mode 100644 index 0000000..a692d78 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableRepeatedTestCommand.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections; +using System.Reflection; +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Commands; +using UnityEngine.TestRunner.NUnitExtensions.Runner; + +namespace UnityEngine.TestTools +{ + internal class EnumerableRepeatedTestCommand : DelegatingTestCommand, IEnumerableTestMethodCommand + { + private int repeatCount; + + public EnumerableRepeatedTestCommand(RepeatAttribute.RepeatedTestCommand commandToReplace) : base(commandToReplace.GetInnerCommand()) + { + repeatCount = (int) typeof(RepeatAttribute.RepeatedTestCommand) + .GetField("repeatCount", BindingFlags.NonPublic | BindingFlags.Instance) + .GetValue(commandToReplace); + } + + public override TestResult Execute(ITestExecutionContext context) + { + throw new NotImplementedException("Use ExecuteEnumerable"); + } + + public IEnumerable ExecuteEnumerable(ITestExecutionContext context) + { + var unityContext = (UnityTestExecutionContext)context; + int count = unityContext.EnumerableRepeatedTestState; + + while (count < repeatCount) + { + count++; + unityContext.EnumerableRepeatedTestState = count; + + if (innerCommand is IEnumerableTestMethodCommand) + { + var executeEnumerable = ((IEnumerableTestMethodCommand)innerCommand).ExecuteEnumerable(context); + foreach (var iterator in executeEnumerable) + { + yield return iterator; + } + } + else + { + context.CurrentResult = innerCommand.Execute(context); + } + + if (context.CurrentResult.ResultState != ResultState.Success) + { + break; + } + } + + unityContext.EnumerableRepeatedTestState = 0; + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableRepeatedTestCommand.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableRepeatedTestCommand.cs.meta new file mode 100644 index 0000000..121fb18 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableRepeatedTestCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e273462feb9a65948826739f683cc9a9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableRetryTestCommand.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableRetryTestCommand.cs new file mode 100644 index 0000000..2dbe145 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableRetryTestCommand.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections; +using System.Reflection; +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Commands; +using UnityEngine.TestRunner.NUnitExtensions.Runner; + +namespace UnityEngine.TestTools +{ + internal class EnumerableRetryTestCommand : DelegatingTestCommand, IEnumerableTestMethodCommand + { + private int retryCount; + + public EnumerableRetryTestCommand(RetryAttribute.RetryCommand commandToReplace) : base(commandToReplace.GetInnerCommand()) + { + retryCount = (int) typeof(RetryAttribute.RetryCommand) + .GetField("_retryCount", BindingFlags.NonPublic | BindingFlags.Instance) + .GetValue(commandToReplace); + } + + public override TestResult Execute(ITestExecutionContext context) + { + throw new NotImplementedException("Use ExecuteEnumerable"); + } + + public IEnumerable ExecuteEnumerable(ITestExecutionContext context) + { + var unityContext = (UnityTestExecutionContext)context; + int count = unityContext.EnumerableRetryTestState; + + while (count < retryCount) + { + count++; + unityContext.EnumerableRetryTestState = count; + + if (innerCommand is IEnumerableTestMethodCommand) + { + var executeEnumerable = ((IEnumerableTestMethodCommand)innerCommand).ExecuteEnumerable(context); + foreach (var iterator in executeEnumerable) + { + yield return iterator; + } + } + else + { + context.CurrentResult = innerCommand.Execute(context); + } + + if (context.CurrentResult.ResultState != ResultState.Failure) + { + break; + } + } + + unityContext.EnumerableRetryTestState = 0; + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableRetryTestCommand.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableRetryTestCommand.cs.meta new file mode 100644 index 0000000..da1781c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableRetryTestCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6de2f178a24cd2e48a0816cacd9a0583 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableSetUpTearDownCommand.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableSetUpTearDownCommand.cs new file mode 100644 index 0000000..e4010c0 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableSetUpTearDownCommand.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections; +using System.Linq; +using System.Reflection; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Commands; +using UnityEngine.TestRunner.NUnitExtensions.Runner; + +namespace UnityEngine.TestTools +{ + internal class EnumerableSetUpTearDownCommand : BeforeAfterTestCommandBase + { + public EnumerableSetUpTearDownCommand(TestCommand innerCommand) + : base(innerCommand, "SetUp", "TearDown") + { + if (Test.TypeInfo.Type != null) + { + BeforeActions = GetMethodsWithAttributeFromFixture(Test.TypeInfo.Type, typeof(UnitySetUpAttribute)); + AfterActions = GetMethodsWithAttributeFromFixture(Test.TypeInfo.Type, typeof(UnityTearDownAttribute)).Reverse().ToArray(); + } + } + + private static MethodInfo[] GetMethodsWithAttributeFromFixture(Type fixtureType, Type setUpType) + { + MethodInfo[] methodsWithAttribute = Reflect.GetMethodsWithAttribute(fixtureType, setUpType, true); + return methodsWithAttribute.Where(x => x.ReturnType == typeof(IEnumerator)).ToArray(); + } + + protected override IEnumerator InvokeBefore(MethodInfo action, Test test, UnityTestExecutionContext context) + { + return (IEnumerator)Reflect.InvokeMethod(action, context.TestObject); + } + + protected override IEnumerator InvokeAfter(MethodInfo action, Test test, UnityTestExecutionContext context) + { + return (IEnumerator)Reflect.InvokeMethod(action, context.TestObject); + } + + protected override BeforeAfterTestCommandState GetState(UnityTestExecutionContext context) + { + return context.SetUpTearDownState; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableSetUpTearDownCommand.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableSetUpTearDownCommand.cs.meta new file mode 100644 index 0000000..2d1f6b7 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableSetUpTearDownCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dd85a35169d313840a0874aea1a28629 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableTestMethodCommand.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableTestMethodCommand.cs new file mode 100644 index 0000000..17be307 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableTestMethodCommand.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Commands; +using NUnit.Framework.Internal.Execution; +using UnityEngine.TestRunner.NUnitExtensions.Runner; +using UnityEngine.TestTools.TestRunner; + +namespace UnityEngine.TestTools +{ + internal class EnumerableTestMethodCommand : TestCommand, IEnumerableTestMethodCommand + { + private readonly TestMethod testMethod; + + public EnumerableTestMethodCommand(TestMethod testMethod) + : base(testMethod) + { + this.testMethod = testMethod; + } + + public IEnumerable ExecuteEnumerable(ITestExecutionContext context) + { + yield return null; + + var currentExecutingTestEnumerator = new TestEnumeratorWrapper(testMethod).GetEnumerator(context); + if (currentExecutingTestEnumerator != null) + { + var testEnumeraterYieldInstruction = new TestEnumerator(context, currentExecutingTestEnumerator); + + yield return testEnumeraterYieldInstruction; + + var enumerator = testEnumeraterYieldInstruction.Execute(); + + var executingEnumerator = ExecuteEnumerableAndRecordExceptions(enumerator, context); + while (executingEnumerator.MoveNext()) + { + yield return executingEnumerator.Current; + } + } + else + { + if (context.CurrentResult.ResultState != ResultState.Ignored) + { + context.CurrentResult.SetResult(ResultState.Success); + } + } + } + + private static IEnumerator ExecuteEnumerableAndRecordExceptions(IEnumerator enumerator, ITestExecutionContext context) + { + while (true) + { + try + { + if (!enumerator.MoveNext()) + { + break; + } + } + catch (Exception ex) + { + context.CurrentResult.RecordException(ex); + break; + } + + if (enumerator.Current is IEnumerator) + { + var current = (IEnumerator)enumerator.Current; + yield return ExecuteEnumerableAndRecordExceptions(current, context); + } + else + { + yield return enumerator.Current; + } + } + } + + public override TestResult Execute(ITestExecutionContext context) + { + throw new NotImplementedException("Use ExecuteEnumerable"); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableTestMethodCommand.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableTestMethodCommand.cs.meta new file mode 100644 index 0000000..d9b61f0 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/EnumerableTestMethodCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 19a6f000f81e24c4a826c1abd43e77c7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/ImmediateEnumerableCommand.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/ImmediateEnumerableCommand.cs new file mode 100644 index 0000000..a50a95e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/ImmediateEnumerableCommand.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Commands; +using UnityEngine.TestRunner.NUnitExtensions.Runner; + +namespace UnityEngine.TestTools +{ + internal class ImmediateEnumerableCommand : DelegatingTestCommand + { + public ImmediateEnumerableCommand(TestCommand innerCommand) + : base(innerCommand) { } + + public override TestResult Execute(ITestExecutionContext context) + { + if (innerCommand is IEnumerableTestMethodCommand) + { + var executeEnumerable = ((IEnumerableTestMethodCommand)innerCommand).ExecuteEnumerable(context); + foreach (var iterator in executeEnumerable) + { + if (iterator != null) + { + throw new Exception("Only null can be yielded at this point."); + } + } + return context.CurrentResult; + } + + return innerCommand.Execute(context); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/ImmediateEnumerableCommand.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/ImmediateEnumerableCommand.cs.meta new file mode 100644 index 0000000..ec993f6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/ImmediateEnumerableCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8349e42a2b30c7a4abd8678c203428ba +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/OuterUnityTestActionCommand.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/OuterUnityTestActionCommand.cs new file mode 100644 index 0000000..34c2d21 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/OuterUnityTestActionCommand.cs @@ -0,0 +1,49 @@ +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Commands; +using UnityEngine.TestRunner.NUnitExtensions.Runner; + +namespace UnityEngine.TestTools +{ + internal class OuterUnityTestActionCommand : BeforeAfterTestCommandBase + { + public OuterUnityTestActionCommand(TestCommand innerCommand) + : base(innerCommand, "BeforeTest", "AfterTest") + { + if (Test.TypeInfo.Type != null) + { + BeforeActions = GetUnityTestActionsFromMethod(Test.Method.MethodInfo); + AfterActions = BeforeActions; + } + } + + private static IOuterUnityTestAction[] GetUnityTestActionsFromMethod(MethodInfo method) + { + var attributes = method.GetCustomAttributes(false); + List actions = new List(); + foreach (var attribute in attributes) + { + if (attribute is IOuterUnityTestAction) + actions.Add(attribute as IOuterUnityTestAction); + } + return actions.ToArray(); + } + + protected override IEnumerator InvokeBefore(IOuterUnityTestAction action, Test test, UnityTestExecutionContext context) + { + return action.BeforeTest(test); + } + + protected override IEnumerator InvokeAfter(IOuterUnityTestAction action, Test test, UnityTestExecutionContext context) + { + return action.AfterTest(test); + } + + protected override BeforeAfterTestCommandState GetState(UnityTestExecutionContext context) + { + return context.OuterUnityTestActionState; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/OuterUnityTestActionCommand.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/OuterUnityTestActionCommand.cs.meta new file mode 100644 index 0000000..321a388 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/OuterUnityTestActionCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0d4fc309a0784294c8ab658b53b12320 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/SetUpTearDownCommand.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/SetUpTearDownCommand.cs new file mode 100644 index 0000000..b0f96cc --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/SetUpTearDownCommand.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections; +using System.Linq; +using System.Reflection; +using NUnit.Framework; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Commands; +using NUnit.Framework.Internal.Execution; +using UnityEngine.TestRunner.NUnitExtensions.Runner; + +namespace UnityEngine.TestTools +{ + internal class SetUpTearDownCommand : BeforeAfterTestCommandBase + { + public SetUpTearDownCommand(TestCommand innerCommand) + : base(innerCommand, "SetUp", "TearDown", true) + { + if (Test.TypeInfo.Type != null) + { + BeforeActions = GetMethodsWithAttributeFromFixture(Test.TypeInfo.Type, typeof(SetUpAttribute)); + AfterActions = GetMethodsWithAttributeFromFixture(Test.TypeInfo.Type, typeof(TearDownAttribute)).Reverse().ToArray(); + } + } + + private static MethodInfo[] GetMethodsWithAttributeFromFixture(Type fixtureType, Type setUpType) + { + MethodInfo[] methodsWithAttribute = Reflect.GetMethodsWithAttribute(fixtureType, setUpType, true); + return methodsWithAttribute.Where(x => x.ReturnType == typeof(void)).ToArray(); + } + + protected override IEnumerator InvokeBefore(MethodInfo action, Test test, UnityTestExecutionContext context) + { + Reflect.InvokeMethod(action, context.TestObject); + yield return null; + } + + protected override IEnumerator InvokeAfter(MethodInfo action, Test test, UnityTestExecutionContext context) + { + Reflect.InvokeMethod(action, context.TestObject); + yield return null; + } + + protected override BeforeAfterTestCommandState GetState(UnityTestExecutionContext context) + { + return null; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/SetUpTearDownCommand.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/SetUpTearDownCommand.cs.meta new file mode 100644 index 0000000..fbcea8b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/SetUpTearDownCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e0db3f3921670cd4ca2e925737c3fba4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/TestActionCommand.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/TestActionCommand.cs new file mode 100644 index 0000000..2b08fe1 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/TestActionCommand.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using NUnit.Framework; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Commands; +using UnityEngine.TestRunner.NUnitExtensions.Runner; + +namespace UnityEngine.TestTools +{ + internal class TestActionCommand : BeforeAfterTestCommandBase + { + public TestActionCommand(TestCommand innerCommand) + : base(innerCommand, "BeforeTest", "AfterTest", true) + { + if (Test.TypeInfo.Type != null) + { + BeforeActions = GetTestActionsFromMethod(Test.Method.MethodInfo); + AfterActions = BeforeActions; + } + } + + private static ITestAction[] GetTestActionsFromMethod(MethodInfo method) + { + var attributes = method.GetCustomAttributes(false); + List actions = new List(); + foreach (var attribute in attributes) + { + if (attribute is ITestAction) + actions.Add(attribute as ITestAction); + } + return actions.ToArray(); + } + + protected override IEnumerator InvokeBefore(ITestAction action, Test test, UnityTestExecutionContext context) + { + action.BeforeTest(test); + yield return null; + } + + protected override IEnumerator InvokeAfter(ITestAction action, Test test, UnityTestExecutionContext context) + { + action.AfterTest(test); + yield return null; + } + + protected override BeforeAfterTestCommandState GetState(UnityTestExecutionContext context) + { + return null; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/TestActionCommand.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/TestActionCommand.cs.meta new file mode 100644 index 0000000..0349788 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/TestActionCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2de8ba3b840049641897e0da7ce1d5cd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/TestCommandPcHelper.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/TestCommandPcHelper.cs new file mode 100644 index 0000000..62dc806 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/TestCommandPcHelper.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections; + +namespace UnityEngine.TestTools +{ + internal class TestCommandPcHelper + { + public virtual void SetEnumeratorPC(IEnumerator enumerator, int pc) + { + // Noop implementation used in playmode. + } + + public virtual int GetEnumeratorPC(IEnumerator enumerator) + { + return 0; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/TestCommandPcHelper.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/TestCommandPcHelper.cs.meta new file mode 100644 index 0000000..6f8f8f8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Commands/TestCommandPcHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 33e6b78c96bb0694e96383e3c56b7b54 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/ConstructDelegator.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/ConstructDelegator.cs new file mode 100644 index 0000000..1a6dd61 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/ConstructDelegator.cs @@ -0,0 +1,141 @@ +using System; +using System.Linq; +using NUnit.Framework.Internal; +using UnityEngine.TestRunner.NUnitExtensions.Runner; +using UnityEngine.TestTools.Logging; +using UnityEngine.TestTools.TestRunner; + +namespace UnityEngine.TestTools.NUnitExtensions +{ + /// + /// Specialization of BaseDelegator that makes sure objects are created on the MainThread. + /// It also deals with ScriptableObjects so that tests can survive assembly reload. + /// + internal class ConstructDelegator + { + private Type m_RequestedType; + private object[] m_Arguments; + + private ScriptableObject m_CurrentRunningTest; + private readonly IStateSerializer m_StateSerializer; + + protected Exception m_Exception; + protected object m_Result; + protected ITestExecutionContext m_Context; + + public ConstructDelegator(IStateSerializer stateSerializer) + { + m_StateSerializer = stateSerializer; + } + + protected object HandleResult() + { + SetCurrentTestContext(); + if (m_Exception != null) + { + var temp = m_Exception; + m_Exception = null; + throw temp; + } + var tempResult = m_Result; + m_Result = null; + return tempResult; + } + + protected void SetCurrentTestContext() + { + var prop = typeof(UnityTestExecutionContext).GetProperty("CurrentContext"); + if (prop != null) + { + prop.SetValue(null, m_Context, null); + } + } + + public object Delegate(Type type, object[] arguments) + { + AssertState(); + m_Context = UnityTestExecutionContext.CurrentContext; + + m_RequestedType = type; + m_Arguments = arguments; + + using (var logScope = new LogScope()) + { + Execute(logScope); + } + + return HandleResult(); + } + + private void AssertState() + { + if (m_RequestedType != null) + { + throw new Exception("Constructor not executed yet"); + } + } + + public bool HasAction() + { + return m_RequestedType != null; + } + + public void Execute(LogScope logScope) + { + try + { + if (typeof(ScriptableObject).IsAssignableFrom(m_RequestedType)) + { + if (m_CurrentRunningTest != null && m_RequestedType != m_CurrentRunningTest.GetType()) + { + DestroyCurrentTestObjectIfExists(); + } + if (m_CurrentRunningTest == null) + { + if (m_StateSerializer.CanRestoreFromScriptableObject(m_RequestedType)) + { + m_CurrentRunningTest = m_StateSerializer.RestoreScriptableObjectInstance(); + } + else + { + m_CurrentRunningTest = ScriptableObject.CreateInstance(m_RequestedType); + } + } + m_Result = m_CurrentRunningTest; + } + else + { + DestroyCurrentTestObjectIfExists(); + m_Result = Activator.CreateInstance(m_RequestedType, m_Arguments); + if (m_StateSerializer.CanRestoreFromJson(m_RequestedType)) + { + m_StateSerializer.RestoreClassFromJson(ref m_Result); + } + } + if (logScope.AnyFailingLogs()) + { + var failingLog = logScope.FailingLogs.First(); + throw new UnhandledLogMessageException(failingLog); + } + if (logScope.ExpectedLogs.Any()) + throw new UnexpectedLogMessageException(LogScope.Current.ExpectedLogs.Peek()); + } + catch (Exception e) + { + m_Exception = e; + } + finally + { + m_RequestedType = null; + m_Arguments = null; + } + } + + public void DestroyCurrentTestObjectIfExists() + { + if (m_CurrentRunningTest == null) + return; + Object.DestroyImmediate(m_CurrentRunningTest); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/ConstructDelegator.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/ConstructDelegator.cs.meta new file mode 100644 index 0000000..dbd68a8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/ConstructDelegator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b42e1db66fe9c634798674cb9e1df2ca +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters.meta new file mode 100644 index 0000000..7cad26c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c3de99f9efc582a48995bc8e8c2df418 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters/AssemblyNameFilter.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters/AssemblyNameFilter.cs new file mode 100644 index 0000000..a1f6803 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters/AssemblyNameFilter.cs @@ -0,0 +1,25 @@ +using System; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal.Filters; + +namespace UnityEngine.TestRunner.NUnitExtensions.Filters +{ + internal class AssemblyNameFilter : ValueMatchFilter + { + public AssemblyNameFilter(string assemblyName) : base(assemblyName) {} + + public override bool Match(ITest test) + { + string assemblyName = string.Empty; + //Assembly fullname is in the format "Assembly-name, meta data ...", so extract the name by looking for the comma + if (test.TypeInfo != null && test.TypeInfo.Assembly != null && test.TypeInfo.FullName != null) + assemblyName = test.TypeInfo.Assembly.FullName.Substring(0, test.TypeInfo.Assembly.FullName.IndexOf(',')).TrimEnd(','); + return ExpectedValue.Equals(assemblyName, StringComparison.OrdinalIgnoreCase); + } + + protected override string ElementName + { + get { return "id"; } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters/AssemblyNameFilter.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters/AssemblyNameFilter.cs.meta new file mode 100644 index 0000000..bee56e6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters/AssemblyNameFilter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 91319408591cec1478efd3c62f9f418a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters/CategoryFilterExtended.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters/CategoryFilterExtended.cs new file mode 100644 index 0000000..f060d47 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters/CategoryFilterExtended.cs @@ -0,0 +1,36 @@ +using System.Collections; +using System.Linq; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Filters; + +namespace UnityEngine.TestRunner.NUnitExtensions.Filters +{ + internal class CategoryFilterExtended : CategoryFilter + { + public static string k_DefaultCategory = "Uncategorized"; + + public CategoryFilterExtended(string name) : base(name) + { + } + + public override bool Match(ITest test) + { + IList testCategories = test.Properties[PropertyNames.Category].Cast().ToList(); + + if (test is TestMethod) + { + // Do not count tests with no attribute as Uncategorized if test fixture class has at least one attribute + // The test inherits the attribute from the test fixture + IList fixtureCategories = test.Parent.Properties[PropertyNames.Category].Cast().ToList(); + if (fixtureCategories.Count > 0) + return false; + } + + if (testCategories.Count == 0 && ExpectedValue == k_DefaultCategory && test is TestMethod) + return true; + + return base.Match(test); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters/CategoryFilterExtended.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters/CategoryFilterExtended.cs.meta new file mode 100644 index 0000000..8ff1134 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Filters/CategoryFilterExtended.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ebeedaa04bb53e24ba2e7fb6745e3fd3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/IAsyncTestAssemblyBuilder.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/IAsyncTestAssemblyBuilder.cs new file mode 100644 index 0000000..9058d9f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/IAsyncTestAssemblyBuilder.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; +using System.Reflection; +using NUnit.Framework.Api; +using NUnit.Framework.Interfaces; + +namespace UnityEngine.TestTools.NUnitExtensions +{ + internal interface IAsyncTestAssemblyBuilder : ITestAssemblyBuilder + { + IEnumerator BuildAsync(Assembly[] assemblies, TestPlatform[] testPlatforms, IDictionary options); + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/IAsyncTestAssemblyBuilder.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/IAsyncTestAssemblyBuilder.cs.meta new file mode 100644 index 0000000..e22e4e8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/IAsyncTestAssemblyBuilder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c3aa5c3d59b94854e843f10b75b3ad63 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/IStateSerializer.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/IStateSerializer.cs new file mode 100644 index 0000000..d4a3338 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/IStateSerializer.cs @@ -0,0 +1,12 @@ +using System; + +namespace UnityEngine.TestTools.NUnitExtensions +{ + internal interface IStateSerializer + { + ScriptableObject RestoreScriptableObjectInstance(); + void RestoreClassFromJson(ref object instance); + bool CanRestoreFromJson(Type requestedType); + bool CanRestoreFromScriptableObject(Type requestedType); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/IStateSerializer.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/IStateSerializer.cs.meta new file mode 100644 index 0000000..350aa38 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/IStateSerializer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5f875a14565308a40a5262d2504da705 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner.meta new file mode 100644 index 0000000..718bce8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 37888acc09d9ee848bf9559f06645c45 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs new file mode 100644 index 0000000..2efbd86 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs @@ -0,0 +1,342 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Commands; +using NUnit.Framework.Internal.Execution; +using UnityEngine.TestTools.Logging; +using UnityEngine.TestTools.TestRunner; + +namespace UnityEngine.TestRunner.NUnitExtensions.Runner +{ + internal class CompositeWorkItem : UnityWorkItem + { + private readonly TestSuite _suite; + private readonly TestSuiteResult _suiteResult; + private readonly ITestFilter _childFilter; + private TestCommand _setupCommand; + private TestCommand _teardownCommand; + + public List Children { get; private set; } + + private int _countOrder; + + private CountdownEvent _childTestCountdown; + + public CompositeWorkItem(TestSuite suite, ITestFilter childFilter, WorkItemFactory factory) + : base(suite, factory) + { + _suite = suite; + _suiteResult = Result as TestSuiteResult; + _childFilter = childFilter; + _countOrder = 0; + } + + protected override IEnumerable PerformWork() + { + InitializeSetUpAndTearDownCommands(); + + if (UnityTestExecutionContext.CurrentContext != null && m_DontRunRestoringResult && EditModeTestCallbacks.RestoringTestContext != null) + { + EditModeTestCallbacks.RestoringTestContext(); + } + + if (!CheckForCancellation()) + if (Test.RunState == RunState.Explicit && !_childFilter.IsExplicitMatch(Test)) + SkipFixture(ResultState.Explicit, GetSkipReason(), null); + else + switch (Test.RunState) + { + default: + case RunState.Runnable: + case RunState.Explicit: + Result.SetResult(ResultState.Success); + + CreateChildWorkItems(); + + if (Children.Count > 0) + { + if (!m_DontRunRestoringResult) + { + //This is needed to give the editor a chance to go out of playmode if needed before creating objects. + //If we do not, the objects could be automatically destroyed when exiting playmode and could result in errors later on + yield return null; + PerformOneTimeSetUp(); + } + + if (!CheckForCancellation()) + { + switch (Result.ResultState.Status) + { + case TestStatus.Passed: + foreach (var child in RunChildren()) + { + if (CheckForCancellation()) + { + yield break; + } + + yield return child; + } + break; + case TestStatus.Skipped: + case TestStatus.Inconclusive: + case TestStatus.Failed: + SkipChildren(_suite, Result.ResultState.WithSite(FailureSite.Parent), "OneTimeSetUp: " + Result.Message); + break; + } + } + + if (Context.ExecutionStatus != TestExecutionStatus.AbortRequested && !m_DontRunRestoringResult) + { + PerformOneTimeTearDown(); + } + } + break; + + case RunState.Skipped: + SkipFixture(ResultState.Skipped, GetSkipReason(), null); + break; + + case RunState.Ignored: + SkipFixture(ResultState.Ignored, GetSkipReason(), null); + break; + + case RunState.NotRunnable: + SkipFixture(ResultState.NotRunnable, GetSkipReason(), GetProviderStackTrace()); + break; + } + if (!ResultedInDomainReload) + { + WorkItemComplete(); + } + } + + private bool CheckForCancellation() + { + if (Context.ExecutionStatus != TestExecutionStatus.Running) + { + Result.SetResult(ResultState.Cancelled, "Test cancelled by user"); + return true; + } + + return false; + } + + private void InitializeSetUpAndTearDownCommands() + { + List setUpTearDownItems = _suite.TypeInfo != null + ? CommandBuilder.BuildSetUpTearDownList(_suite.TypeInfo.Type, typeof(OneTimeSetUpAttribute), typeof(OneTimeTearDownAttribute)) + : new List(); + + var actionItems = new List(); + foreach (ITestAction action in Actions) + { + bool applyToSuite = (action.Targets & ActionTargets.Suite) == ActionTargets.Suite + || action.Targets == ActionTargets.Default && !(Test is ParameterizedMethodSuite); + + bool applyToTest = (action.Targets & ActionTargets.Test) == ActionTargets.Test + && !(Test is ParameterizedMethodSuite); + + if (applyToSuite) + actionItems.Add(new TestActionItem(action)); + + if (applyToTest) + Context.UpstreamActions.Add(action); + } + + _setupCommand = CommandBuilder.MakeOneTimeSetUpCommand(_suite, setUpTearDownItems, actionItems); + _teardownCommand = CommandBuilder.MakeOneTimeTearDownCommand(_suite, setUpTearDownItems, actionItems); + } + + private void PerformOneTimeSetUp() + { + var logScope = new LogScope(); + try + { + _setupCommand.Execute(Context); + } + catch (Exception ex) + { + if (ex is NUnitException || ex is TargetInvocationException) + ex = ex.InnerException; + + Result.RecordException(ex, FailureSite.SetUp); + } + + if (logScope.AnyFailingLogs()) + { + Result.RecordException(new UnhandledLogMessageException(logScope.FailingLogs.First())); + } + logScope.Dispose(); + } + + private IEnumerable RunChildren() + { + int childCount = Children.Count; + if (childCount == 0) + throw new InvalidOperationException("RunChildren called but item has no children"); + + _childTestCountdown = new CountdownEvent(childCount); + + foreach (UnityWorkItem child in Children) + { + if (CheckForCancellation()) + { + yield break; + } + + var unityTestExecutionContext = new UnityTestExecutionContext(Context); + child.InitializeContext(unityTestExecutionContext); + + var enumerable = child.Execute().GetEnumerator(); + + while (true) + { + if (!enumerable.MoveNext()) + { + break; + } + ResultedInDomainReload |= child.ResultedInDomainReload; + yield return enumerable.Current; + } + + _suiteResult.AddResult(child.Result); + childCount--; + } + + if (childCount > 0) + { + while (childCount-- > 0) + CountDownChildTest(); + } + } + + private void CreateChildWorkItems() + { + Children = new List(); + var testSuite = _suite; + + foreach (ITest test in testSuite.Tests) + { + if (_childFilter.Pass(test)) + { + var child = m_Factory.Create(test, _childFilter); + + if (test.Properties.ContainsKey(PropertyNames.Order)) + { + Children.Insert(0, child); + _countOrder++; + } + else + { + Children.Add(child); + } + } + } + + if (_countOrder != 0) SortChildren(); + } + + private class UnityWorkItemOrderComparer : IComparer + { + public int Compare(UnityWorkItem x, UnityWorkItem y) + { + var xKey = int.MaxValue; + var yKey = int.MaxValue; + + if (x.Test.Properties.ContainsKey(PropertyNames.Order)) + xKey = (int)x.Test.Properties[PropertyNames.Order][0]; + + if (y.Test.Properties.ContainsKey(PropertyNames.Order)) + yKey = (int)y.Test.Properties[PropertyNames.Order][0]; + + return xKey.CompareTo(yKey); + } + } + + private void SortChildren() + { + Children.Sort(0, _countOrder, new UnityWorkItemOrderComparer()); + } + + private void SkipFixture(ResultState resultState, string message, string stackTrace) + { + Result.SetResult(resultState.WithSite(FailureSite.SetUp), message, StackFilter.Filter(stackTrace)); + SkipChildren(_suite, resultState.WithSite(FailureSite.Parent), "OneTimeSetUp: " + message); + } + + private void SkipChildren(TestSuite suite, ResultState resultState, string message) + { + foreach (Test child in suite.Tests) + { + if (_childFilter.Pass(child)) + { + Context.Listener.TestStarted(child); + TestResult childResult = child.MakeTestResult(); + childResult.SetResult(resultState, message); + _suiteResult.AddResult(childResult); + + if (child.IsSuite) + SkipChildren((TestSuite)child, resultState, message); + + Context.Listener.TestFinished(childResult); + } + } + } + + private void PerformOneTimeTearDown() + { + _teardownCommand.Execute(Context); + } + + private string GetSkipReason() + { + return (string)Test.Properties.Get(PropertyNames.SkipReason); + } + + private string GetProviderStackTrace() + { + return (string)Test.Properties.Get(PropertyNames.ProviderStackTrace); + } + + private void CountDownChildTest() + { + _childTestCountdown.Signal(); + if (_childTestCountdown.CurrentCount == 0) + { + if (Context.ExecutionStatus != TestExecutionStatus.AbortRequested) + PerformOneTimeTearDown(); + + foreach (var childResult in _suiteResult.Children) + if (childResult.ResultState == ResultState.Cancelled) + { + this.Result.SetResult(ResultState.Cancelled, "Cancelled by user"); + break; + } + + WorkItemComplete(); + } + } + + public override void Cancel(bool force) + { + if (Children == null) + return; + + foreach (var child in Children) + { + var ctx = child.Context; + if (ctx != null) + ctx.ExecutionStatus = force ? TestExecutionStatus.AbortRequested : TestExecutionStatus.StopRequested; + + if (child.State == WorkItemState.Running) + child.Cancel(force); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs.meta new file mode 100644 index 0000000..148e65b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 110d5035a36a6a34580fb65bb40cd78f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/CoroutineTestWorkItem.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/CoroutineTestWorkItem.cs new file mode 100644 index 0000000..2574e77 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/CoroutineTestWorkItem.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Commands; +using NUnit.Framework.Internal.Execution; +using UnityEngine.TestTools.Utils; + +namespace UnityEngine.TestRunner.NUnitExtensions.Runner +{ + internal class CoroutineTestWorkItem : UnityWorkItem + { + private static MonoBehaviour m_MonoBehaviourCoroutineRunner; + private TestCommand m_Command; + + public static MonoBehaviour monoBehaviourCoroutineRunner + { + get + { + if (m_MonoBehaviourCoroutineRunner == null) + { + throw new NullReferenceException("MonoBehaviour coroutine runner not set"); + } + return m_MonoBehaviourCoroutineRunner; + } + set { m_MonoBehaviourCoroutineRunner = value; } + } + + public CoroutineTestWorkItem(TestMethod test, ITestFilter filter) + : base(test, null) + { + m_Command = m_Command = TestCommandBuilder.BuildTestCommand(test, filter); + } + + protected override IEnumerable PerformWork() + { + if (m_Command is SkipCommand) + { + m_Command.Execute(Context); + Result = Context.CurrentResult; + WorkItemComplete(); + yield break; + } + + if (m_Command is ApplyChangesToContextCommand) + { + var applyChangesToContextCommand = (ApplyChangesToContextCommand)m_Command; + applyChangesToContextCommand.ApplyChanges(Context); + m_Command = applyChangesToContextCommand.GetInnerCommand(); + } + + var enumerableTestMethodCommand = (IEnumerableTestMethodCommand)m_Command; + try + { + var executeEnumerable = enumerableTestMethodCommand.ExecuteEnumerable(Context).GetEnumerator(); + + var coroutineRunner = new CoroutineRunner(monoBehaviourCoroutineRunner, Context); + yield return coroutineRunner.HandleEnumerableTest(executeEnumerable); + + if (coroutineRunner.HasFailedWithTimeout()) + { + Context.CurrentResult.SetResult(ResultState.Failure, string.Format("Test exceeded Timeout value of {0}ms", Context.TestCaseTimeout)); + } + + while (executeEnumerable.MoveNext()) {} + + Result = Context.CurrentResult; + } + finally + { + WorkItemComplete(); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/CoroutineTestWorkItem.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/CoroutineTestWorkItem.cs.meta new file mode 100644 index 0000000..dabb0f2 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/CoroutineTestWorkItem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b557515fff172984e8c4400b43f1c631 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/DefaultTestWorkItem.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/DefaultTestWorkItem.cs new file mode 100644 index 0000000..5acf8bc --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/DefaultTestWorkItem.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections; +using System.Linq; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Commands; +using NUnit.Framework.Internal.Execution; +using UnityEngine.TestTools; +using SetUpTearDownCommand = NUnit.Framework.Internal.Commands.SetUpTearDownCommand; +using TestActionCommand = NUnit.Framework.Internal.Commands.TestActionCommand; + +namespace UnityEngine.TestRunner.NUnitExtensions.Runner +{ + internal class EditModeTestCallbacks + { + public static Action RestoringTestContext { get; set; } + } + + internal class DefaultTestWorkItem : UnityWorkItem + { + private TestCommand _command; + + public DefaultTestWorkItem(TestMethod test, ITestFilter filter) + : base(test, null) + { + _command = TestCommandBuilder.BuildTestCommand(test, filter); + } + + protected override IEnumerable PerformWork() + { + if (m_DontRunRestoringResult && EditModeTestCallbacks.RestoringTestContext != null) + { + EditModeTestCallbacks.RestoringTestContext(); + Result = Context.CurrentResult; + yield break; + } + + try + { + if (_command is SkipCommand || _command is FailCommand) + { + Result = _command.Execute(Context); + yield break; + } + + if (!(_command is IEnumerableTestMethodCommand)) + { + Debug.LogError("Cannot perform work on " + _command.GetType().Name); + yield break; + } + + foreach (var workItemStep in ((IEnumerableTestMethodCommand)_command).ExecuteEnumerable(Context)) + { + ResultedInDomainReload = false; + + if (workItemStep is IEditModeTestYieldInstruction) + { + var editModeTestYieldInstruction = (IEditModeTestYieldInstruction)workItemStep; + yield return editModeTestYieldInstruction; + var enumerator = editModeTestYieldInstruction.Perform(); + while (true) + { + bool moveNext; + try + { + moveNext = enumerator.MoveNext(); + } + catch (Exception e) + { + Context.CurrentResult.RecordException(e); + break; + } + + if (!moveNext) + { + break; + } + + yield return null; + } + } + else + { + yield return workItemStep; + } + } + + Result = Context.CurrentResult; + } + finally + { + WorkItemComplete(); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/DefaultTestWorkItem.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/DefaultTestWorkItem.cs.meta new file mode 100644 index 0000000..a880ec1 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/DefaultTestWorkItem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c7cfda246e604b945b12b7afedb094ce +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/FailCommand.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/FailCommand.cs new file mode 100644 index 0000000..0c31ded --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/FailCommand.cs @@ -0,0 +1,34 @@ + +using System.Collections; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Commands; + +namespace UnityEngine.TestRunner.NUnitExtensions.Runner +{ + internal class FailCommand : TestCommand, IEnumerableTestMethodCommand + { + private ResultState m_ResultState; + private string m_Message; + + public FailCommand(Test test, ResultState resultState, string message) + : base(test) + { + m_ResultState = resultState; + m_Message = message; + } + + public override TestResult Execute(ITestExecutionContext context) + { + context.CurrentResult.SetResult(m_ResultState, m_Message); + return context.CurrentResult; + } + + public IEnumerable ExecuteEnumerable(ITestExecutionContext context) + { + context.CurrentResult.SetResult(m_ResultState, m_Message); + yield return null; + } + } + +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/FailCommand.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/FailCommand.cs.meta new file mode 100644 index 0000000..b0f7840 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/FailCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 68e5dc8bfd5d72647a93b7f2e1da831a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/IEnumerableTestMethodCommand.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/IEnumerableTestMethodCommand.cs new file mode 100644 index 0000000..d62979a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/IEnumerableTestMethodCommand.cs @@ -0,0 +1,10 @@ +using System.Collections; +using NUnit.Framework.Internal; + +namespace UnityEngine.TestRunner.NUnitExtensions.Runner +{ + internal interface IEnumerableTestMethodCommand + { + IEnumerable ExecuteEnumerable(ITestExecutionContext context); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/IEnumerableTestMethodCommand.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/IEnumerableTestMethodCommand.cs.meta new file mode 100644 index 0000000..29ed5a5 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/IEnumerableTestMethodCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dbd43d8a3b8122d4e89b055f53382b11 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/PlaymodeWorkItemFactory.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/PlaymodeWorkItemFactory.cs new file mode 100644 index 0000000..bdb55fe --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/PlaymodeWorkItemFactory.cs @@ -0,0 +1,13 @@ +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; + +namespace UnityEngine.TestRunner.NUnitExtensions.Runner +{ + internal class PlaymodeWorkItemFactory : WorkItemFactory + { + protected override UnityWorkItem Create(TestMethod method, ITestFilter filter, ITest loadedTest) + { + return new CoroutineTestWorkItem(method, filter); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/PlaymodeWorkItemFactory.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/PlaymodeWorkItemFactory.cs.meta new file mode 100644 index 0000000..42a71f6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/PlaymodeWorkItemFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7ef6801a8b664544aa9f2ab1bc1f8b60 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/RestoreTestContextAfterDomainReload.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/RestoreTestContextAfterDomainReload.cs new file mode 100644 index 0000000..4171ed8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/RestoreTestContextAfterDomainReload.cs @@ -0,0 +1,4 @@ +namespace UnityEngine.TestRunner.NUnitExtensions.Runner +{ + internal class RestoreTestContextAfterDomainReload {} +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/RestoreTestContextAfterDomainReload.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/RestoreTestContextAfterDomainReload.cs.meta new file mode 100644 index 0000000..eaf8bc2 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/RestoreTestContextAfterDomainReload.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 26721f9940339264fb14bdbfe1290e21 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/TestCommandBuilder.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/TestCommandBuilder.cs new file mode 100644 index 0000000..7cf2103 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/TestCommandBuilder.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections; +using System.Linq; +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Commands; +using UnityEngine.TestTools; + +namespace UnityEngine.TestRunner.NUnitExtensions.Runner +{ + internal static class TestCommandBuilder + { + public static TestCommand BuildTestCommand(TestMethod test, ITestFilter filter) + { + if (test.RunState != RunState.Runnable && + !(test.RunState == RunState.Explicit && filter.IsExplicitMatch(test))) + { + return new SkipCommand(test); + } + + var testReturnsIEnumerator = test.Method.ReturnType.Type == typeof(IEnumerator); + + TestCommand command; + if (!testReturnsIEnumerator) + { + command = new TestMethodCommand(test); + } + else + { + command = new EnumerableTestMethodCommand(test); + } + + command = new UnityLogCheckDelegatingCommand(command); + foreach (var wrapper in test.Method.GetCustomAttributes(true)) + { + command = wrapper.Wrap(command); + if (command == null) + { + var message = String.Format("IWrapTestMethod implementation '{0}' returned null as command.", + wrapper.GetType().FullName); + return new FailCommand(test, ResultState.Failure, message); + } + + if (testReturnsIEnumerator && !(command is IEnumerableTestMethodCommand)) + { + command = TryReplaceWithEnumerableCommand(command); + if (command != null) + { + continue; + } + + var message = String.Format("'{0}' is not supported on {1} as it does not handle returning IEnumerator.", + wrapper.GetType().FullName, + GetTestBuilderName(test)); + return new FailCommand(test, ResultState.Failure, message); + } + } + + command = new UnityEngine.TestTools.TestActionCommand(command); + command = new UnityEngine.TestTools.SetUpTearDownCommand(command); + + if (!testReturnsIEnumerator) + { + command = new ImmediateEnumerableCommand(command); + } + + foreach (var wrapper in test.Method.GetCustomAttributes(true)) + { + command = wrapper.Wrap(command); + if (command == null) + { + var message = String.Format("IWrapSetUpTearDown implementation '{0}' returned null as command.", + wrapper.GetType().FullName); + return new FailCommand(test, ResultState.Failure, message); + } + + if (testReturnsIEnumerator && !(command is IEnumerableTestMethodCommand)) + { + command = TryReplaceWithEnumerableCommand(command); + if (command != null) + { + continue; + } + + var message = String.Format("'{0}' is not supported on {1} as it does not handle returning IEnumerator.", + wrapper.GetType().FullName, + GetTestBuilderName(test)); + return new FailCommand(test, ResultState.Failure, message); + } + } + + command = new EnumerableSetUpTearDownCommand(command); + command = new OuterUnityTestActionCommand(command); + + IApplyToContext[] changes = test.Method.GetCustomAttributes(true); + if (changes.Length > 0) + { + command = new EnumerableApplyChangesToContextCommand(command, changes); + } + + return command; + } + + private static string GetTestBuilderName(TestMethod testMethod) + { + return new[] + { + testMethod.Method.GetCustomAttributes(true).Select(attribute => attribute.GetType().Name), + testMethod.Method.GetCustomAttributes(true).Select(attribute => attribute.GetType().Name) + }.SelectMany(v => v).FirstOrDefault(); + } + + private static TestCommand TryReplaceWithEnumerableCommand(TestCommand command) + { + switch (command.GetType().Name) + { + case nameof(RepeatAttribute.RepeatedTestCommand): + return new EnumerableRepeatedTestCommand(command as RepeatAttribute.RepeatedTestCommand); + case nameof(RetryAttribute.RetryCommand): + return new EnumerableRetryTestCommand(command as RetryAttribute.RetryCommand); + default: + return null; + } + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/TestCommandBuilder.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/TestCommandBuilder.cs.meta new file mode 100644 index 0000000..2c4a37b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/TestCommandBuilder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f40df9c8cf926b241b093a37028d8815 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityLogCheckDelegatingCommand.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityLogCheckDelegatingCommand.cs new file mode 100644 index 0000000..1081e06 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityLogCheckDelegatingCommand.cs @@ -0,0 +1,143 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Commands; +using UnityEngine.TestTools; +using UnityEngine.TestTools.Logging; +using UnityEngine.TestTools.TestRunner; + +namespace UnityEngine.TestRunner.NUnitExtensions.Runner +{ + class UnityLogCheckDelegatingCommand : DelegatingTestCommand, IEnumerableTestMethodCommand + { + static Dictionary s_AttributeCache = new Dictionary(); + + public UnityLogCheckDelegatingCommand(TestCommand innerCommand) + : base(innerCommand) {} + + public override TestResult Execute(ITestExecutionContext context) + { + using (var logScope = new LogScope()) + { + if (ExecuteAndCheckLog(logScope, context.CurrentResult, () => innerCommand.Execute(context))) + PostTestValidation(logScope, innerCommand, context.CurrentResult); + } + + return context.CurrentResult; + } + + public IEnumerable ExecuteEnumerable(ITestExecutionContext context) + { + if (!(innerCommand is IEnumerableTestMethodCommand enumerableTestMethodCommand)) + { + Execute(context); + yield break; + } + + using (var logScope = new LogScope()) + { + IEnumerable executeEnumerable = null; + + if (!ExecuteAndCheckLog(logScope, context.CurrentResult, + () => executeEnumerable = enumerableTestMethodCommand.ExecuteEnumerable(context))) + yield break; + + foreach (var step in executeEnumerable) + { + // do not check expected logs here - we want to permit expecting and receiving messages to run + // across frames. (but we do always want to catch a fail immediately.) + if (!CheckFailingLogs(logScope, context.CurrentResult)) + yield break; + + yield return step; + } + + if (!CheckLogs(context.CurrentResult, logScope)) + yield break; + + PostTestValidation(logScope, innerCommand, context.CurrentResult); + } + } + + static bool CaptureException(TestResult result, Action action) + { + try + { + action(); + return true; + } + catch (Exception e) + { + result.RecordException(e); + return false; + } + } + + static bool ExecuteAndCheckLog(LogScope logScope, TestResult result, Action action) + => CaptureException(result, action) && CheckLogs(result, logScope); + + static void PostTestValidation(LogScope logScope, TestCommand command, TestResult result) + { + if (MustExpect(command.Test.Method.MethodInfo)) + CaptureException(result, logScope.NoUnexpectedReceived); + } + + static bool CheckLogs(TestResult result, LogScope logScope) + => CheckFailingLogs(logScope, result) && CheckExpectedLogs(logScope, result); + + static bool CheckFailingLogs(LogScope logScope, TestResult result) + { + if (!logScope.AnyFailingLogs()) + return true; + + var failingLog = logScope.FailingLogs.First(); + result.RecordException(new UnhandledLogMessageException(failingLog)); + return false; + } + + static bool CheckExpectedLogs(LogScope logScope, TestResult result) + { + if (!logScope.ExpectedLogs.Any()) + return true; + + var expectedLog = logScope.ExpectedLogs.Peek(); + result.RecordException(new UnexpectedLogMessageException(expectedLog)); + return false; + } + + static bool MustExpect(MemberInfo method) + { + // method + + var methodAttr = method.GetCustomAttributes(true).FirstOrDefault(); + if (methodAttr != null) + return methodAttr.MustExpect; + + // fixture + + var fixture = method.DeclaringType; + if (!s_AttributeCache.TryGetValue(fixture, out var mustExpect)) + { + var fixtureAttr = fixture.GetCustomAttributes(true).FirstOrDefault(); + mustExpect = s_AttributeCache[fixture] = fixtureAttr?.MustExpect; + } + + if (mustExpect != null) + return mustExpect.Value; + + // assembly + + var assembly = fixture.Assembly; + if (!s_AttributeCache.TryGetValue(assembly, out mustExpect)) + { + var assemblyAttr = assembly.GetCustomAttributes().FirstOrDefault(); + mustExpect = s_AttributeCache[assembly] = assemblyAttr?.MustExpect; + } + + return mustExpect == true; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityLogCheckDelegatingCommand.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityLogCheckDelegatingCommand.cs.meta new file mode 100644 index 0000000..42b3b73 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityLogCheckDelegatingCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 48230e4e90fb4d14a9d56bddea898413 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityTestAssemblyRunner.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityTestAssemblyRunner.cs new file mode 100644 index 0000000..dbb60c8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityTestAssemblyRunner.cs @@ -0,0 +1,98 @@ +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using NUnit; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using UnityEngine.TestTools; +using UnityEngine.TestTools.NUnitExtensions; + +namespace UnityEngine.TestRunner.NUnitExtensions.Runner +{ + internal interface IUnityTestAssemblyRunner + { + ITest LoadedTest { get; } + ITestResult Result { get; } + bool IsTestLoaded { get; } + bool IsTestRunning { get; } + bool IsTestComplete { get; } + UnityWorkItem TopLevelWorkItem { get; set; } + UnityTestExecutionContext GetCurrentContext(); + ITest Load(Assembly[] assemblies, TestPlatform testPlatform, IDictionary settings); + IEnumerable Run(ITestListener listener, ITestFilter filter); + void StopRun(); + } + + internal class UnityTestAssemblyRunner : IUnityTestAssemblyRunner + { + private readonly UnityTestAssemblyBuilder unityBuilder; + private readonly WorkItemFactory m_Factory; + + protected UnityTestExecutionContext Context { get; set; } + + public UnityTestExecutionContext GetCurrentContext() + { + return UnityTestExecutionContext.CurrentContext; + } + + protected IDictionary Settings { get; set; } + public ITest LoadedTest { get; protected set; } + + public ITestResult Result + { + get { return TopLevelWorkItem == null ? null : TopLevelWorkItem.Result; } + } + + public bool IsTestLoaded + { + get { return LoadedTest != null; } + } + + public bool IsTestRunning + { + get { return TopLevelWorkItem != null && TopLevelWorkItem.State == NUnit.Framework.Internal.Execution.WorkItemState.Running; } + } + public bool IsTestComplete + { + get { return TopLevelWorkItem != null && TopLevelWorkItem.State == NUnit.Framework.Internal.Execution.WorkItemState.Complete; } + } + + public UnityTestAssemblyRunner(UnityTestAssemblyBuilder builder, WorkItemFactory factory) + { + unityBuilder = builder; + m_Factory = factory; + Context = new UnityTestExecutionContext(); + } + + public ITest Load(Assembly[] assemblies, TestPlatform testPlatform, IDictionary settings) + { + Settings = settings; + + if (settings.ContainsKey(FrameworkPackageSettings.RandomSeed)) + Randomizer.InitialSeed = (int)settings[FrameworkPackageSettings.RandomSeed]; + + return LoadedTest = unityBuilder.Build(assemblies, Enumerable.Repeat(testPlatform, assemblies.Length).ToArray(), settings); + } + + public IEnumerable Run(ITestListener listener, ITestFilter filter) + { + TopLevelWorkItem = m_Factory.Create(LoadedTest, filter); + TopLevelWorkItem.InitializeContext(Context); + UnityTestExecutionContext.CurrentContext = Context; + Context.Listener = listener; + + return TopLevelWorkItem.Execute(); + } + + public UnityWorkItem TopLevelWorkItem { get; set; } + + public void StopRun() + { + if (IsTestRunning) + { + TopLevelWorkItem.Cancel(false); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityTestAssemblyRunner.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityTestAssemblyRunner.cs.meta new file mode 100644 index 0000000..2277fc0 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityTestAssemblyRunner.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 874e40a588dbb1e48bc128d686337d4e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityTestExecutionContext.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityTestExecutionContext.cs new file mode 100644 index 0000000..ca17b70 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityTestExecutionContext.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using NUnit.Framework; +using NUnit.Framework.Constraints; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Execution; +using UnityEngine.TestTools; + +namespace UnityEngine.TestRunner.NUnitExtensions.Runner +{ + internal class UnityTestExecutionContext : ITestExecutionContext + { + private readonly UnityTestExecutionContext _priorContext; + private TestResult _currentResult; + private int _assertCount; + + public static UnityTestExecutionContext CurrentContext { get; set; } + + public UnityTestExecutionContext Context { get; private set; } + + public Test CurrentTest { get; set; } + public DateTime StartTime { get; set; } + public long StartTicks { get; set; } + public TestResult CurrentResult + { + get { return _currentResult; } + set + { + _currentResult = value; + if (value != null) + OutWriter = value.OutWriter; + } + } + + public object TestObject { get; set; } + public string WorkDirectory { get; set; } + + + private TestExecutionStatus _executionStatus; + public TestExecutionStatus ExecutionStatus + { + get + { + // ExecutionStatus may have been set to StopRequested or AbortRequested + // in a prior context. If so, reflect the same setting in this context. + if (_executionStatus == TestExecutionStatus.Running && _priorContext != null) + _executionStatus = _priorContext.ExecutionStatus; + + return _executionStatus; + } + set + { + _executionStatus = value; + + // Push the same setting up to all prior contexts + if (_priorContext != null) + _priorContext.ExecutionStatus = value; + } + } + + public List UpstreamActions { get; private set; } + public int TestCaseTimeout { get; set; } + public CultureInfo CurrentCulture { get; set; } + public CultureInfo CurrentUICulture { get; set; } + public ITestListener Listener { get; set; } + + public UnityTestExecutionContext() + { + UpstreamActions = new List(); + CurrentContext = this; + } + + public UnityTestExecutionContext(UnityTestExecutionContext other) + { + _priorContext = other; + + CurrentTest = other.CurrentTest; + CurrentResult = other.CurrentResult; + TestObject = other.TestObject; + WorkDirectory = other.WorkDirectory; + Listener = other.Listener; + TestCaseTimeout = other.TestCaseTimeout; + UpstreamActions = new List(other.UpstreamActions); + SetUpTearDownState = other.SetUpTearDownState; + OuterUnityTestActionState = other.OuterUnityTestActionState; + + TestContext.CurrentTestExecutionContext = this; + + CurrentCulture = other.CurrentCulture; + CurrentUICulture = other.CurrentUICulture; + CurrentContext = this; + } + + public TextWriter OutWriter { get; private set; } + public bool StopOnError { get; set; } + + public IWorkItemDispatcher Dispatcher { get; set; } + + public ParallelScope ParallelScope { get; set; } + public string WorkerId { get; private set; } + public Randomizer RandomGenerator { get; private set; } + public ValueFormatter CurrentValueFormatter { get; private set; } + public bool IsSingleThreaded { get; set; } + public BeforeAfterTestCommandState SetUpTearDownState { get; set; } + public BeforeAfterTestCommandState OuterUnityTestActionState { get; set; } + public int EnumerableRepeatedTestState { get; set; } + public int EnumerableRetryTestState { get; set; } + + internal int AssertCount + { + get + { + return _assertCount; + } + } + + public void IncrementAssertCount() + { + _assertCount += 1; + } + + public void AddFormatter(ValueFormatterFactory formatterFactory) + { + throw new NotImplementedException(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityTestExecutionContext.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityTestExecutionContext.cs.meta new file mode 100644 index 0000000..f218a3d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityTestExecutionContext.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 59ff995fabb3bac45afa0f96f333e5dc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityWorkItem.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityWorkItem.cs new file mode 100644 index 0000000..a4593db --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityWorkItem.cs @@ -0,0 +1,113 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Execution; + +namespace UnityEngine.TestRunner.NUnitExtensions.Runner +{ + internal abstract class UnityWorkItem + { + protected readonly WorkItemFactory m_Factory; + protected bool m_ExecuteTestStartEvent; + protected bool m_DontRunRestoringResult; + public event EventHandler Completed; + + public bool ResultedInDomainReload { get; internal set; } + + public UnityTestExecutionContext Context { get; private set; } + + public Test Test { get; private set; } + + public TestResult Result { get; protected set; } + + public WorkItemState State { get; private set; } + + public List Actions { get; private set; } + + protected UnityWorkItem(Test test, WorkItemFactory factory) + { + m_Factory = factory; + Test = test; + Actions = new List(); + Result = test.MakeTestResult(); + State = WorkItemState.Ready; + m_ExecuteTestStartEvent = ShouldExecuteStartEvent(); + m_DontRunRestoringResult = ShouldRestore(test); + } + + protected static bool ShouldRestore(ITest loadedTest) + { + return UnityWorkItemDataHolder.alreadyExecutedTests != null && UnityWorkItemDataHolder.alreadyExecutedTests.Contains(loadedTest.FullName); + } + + protected bool ShouldExecuteStartEvent() + { + return UnityWorkItemDataHolder.alreadyStartedTests != null && UnityWorkItemDataHolder.alreadyStartedTests.All(x => x != Test.FullName) && !ShouldRestore(Test); + } + + protected abstract IEnumerable PerformWork(); + + public void InitializeContext(UnityTestExecutionContext context) + { + Context = context; + + if (Test is TestAssembly) + Actions.AddRange(ActionsHelper.GetActionsFromTestAssembly((TestAssembly)Test)); + else if (Test is ParameterizedMethodSuite) + Actions.AddRange(ActionsHelper.GetActionsFromTestMethodInfo(Test.Method)); + else if (Test.TypeInfo != null) + Actions.AddRange(ActionsHelper.GetActionsFromTypesAttributes(Test.TypeInfo.Type)); + } + + public virtual IEnumerable Execute() + { + Context.CurrentTest = this.Test; + Context.CurrentResult = this.Result; + + if (m_ExecuteTestStartEvent) + { + Context.Listener.TestStarted(Test); + } + + Context.StartTime = DateTime.UtcNow; + Context.StartTicks = Stopwatch.GetTimestamp(); + + State = WorkItemState.Running; + + return PerformWork(); + } + + protected void WorkItemComplete() + { + State = WorkItemState.Complete; + + Result.StartTime = Context.StartTime; + Result.EndTime = DateTime.UtcNow; + + long tickCount = Stopwatch.GetTimestamp() - Context.StartTicks; + double seconds = (double)tickCount / Stopwatch.Frequency; + Result.Duration = seconds; + + //Result.AssertCount += Context.AssertCount; + + Context.Listener.TestFinished(Result); + + if (Completed != null) + Completed(this, EventArgs.Empty); + + Context.TestObject = null; + Test.Fixture = null; + } + + public virtual void Cancel(bool force) + { + Result.SetResult(ResultState.Cancelled, "Cancelled by user"); + Context.Listener.TestFinished(Result); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityWorkItem.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityWorkItem.cs.meta new file mode 100644 index 0000000..e0b4496 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityWorkItem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 79ced2556f0af814a840b86232613ff1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityWorkItemDataHolder.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityWorkItemDataHolder.cs new file mode 100644 index 0000000..dc9a3d1 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityWorkItemDataHolder.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace UnityEngine.TestRunner.NUnitExtensions.Runner +{ + internal class UnityWorkItemDataHolder + { + public static List alreadyStartedTests = new List(); + public static List alreadyExecutedTests; + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityWorkItemDataHolder.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityWorkItemDataHolder.cs.meta new file mode 100644 index 0000000..77b31f2 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/UnityWorkItemDataHolder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5b3e90046c38f1d4dad2e0d5a79e871c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/WorkItemFactory.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/WorkItemFactory.cs new file mode 100644 index 0000000..89683ac --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/WorkItemFactory.cs @@ -0,0 +1,28 @@ +using System.Collections; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; + +namespace UnityEngine.TestRunner.NUnitExtensions.Runner +{ + internal abstract class WorkItemFactory + { + public UnityWorkItem Create(ITest loadedTest, ITestFilter filter) + { + TestSuite suite = loadedTest as TestSuite; + if (suite != null) + { + return new CompositeWorkItem(suite, filter, this); + } + + var testMethod = (TestMethod)loadedTest; + if (testMethod.Method.ReturnType.Type != typeof(IEnumerator)) + { + return new DefaultTestWorkItem(testMethod, filter); + } + + return Create(testMethod, filter, loadedTest); + } + + protected abstract UnityWorkItem Create(TestMethod method, ITestFilter filter, ITest loadedTest); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/WorkItemFactory.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/WorkItemFactory.cs.meta new file mode 100644 index 0000000..e22ce95 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/Runner/WorkItemFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5c15bf0966eb95847a4260d830a30d30 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/TestExtensions.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/TestExtensions.cs new file mode 100644 index 0000000..a326004 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/TestExtensions.cs @@ -0,0 +1,146 @@ +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using UnityEngine.TestRunner.NUnitExtensions.Filters; + +namespace UnityEngine.TestRunner.NUnitExtensions +{ + internal static class TestExtensions + { + private static IEnumerable GetTestCategories(this ITest test) + { + var categories = test.Properties[PropertyNames.Category].Cast().ToList(); + if (categories.Count == 0 && test is TestMethod) + { + // only mark tests as Uncategorized if the test fixture doesn't have a category, + // otherwise the test inherits the Fixture category + var fixtureCategories = test.Parent.Properties[PropertyNames.Category].Cast().ToList(); + if (fixtureCategories.Count == 0) + categories.Add(CategoryFilterExtended.k_DefaultCategory); + } + return categories; + } + + public static bool HasCategory(this ITest test, string[] categoryFilter) + { + var categories = test.GetAllCategoriesFromTest().Distinct(); + return categoryFilter.Any(c => categories.Any(r => r == c)); + } + + public static List GetAllCategoriesFromTest(this ITest test) + { + if (test.Parent == null) + return test.GetTestCategories().ToList(); + + var categories = GetAllCategoriesFromTest(test.Parent); + categories.AddRange(test.GetTestCategories()); + return categories; + } + + public static void ParseForNameDuplicates(this ITest test) + { + var duplicates = new Dictionary(); + for (var i = 0; i < test.Tests.Count; i++) + { + var child = test.Tests[i]; + int count; + if (duplicates.TryGetValue(child.FullName, out count)) + { + count++; + child.Properties.Add("childIndex", count); + duplicates[child.FullName] = count; + } + else + { + duplicates.Add(child.FullName, 1); + } + ParseForNameDuplicates(child); + } + } + + public static int GetChildIndex(this ITest test) + { + var index = test.Properties["childIndex"]; + return (int)index[0]; + } + + public static bool HasChildIndex(this ITest test) + { + var index = test.Properties["childIndex"]; + return index.Count > 0; + } + + static string GetAncestorPath(ITest test) + { + var path = ""; + var testParent = test.Parent; + + while (testParent != null && testParent.Parent != null && !string.IsNullOrEmpty(testParent.Name)) + { + path = testParent.Name + "/" + path; + testParent = testParent.Parent; + } + + return path; + } + + public static string GetUniqueName(this ITest test) + { + var id = GetAncestorPath(test) + GetFullName(test); + if (test.HasChildIndex()) + { + var index = test.GetChildIndex(); + if (index >= 0) + id += index; + } + if (test.IsSuite) + { + id += "[suite]"; + } + return id; + } + + public static string GetFullName(ITest test) + { + if (test.TypeInfo == null && (test.Parent == null || test.Parent.TypeInfo == null)) + { + return "[" + test.FullName + "]"; + } + var assemblyId = test.TypeInfo == null ? test.Parent.TypeInfo.Assembly.GetName().Name : test.TypeInfo.Assembly.GetName().Name; + return string.Format("[{0}][{1}]", assemblyId, test.FullName); + } + + public static string GetSkipReason(this ITest test) + { + if (test.Properties.ContainsKey(PropertyNames.SkipReason)) + return (string)test.Properties.Get(PropertyNames.SkipReason); + + return null; + } + + public static string GetParentId(this ITest test) + { + if (test.Parent != null) + return test.Parent.Id; + + return null; + } + + public static string GetParentFullName(this ITest test) + { + if (test.Parent != null) + return test.Parent.FullName; + + return null; + } + + public static string GetParentUniqueName(this ITest test) + { + if (test.Parent != null) + return GetUniqueName(test.Parent); + + return null; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/TestExtensions.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/TestExtensions.cs.meta new file mode 100644 index 0000000..d7e04b4 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/TestExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8bc74398aa3944646ade4ee78cd57484 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/TestResultExtensions.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/TestResultExtensions.cs new file mode 100644 index 0000000..0c14397 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/TestResultExtensions.cs @@ -0,0 +1,77 @@ +using System; +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; + +namespace UnityEngine.TestRunner.NUnitExtensions +{ + internal static class TestResultExtensions + { + public static void RecordPrefixedException(this TestResult testResult, string prefix, Exception ex, ResultState resultState = null) + + { + if (ex is NUnitException) + { + ex = ex.InnerException; + } + + if (resultState == null) + { + resultState = testResult.ResultState == ResultState.Cancelled + ? ResultState.Cancelled + : ResultState.Error; + } + + var exceptionMessage = ExceptionHelper.BuildMessage(ex); + string stackTrace = "--" + prefix + NUnit.Env.NewLine + ExceptionHelper.BuildStackTrace(ex); + if (testResult.StackTrace != null) + { + stackTrace = testResult.StackTrace + NUnit.Env.NewLine + stackTrace; + } + + if (testResult.Test.IsSuite) + { + resultState = resultState.WithSite(FailureSite.TearDown); + } + + if (ex is ResultStateException) + { + exceptionMessage = ex.Message; + resultState = ((ResultStateException)ex).ResultState; + stackTrace = StackFilter.Filter(ex.StackTrace); + } + + string message = (string.IsNullOrEmpty(prefix) ? "" : (prefix + " : ")) + exceptionMessage; + if (testResult.Message != null) + { + message = testResult.Message + NUnit.Env.NewLine + message; + } + + testResult.SetResult(resultState, message, stackTrace); + } + + public static void RecordPrefixedError(this TestResult testResult, string prefix, string error, ResultState resultState = null) + + { + if (resultState == null) + { + resultState = testResult.ResultState == ResultState.Cancelled + ? ResultState.Cancelled + : ResultState.Error; + } + + if (testResult.Test.IsSuite) + { + resultState = resultState.WithSite(FailureSite.TearDown); + } + + string message = (string.IsNullOrEmpty(prefix) ? "" : (prefix + " : ")) + error; + if (testResult.Message != null) + { + message = testResult.Message + NUnit.Env.NewLine + message; + } + + testResult.SetResult(resultState, message); + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/TestResultExtensions.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/TestResultExtensions.cs.meta new file mode 100644 index 0000000..86eb9ad --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/TestResultExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 65fb6da362a78334ab360a125cfafdaf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/UnityTestAssemblyBuilder.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/UnityTestAssemblyBuilder.cs new file mode 100644 index 0000000..3a130c5 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/UnityTestAssemblyBuilder.cs @@ -0,0 +1,58 @@ +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using NUnit; +using NUnit.Framework.Api; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; + +namespace UnityEngine.TestTools.NUnitExtensions +{ + internal class UnityTestAssemblyBuilder : DefaultTestAssemblyBuilder, IAsyncTestAssemblyBuilder + { + private readonly string m_ProductName; + public UnityTestAssemblyBuilder() + { + m_ProductName = Application.productName; + } + + public ITest Build(Assembly[] assemblies, TestPlatform[] testPlatforms, IDictionary options) + { + var test = BuildAsync(assemblies, testPlatforms, options); + while (test.MoveNext()) + { + } + + return test.Current; + } + + public IEnumerator BuildAsync(Assembly[] assemblies, TestPlatform[] testPlatforms, IDictionary options) + { + var productName = string.Join("_", m_ProductName.Split(Path.GetInvalidFileNameChars())); + var suite = new TestSuite(productName); + for (var index = 0; index < assemblies.Length; index++) + { + var assembly = assemblies[index]; + var platform = testPlatforms[index]; + + var assemblySuite = Build(assembly, options) as TestSuite; + if (assemblySuite != null && assemblySuite.HasChildren) + { + assemblySuite.Properties.Set("platform", platform); + suite.Add(assemblySuite); + } + + yield return null; + } + + yield return suite; + } + + public static Dictionary GetNUnitTestBuilderSettings(TestPlatform testPlatform) + { + var emptySettings = new Dictionary(); + emptySettings.Add(FrameworkPackageSettings.TestParameters, "platform=" + testPlatform); + return emptySettings; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/UnityTestAssemblyBuilder.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/UnityTestAssemblyBuilder.cs.meta new file mode 100644 index 0000000..abd0444 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/NUnitExtensions/UnityTestAssemblyBuilder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 98ba0396e4b4ee8498a8f097affcfddf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner.meta new file mode 100644 index 0000000..bf3d145 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1ddb9e1c877ea80479d1eab4ddaa5d0d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks.meta new file mode 100644 index 0000000..46b230c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 61e236e8570a95e4eb754fb291e102e0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/PlayModeRunnerCallback.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/PlayModeRunnerCallback.cs new file mode 100644 index 0000000..66c48e5 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/PlayModeRunnerCallback.cs @@ -0,0 +1,47 @@ +using NUnit.Framework; +using NUnit.Framework.Interfaces; + +namespace UnityEngine.TestTools.TestRunner.Callbacks +{ + [AddComponentMenu("")] + internal class PlayModeRunnerCallback : MonoBehaviour, ITestRunnerListener + { + private TestResultRenderer m_ResultRenderer; + + public void RunFinished(ITestResult testResults) + { + Application.logMessageReceivedThreaded -= LogRecieved; + if (Camera.main == null) + { + gameObject.AddComponent(); + } + m_ResultRenderer = new TestResultRenderer(testResults); + m_ResultRenderer.ShowResults(); + } + + public void TestFinished(ITestResult result) + { + } + + public void OnGUI() + { + if (m_ResultRenderer != null) + m_ResultRenderer.Draw(); + } + + public void RunStarted(ITest testsToRun) + { + Application.logMessageReceivedThreaded += LogRecieved; + } + + public void TestStarted(ITest test) + { + } + + private void LogRecieved(string message, string stacktrace, LogType type) + { + if (TestContext.Out != null) + TestContext.Out.WriteLine(message); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/PlayModeRunnerCallback.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/PlayModeRunnerCallback.cs.meta new file mode 100644 index 0000000..7f533f6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/PlayModeRunnerCallback.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3cf5cb9e1ef590c48b1f919f2a7bd895 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/RemoteTestResultSender.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/RemoteTestResultSender.cs new file mode 100644 index 0000000..1bfb63e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/RemoteTestResultSender.cs @@ -0,0 +1,151 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using NUnit.Framework.Interfaces; +using UnityEngine.Networking.PlayerConnection; +using UnityEngine.TestRunner.TestLaunchers; + +namespace UnityEngine.TestTools.TestRunner.Callbacks +{ + [AddComponentMenu("")] + internal class RemoteTestResultSender : MonoBehaviour, ITestRunnerListener + { + private class QueueData + { + public Guid id { get; set; } + public byte[] data { get; set; } + } + + private const int k_aliveMessageFrequency = 120; + private float m_NextliveMessage = k_aliveMessageFrequency; + private readonly Queue m_SendQueue = new Queue(); + private readonly object m_LockQueue = new object(); + private readonly IRemoteTestResultDataFactory m_TestResultDataFactory = new RemoteTestResultDataFactory(); + + public void Start() + { + PlayerConnection.instance.Register(PlayerConnectionMessageIds.quitPlayerMessageId, EditorProccessedTheResult); + StartCoroutine(SendDataRoutine()); + } + + private void EditorProccessedTheResult(MessageEventArgs arg0) + { + if (arg0.data != null) + { + return; + } + + //Some platforms don't quit, so we need to disconnect to make sure they will not connect to another editor instance automatically. + PlayerConnection.instance.DisconnectAll(); + + //XBOX has an error when quitting + if (Application.platform == RuntimePlatform.XboxOne) + { + return; + } + Application.Quit(); + } + + private byte[] SerializeObject(object objectToSerialize) + { + return Encoding.UTF8.GetBytes(JsonUtility.ToJson(objectToSerialize)); + } + + public void RunStarted(ITest testsToRun) + { + var data = SerializeObject(m_TestResultDataFactory.CreateFromTest(testsToRun)); + lock (m_LockQueue) + { + m_SendQueue.Enqueue(new QueueData + { + id = PlayerConnectionMessageIds.runStartedMessageId, + data = data + }); + } + } + + public void RunFinished(ITestResult testResults) + { + var data = SerializeObject(m_TestResultDataFactory.CreateFromTestResult(testResults)); + lock (m_LockQueue) + { + m_SendQueue.Enqueue(new QueueData { id = PlayerConnectionMessageIds.runFinishedMessageId, data = data, }); + } + } + + public void TestStarted(ITest test) + { + var data = SerializeObject(m_TestResultDataFactory.CreateFromTest(test)); + lock (m_LockQueue) + { + m_SendQueue.Enqueue(new QueueData + { + id = PlayerConnectionMessageIds.testStartedMessageId, + data = data + }); + } + } + + public void TestFinished(ITestResult result) + { + var testRunnerResultForApi = m_TestResultDataFactory.CreateFromTestResult(result); + var resultData = SerializeObject(testRunnerResultForApi); + lock (m_LockQueue) + { + m_SendQueue.Enqueue(new QueueData + { + id = PlayerConnectionMessageIds.testFinishedMessageId, + data = resultData, + }); + } + } + + public IEnumerator SendDataRoutine() + { + while (!PlayerConnection.instance.isConnected) + { + yield return new WaitForSeconds(1); + } + + while (true) + { + lock (m_LockQueue) + { + if (PlayerConnection.instance.isConnected && m_SendQueue.Count > 0) + { + ResetNextPlayerAliveMessageTime(); + var queueData = m_SendQueue.Dequeue(); + PlayerConnection.instance.Send(queueData.id, queueData.data); + yield return null; + } + + //This is needed so we dont stall the player totally + if (!m_SendQueue.Any()) + { + SendAliveMessageIfNeeded(); + yield return new WaitForSeconds(0.02f); + } + } + } + } + + private void SendAliveMessageIfNeeded() + { + if (Time.timeSinceLevelLoad < m_NextliveMessage) + { + return; + } + + Debug.Log("Sending player alive message back to editor."); + ResetNextPlayerAliveMessageTime(); + PlayerConnection.instance.Send(PlayerConnectionMessageIds.playerAliveHeartbeat, new byte[0]); + } + + private void ResetNextPlayerAliveMessageTime() + { + m_NextliveMessage = Time.timeSinceLevelLoad + k_aliveMessageFrequency; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/RemoteTestResultSender.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/RemoteTestResultSender.cs.meta new file mode 100644 index 0000000..13af2c8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/RemoteTestResultSender.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 20793418366caf14293b29c55df5e9ec +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRenderer.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRenderer.cs new file mode 100644 index 0000000..95316e7 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRenderer.cs @@ -0,0 +1,97 @@ +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; + +namespace UnityEngine.TestTools.TestRunner.Callbacks +{ + internal class TestResultRenderer + { + private static class Styles + { + public static readonly GUIStyle SucceedLabelStyle; + public static readonly GUIStyle FailedLabelStyle; + public static readonly GUIStyle FailedMessagesStyle; + + static Styles() + { + SucceedLabelStyle = new GUIStyle("label"); + SucceedLabelStyle.normal.textColor = Color.green; + SucceedLabelStyle.fontSize = 48; + + FailedLabelStyle = new GUIStyle("label"); + FailedLabelStyle.normal.textColor = Color.red; + FailedLabelStyle.fontSize = 32; + + FailedMessagesStyle = new GUIStyle("label"); + FailedMessagesStyle.wordWrap = false; + FailedMessagesStyle.richText = true; + } + } + + private readonly List m_FailedTestCollection; + + private bool m_ShowResults; + private Vector2 m_ScrollPosition; + + public TestResultRenderer(ITestResult testResults) + { + m_FailedTestCollection = new List(); + GetFailedTests(testResults); + } + + private void GetFailedTests(ITestResult testResults) + { + if (testResults is TestCaseResult) + { + if (testResults.ResultState.Status == TestStatus.Failed) + m_FailedTestCollection.Add(testResults); + } + else if (testResults.HasChildren) + { + foreach (var testResultsChild in testResults.Children) + { + GetFailedTests(testResultsChild); + } + } + } + + private const int k_MaxStringLength = 15000; + + public void ShowResults() + { + m_ShowResults = true; + Cursor.visible = true; + } + + public void Draw() + { + if (!m_ShowResults) return; + if (m_FailedTestCollection.Count == 0) + { + GUILayout.Label("All test(s) succeeded", Styles.SucceedLabelStyle, GUILayout.Width(600)); + } + else + { + int count = m_FailedTestCollection.Count; + GUILayout.Label(count + " tests failed!", Styles.FailedLabelStyle); + + m_ScrollPosition = GUILayout.BeginScrollView(m_ScrollPosition, GUILayout.ExpandWidth(true)); + var text = ""; + + text += "Code-based tests\n"; + text += string.Join("\n", m_FailedTestCollection + .Select(result => result.Name + " " + result.ResultState + "\n" + result.Message) + .ToArray()); + + if (text.Length > k_MaxStringLength) + text = text.Substring(0, k_MaxStringLength); + + GUILayout.TextArea(text, Styles.FailedMessagesStyle); + GUILayout.EndScrollView(); + } + if (GUILayout.Button("Close")) + Application.Quit(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRenderer.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRenderer.cs.meta new file mode 100644 index 0000000..1814f78 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRenderer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5ebb87899ca30b743bb4274bc00c02b4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRendererCallback.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRendererCallback.cs new file mode 100644 index 0000000..9f5ce05 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRendererCallback.cs @@ -0,0 +1,36 @@ +using NUnit.Framework.Interfaces; + +namespace UnityEngine.TestTools.TestRunner.Callbacks +{ + internal class TestResultRendererCallback : MonoBehaviour, ITestRunnerListener + { + private TestResultRenderer m_ResultRenderer; + public void RunStarted(ITest testsToRun) + { + } + + public void RunFinished(ITestResult testResults) + { + if (Camera.main == null) + { + gameObject.AddComponent(); + } + m_ResultRenderer = new TestResultRenderer(testResults); + m_ResultRenderer.ShowResults(); + } + + public void OnGUI() + { + if (m_ResultRenderer != null) + m_ResultRenderer.Draw(); + } + + public void TestStarted(ITest test) + { + } + + public void TestFinished(ITestResult result) + { + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRendererCallback.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRendererCallback.cs.meta new file mode 100644 index 0000000..21e7ef0 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Callbacks/TestResultRendererCallback.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dfc336f10b83bd74eaded16a658275c7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/ITestRunnerListener.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/ITestRunnerListener.cs new file mode 100644 index 0000000..358ac74 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/ITestRunnerListener.cs @@ -0,0 +1,26 @@ +using System; +using NUnit.Framework.Interfaces; +using UnityEngine.Events; + +namespace UnityEngine.TestTools.TestRunner +{ + internal interface ITestRunnerListener + { + void RunStarted(ITest testsToRun); + void RunFinished(ITestResult testResults); + void TestStarted(ITest test); + void TestFinished(ITestResult result); + } + + [Serializable] + internal class TestFinishedEvent : UnityEvent {} + + [Serializable] + internal class TestStartedEvent : UnityEvent {} + + [Serializable] + internal class RunFinishedEvent : UnityEvent {} + + [Serializable] + internal class RunStartedEvent : UnityEvent {} +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/ITestRunnerListener.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/ITestRunnerListener.cs.meta new file mode 100644 index 0000000..8a6ef78 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/ITestRunnerListener.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d1b534518943030499685344fd1d476d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Messages.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Messages.meta new file mode 100644 index 0000000..0a8a314 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Messages.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 256a0ca37fa972840bce7fca446e75e7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Messages/IEditModeTestYieldInstruction.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Messages/IEditModeTestYieldInstruction.cs new file mode 100644 index 0000000..da4bcb5 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Messages/IEditModeTestYieldInstruction.cs @@ -0,0 +1,12 @@ +using System.Collections; + +namespace UnityEngine.TestTools +{ + public interface IEditModeTestYieldInstruction + { + bool ExpectDomainReload { get; } + bool ExpectedPlaymodeState { get; } + + IEnumerator Perform(); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Messages/IEditModeTestYieldInstruction.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Messages/IEditModeTestYieldInstruction.cs.meta new file mode 100644 index 0000000..5760500 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/Messages/IEditModeTestYieldInstruction.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 898bc38486fc899428fbe5bd6adfe473 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/PlaymodeTestsController.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/PlaymodeTestsController.cs new file mode 100644 index 0000000..7375557 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/PlaymodeTestsController.cs @@ -0,0 +1,129 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using UnityEngine.SceneManagement; +using UnityEngine.TestRunner.NUnitExtensions; +using UnityEngine.TestRunner.NUnitExtensions.Runner; +using UnityEngine.TestTools.NUnitExtensions; +using UnityEngine.TestTools.Utils; + +namespace UnityEngine.TestTools.TestRunner +{ + [Serializable] + [AddComponentMenu("")] + internal class PlaymodeTestsController : MonoBehaviour + { + private IEnumerator m_TestSteps; + + [SerializeField] + private List m_AssembliesWithTests; + public List AssembliesWithTests + { + get + { + return m_AssembliesWithTests; + } + set + { + m_AssembliesWithTests = value; + } + } + + [SerializeField] + internal TestStartedEvent testStartedEvent = new TestStartedEvent(); + [SerializeField] + internal TestFinishedEvent testFinishedEvent = new TestFinishedEvent(); + [SerializeField] + internal RunStartedEvent runStartedEvent = new RunStartedEvent(); + [SerializeField] + internal RunFinishedEvent runFinishedEvent = new RunFinishedEvent(); + + internal const string kPlaymodeTestControllerName = "Code-based tests runner"; + + [SerializeField] + public PlaymodeTestsControllerSettings settings = new PlaymodeTestsControllerSettings(); + + internal UnityTestAssemblyRunner m_Runner; + + public IEnumerator Start() + { + //Skip 2 frame because Unity. + yield return null; + yield return null; + StartCoroutine(Run()); + } + + internal static bool IsControllerOnScene() + { + return GameObject.Find(kPlaymodeTestControllerName) != null; + } + + internal static PlaymodeTestsController GetController() + { + return GameObject.Find(kPlaymodeTestControllerName).GetComponent(); + } + + public IEnumerator TestRunnerCoroutine() + { + while (m_TestSteps.MoveNext()) + { + yield return m_TestSteps.Current; + } + + if (m_Runner.IsTestComplete) + { + runFinishedEvent.Invoke(m_Runner.Result); + Cleanup(); + + yield return null; + } + } + + public IEnumerator Run() + { + CoroutineTestWorkItem.monoBehaviourCoroutineRunner = this; + gameObject.hideFlags |= HideFlags.DontSave; + + if (settings.sceneBased) + { + SceneManager.LoadScene(1, LoadSceneMode.Additive); + yield return null; + } + + var testListUtil = new PlayerTestAssemblyProvider(new AssemblyLoadProxy(), m_AssembliesWithTests); + m_Runner = new UnityTestAssemblyRunner(new UnityTestAssemblyBuilder(), new PlaymodeWorkItemFactory()); + + var loadedTests = m_Runner.Load(testListUtil.GetUserAssemblies().Select(a => a.Assembly).ToArray(), TestPlatform.PlayMode, UnityTestAssemblyBuilder.GetNUnitTestBuilderSettings(TestPlatform.PlayMode)); + loadedTests.ParseForNameDuplicates(); + runStartedEvent.Invoke(m_Runner.LoadedTest); + + var testListenerWrapper = new TestListenerWrapper(testStartedEvent, testFinishedEvent); + m_TestSteps = m_Runner.Run(testListenerWrapper, settings.BuildNUnitFilter()).GetEnumerator(); + + yield return TestRunnerCoroutine(); + } + + public void Cleanup() + { + if (m_Runner != null) + { + m_Runner.StopRun(); + m_Runner = null; + } + if (Application.isEditor) + { + Destroy(gameObject); + } + } + + public static void TryCleanup() + { + var controller = GetController(); + if (controller != null) + { + controller.Cleanup(); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/PlaymodeTestsController.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/PlaymodeTestsController.cs.meta new file mode 100644 index 0000000..ba95396 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/PlaymodeTestsController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 102e512f651ee834f951a2516c1ea3b8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/PlaymodeTestsControllerSettings.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/PlaymodeTestsControllerSettings.cs new file mode 100644 index 0000000..a062b55 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/PlaymodeTestsControllerSettings.cs @@ -0,0 +1,36 @@ +using System; +using System.Linq; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal.Filters; +using UnityEngine.SceneManagement; +using UnityEngine.TestTools.TestRunner.GUI; + +namespace UnityEngine.TestTools.TestRunner +{ + [Serializable] + internal class PlaymodeTestsControllerSettings + { + [SerializeField] + public TestRunnerFilter[] filters; + public bool sceneBased; + public string originalScene; + public string bootstrapScene; + + public static PlaymodeTestsControllerSettings CreateRunnerSettings(TestRunnerFilter[] filters) + { + var settings = new PlaymodeTestsControllerSettings + { + filters = filters, + sceneBased = false, + originalScene = SceneManager.GetActiveScene().path, + bootstrapScene = null + }; + return settings; + } + + internal ITestFilter BuildNUnitFilter() + { + return new OrFilter(filters.Select(f => f.BuildNUnitFilter()).ToArray()); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/PlaymodeTestsControllerSettings.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/PlaymodeTestsControllerSettings.cs.meta new file mode 100644 index 0000000..d354fad --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/PlaymodeTestsControllerSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2799eb4c84e72e54092a292cf626936b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers.meta new file mode 100644 index 0000000..e70ae47 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 91c20d2c22b8b3a4cb6c816bd225591a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/IRemoteTestResultDataFactory.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/IRemoteTestResultDataFactory.cs new file mode 100644 index 0000000..1032e6a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/IRemoteTestResultDataFactory.cs @@ -0,0 +1,11 @@ +using System; +using NUnit.Framework.Interfaces; + +namespace UnityEngine.TestRunner.TestLaunchers +{ + internal interface IRemoteTestResultDataFactory + { + RemoteTestResultDataWithTestData CreateFromTestResult(ITestResult result); + RemoteTestResultDataWithTestData CreateFromTest(ITest test); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/IRemoteTestResultDataFactory.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/IRemoteTestResultDataFactory.cs.meta new file mode 100644 index 0000000..173f175 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/IRemoteTestResultDataFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 874c0713cdc44f549b0161750b48d2c2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/PlayerConnectionMessageIds.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/PlayerConnectionMessageIds.cs new file mode 100644 index 0000000..58f6263 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/PlayerConnectionMessageIds.cs @@ -0,0 +1,14 @@ +using System; + +namespace UnityEngine.TestRunner.TestLaunchers +{ + internal static class PlayerConnectionMessageIds + { + public static Guid runStartedMessageId { get { return new Guid("6a7f53dd-4672-461d-a7b5-9467e9393fd3"); } } + public static Guid runFinishedMessageId { get { return new Guid("ffb622fc-34ad-4901-8d7b-47fb04b0bdd4"); } } + public static Guid testStartedMessageId { get { return new Guid("b54d241e-d88d-4dba-8c8f-ee415d11c030"); } } + public static Guid testFinishedMessageId { get { return new Guid("72f7b7f4-6829-4cd1-afde-78872b9d5adc"); } } + public static Guid quitPlayerMessageId { get { return new Guid("ab44bfe0-bb50-4ee6-9977-69d2ea6bb3a0"); } } + public static Guid playerAliveHeartbeat { get { return new Guid("8c0c307b-f7fd-4216-8623-35b4b3f55fb6"); } } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/PlayerConnectionMessageIds.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/PlayerConnectionMessageIds.cs.meta new file mode 100644 index 0000000..1b606e4 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/PlayerConnectionMessageIds.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 41d60936b62cc6d4ca7fe628b22b0e40 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestData.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestData.cs new file mode 100644 index 0000000..eaf7078 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestData.cs @@ -0,0 +1,56 @@ +using System; +using System.Linq; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using UnityEngine.TestRunner.NUnitExtensions; + +namespace UnityEngine.TestRunner.TestLaunchers +{ + [Serializable] + internal class RemoteTestData + { + public string id; + public string name; + public string fullName; + public int testCaseCount; + public int ChildIndex; + public bool hasChildren; + public bool isSuite; + public string[] childrenIds; + public int testCaseTimeout; + public string[] Categories; + public bool IsTestAssembly; + public RunState RunState; + public string Description; + public string SkipReason; + public string ParentId; + public string UniqueName; + public string ParentUniqueName; + public string ParentFullName; + + internal RemoteTestData(ITest test) + { + id = test.Id; + name = test.Name; + fullName = test.FullName; + testCaseCount = test.TestCaseCount; + ChildIndex = -1; + if (test.Properties["childIndex"].Count > 0) + { + ChildIndex = (int)test.Properties["childIndex"][0]; + } + hasChildren = test.HasChildren; + isSuite = test.IsSuite; + childrenIds = test.Tests.Select(t => t.Id).ToArray(); + Categories = test.GetAllCategoriesFromTest().ToArray(); + IsTestAssembly = test is TestAssembly; + RunState = (RunState)Enum.Parse(typeof(RunState), test.RunState.ToString()); + Description = (string)test.Properties.Get(PropertyNames.Description); + SkipReason = test.GetSkipReason(); + ParentId = test.GetParentId(); + UniqueName = test.GetUniqueName(); + ParentUniqueName = test.GetParentUniqueName(); + ParentFullName = test.GetParentFullName(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestData.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestData.cs.meta new file mode 100644 index 0000000..34b9c5a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b135ec222fdcd11468014c90d11d6821 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultData.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultData.cs new file mode 100644 index 0000000..a0a34c3 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultData.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework.Interfaces; + +namespace UnityEngine.TestRunner.TestLaunchers +{ + [Serializable] + internal class RemoteTestResultData + { + public string testId; + public string name; + public string fullName; + public string resultState; + public TestStatus testStatus; + public double duration; + public DateTime startTime; + public DateTime endTime; + public string message; + public string stackTrace; + public int assertCount; + public int failCount; + public int passCount; + public int skipCount; + public int inconclusiveCount; + public bool hasChildren; + public string output; + public string xml; + public string[] childrenIds; + + internal RemoteTestResultData(ITestResult result) + { + testId = result.Test.Id; + name = result.Name; + fullName = result.FullName; + resultState = result.ResultState.ToString(); + testStatus = result.ResultState.Status; + duration = result.Duration; + startTime = result.StartTime; + endTime = result.EndTime; + message = result.Message; + stackTrace = result.StackTrace; + assertCount = result.AssertCount; + failCount = result.FailCount; + passCount = result.PassCount; + skipCount = result.SkipCount; + inconclusiveCount = result.InconclusiveCount; + hasChildren = result.HasChildren; + output = result.Output; + xml = result.ToXml(true).OuterXml; + childrenIds = result.Children.Select(child => child.Test.Id).ToArray(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultData.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultData.cs.meta new file mode 100644 index 0000000..247a8a3 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 03e4d63665d06f04c8a6cf68133c1592 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultDataFactory.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultDataFactory.cs new file mode 100644 index 0000000..356a39d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultDataFactory.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework.Interfaces; +using UnityEngine.TestRunner.NUnitExtensions.Runner; + +namespace UnityEngine.TestRunner.TestLaunchers +{ + internal class RemoteTestResultDataFactory : IRemoteTestResultDataFactory + { + public RemoteTestResultDataWithTestData CreateFromTestResult(ITestResult result) + { + var tests = CreateTestDataList(result.Test); + tests.First().testCaseTimeout = UnityTestExecutionContext.CurrentContext.TestCaseTimeout; + return new RemoteTestResultDataWithTestData() + { + results = CreateTestResultDataList(result), + tests = tests + }; + } + + public RemoteTestResultDataWithTestData CreateFromTest(ITest test) + { + var tests = CreateTestDataList(test); + if (UnityTestExecutionContext.CurrentContext != null) + { + tests.First().testCaseTimeout = UnityTestExecutionContext.CurrentContext.TestCaseTimeout; + } + + return new RemoteTestResultDataWithTestData() + { + tests = tests + }; + } + + private RemoteTestData[] CreateTestDataList(ITest test) + { + var list = new List(); + list.Add(new RemoteTestData(test)); + list.AddRange(test.Tests.SelectMany(CreateTestDataList)); + return list.ToArray(); + } + + private static RemoteTestResultData[] CreateTestResultDataList(ITestResult result) + { + var list = new List(); + list.Add(new RemoteTestResultData(result)); + list.AddRange(result.Children.SelectMany(CreateTestResultDataList)); + return list.ToArray(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultDataFactory.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultDataFactory.cs.meta new file mode 100644 index 0000000..575b017 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultDataFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 826b6becaef90fb458eedebe4c2f3664 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultDataWithTestData.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultDataWithTestData.cs new file mode 100644 index 0000000..5b28f49 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultDataWithTestData.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework.Interfaces; +using UnityEngine.TestRunner.NUnitExtensions.Runner; + +namespace UnityEngine.TestRunner.TestLaunchers +{ + [Serializable] + internal class RemoteTestResultDataWithTestData + { + public RemoteTestResultData[] results; + public RemoteTestData[] tests; + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultDataWithTestData.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultDataWithTestData.cs.meta new file mode 100644 index 0000000..ea1a860 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestResultDataWithTestData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 475e3699f219c854f8581a9838135002 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/SynchronousFilter.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/SynchronousFilter.cs new file mode 100644 index 0000000..6916d81 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/SynchronousFilter.cs @@ -0,0 +1,51 @@ +using System.Collections; +using System.Linq; +using System.Reflection; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; + +namespace UnityEngine.TestTools.TestRunner.GUI +{ + class SynchronousFilter : ITestFilter + { + public TNode ToXml(bool recursive) + { + return new TNode("synchronousOnly"); + } + + public TNode AddToXml(TNode parentNode, bool recursive) + { + return parentNode.AddElement("synchronousOnly"); + } + + public bool Pass(ITest test) + { + if (test.Method == null) + return true; + + if (test.Method.ReturnType.Type == typeof(IEnumerator)) + return false; + + if (test.Method.GetCustomAttributes(true).Any()) + return false; + + if (test.TypeInfo?.Type != null) + { + if (Reflect.GetMethodsWithAttribute(test.TypeInfo.Type, typeof(UnitySetUpAttribute), true) + .Any(mi => mi.ReturnType == typeof(System.Collections.IEnumerator))) + return false; + + if (Reflect.GetMethodsWithAttribute(test.TypeInfo.Type, typeof(UnityTearDownAttribute), true) + .Any(mi => mi.ReturnType == typeof(System.Collections.IEnumerator))) + return false; + } + + return true; + } + + public bool IsExplicitMatch(ITest test) + { + return Pass(test); + } + } +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/SynchronousFilter.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/SynchronousFilter.cs.meta new file mode 100644 index 0000000..809accf --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/SynchronousFilter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b9aec9d3b0a86466ab4647d01e8fc87d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestEnumeratorWrapper.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestEnumeratorWrapper.cs new file mode 100644 index 0000000..31171d1 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestEnumeratorWrapper.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections; +using System.Reflection; +using NUnit.Framework; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; + +namespace UnityEngine.TestTools.TestRunner +{ + internal class TestEnumeratorWrapper + { + private readonly TestMethod m_TestMethod; + + public TestEnumeratorWrapper(TestMethod testMethod) + { + m_TestMethod = testMethod; + } + + public IEnumerator GetEnumerator(ITestExecutionContext context) + { + if (m_TestMethod.Method.ReturnType.Type == typeof(IEnumerator)) + { + return HandleEnumerableTest(context); + } + var message = string.Format("Return type {0} of {1} in {2} is not supported.", + m_TestMethod.Method.ReturnType, m_TestMethod.Method.Name, m_TestMethod.Method.TypeInfo.FullName); + if (m_TestMethod.Method.ReturnType.Type == typeof(IEnumerable)) + { + message += "\nDid you mean IEnumerator?"; + } + throw new InvalidSignatureException(message); + } + + private IEnumerator HandleEnumerableTest(ITestExecutionContext context) + { + try + { + return m_TestMethod.Method.MethodInfo.Invoke(context.TestObject, m_TestMethod.parms != null ? m_TestMethod.parms.OriginalArguments : null) as IEnumerator; + } + catch (TargetInvocationException e) + { + if (e.InnerException is IgnoreException) + { + context.CurrentResult.SetResult(ResultState.Ignored, e.InnerException.Message); + return null; + } + throw; + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestEnumeratorWrapper.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestEnumeratorWrapper.cs.meta new file mode 100644 index 0000000..41bc421 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestEnumeratorWrapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9ad0b0c865b01af4ca1b414689e71259 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestListenerWrapper.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestListenerWrapper.cs new file mode 100644 index 0000000..0c1c75e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestListenerWrapper.cs @@ -0,0 +1,30 @@ +using NUnit.Framework.Interfaces; + +namespace UnityEngine.TestTools.TestRunner +{ + internal class TestListenerWrapper : ITestListener + { + private readonly TestFinishedEvent m_TestFinishedEvent; + private readonly TestStartedEvent m_TestStartedEvent; + + public TestListenerWrapper(TestStartedEvent testStartedEvent, TestFinishedEvent testFinishedEvent) + { + m_TestStartedEvent = testStartedEvent; + m_TestFinishedEvent = testFinishedEvent; + } + + public void TestStarted(ITest test) + { + m_TestStartedEvent.Invoke(test); + } + + public void TestFinished(ITestResult result) + { + m_TestFinishedEvent.Invoke(result); + } + + public void TestOutput(TestOutput output) + { + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestListenerWrapper.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestListenerWrapper.cs.meta new file mode 100644 index 0000000..963a50e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestListenerWrapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 73deb9b8722aa284eab27c4dc90956c6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestPlatform.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestPlatform.cs new file mode 100644 index 0000000..2c8a3a8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestPlatform.cs @@ -0,0 +1,21 @@ +using System; + +namespace UnityEngine.TestTools +{ + [Flags] + [Serializable] + public enum TestPlatform : byte + { + All = 0xFF, + EditMode = 1 << 1, + PlayMode = 1 << 2 + } + + internal static class TestPlatformEnumExtensions + { + public static bool IsFlagIncluded(this TestPlatform flags, TestPlatform flag) + { + return (flags & flag) == flag; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestPlatform.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestPlatform.cs.meta new file mode 100644 index 0000000..ea2e596 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestPlatform.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 743879b4db4bc1a4b829aae4386f4acf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestRunnerFilter.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestRunnerFilter.cs new file mode 100644 index 0000000..68e3761 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestRunnerFilter.cs @@ -0,0 +1,203 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using System.IO; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using NUnit.Framework.Internal.Filters; +using UnityEngine.TestRunner.NUnitExtensions.Filters; + +namespace UnityEngine.TestTools.TestRunner.GUI +{ + [Serializable] + internal class TestRunnerFilter + { +#pragma warning disable 649 + public string[] assemblyNames; + public string[] groupNames; + public string[] categoryNames; + public static TestRunnerFilter empty = new TestRunnerFilter(); + public string[] testNames; + public int testRepetitions = 1; + public bool synchronousOnly = false; + + public static string AssemblyNameFromPath(string path) + { + string output = Path.GetFileName(path); + if (output != null && output.EndsWith(".dll", StringComparison.OrdinalIgnoreCase)) + return output.Substring(0, output.Length - 4); + return output; + } + + private bool CategoryMatches(IEnumerable categories) + { + if (categoryNames == null || categoryNames.Length == 0) + return true; + + foreach (string category in categories) + { + if (categoryNames.Contains(category)) + return true; + } + + return false; + } + + private bool IDMatchesAssembly(string id) + { + if (AreOptionalFiltersEmpty()) + return true; + + if (assemblyNames == null) + return false; + + int openingBracket = id.IndexOf('['); + int closingBracket = id.IndexOf(']'); + if (openingBracket >= 0 && openingBracket < id.Length && closingBracket > openingBracket && openingBracket < id.Length) + { + //Some assemblies are absolute and explicitly part of the test ID e.g. + //"[/path/to/assembly-name.dll][rest of ID ...]" + //While some are minimal assembly names e.g. + //"[assembly-name][rest of ID ...]" + //Strip them down to just the assembly name + string assemblyNameFromID = AssemblyNameFromPath(id.Substring(openingBracket + 1, closingBracket - openingBracket - 1)); + foreach (string assemblyName in assemblyNames) + { + if (assemblyName.Equals(assemblyNameFromID, StringComparison.OrdinalIgnoreCase)) + return true; + } + } + return false; + } + + private bool NameMatches(string name) + { + if (AreOptionalFiltersEmpty()) + return true; + + if (groupNames == null) + return false; + + foreach (var nameFromFilter in groupNames) + { + //Strict regex match for test group name on its own + if (Regex.IsMatch(name, nameFromFilter)) + return true; + //Match test names that end with parametrized test values and full nunit generated test names that have . separators + var regex = nameFromFilter.TrimEnd('$') + @"[\.|\(.*\)]"; + if (Regex.IsMatch(name, regex)) + return true; + } + return false; + } + + private bool AreOptionalFiltersEmpty() + { + if (assemblyNames != null && assemblyNames.Length != 0) + return false; + if (groupNames != null && groupNames.Length != 0) + return false; + if (testNames != null && testNames.Length != 0) + return false; + return true; + } + + private bool NameMatchesExactly(string name) + { + if (AreOptionalFiltersEmpty()) + return true; + + if (testNames == null) + return false; + + foreach (var exactName in testNames) + { + if (name == exactName) + return true; + } + return false; + } + + private static void ClearAncestors(IEnumerable newResultList, string parentID) + { + if (string.IsNullOrEmpty(parentID)) + return; + foreach (var result in newResultList) + { + if (result.Id == parentID) + { + result.Clear(); + ClearAncestors(newResultList, result.ParentId); + break; + } + } + } + + public void ClearResults(List newResultList) + { + foreach (var result in newResultList) + { + if (!result.IsSuite && CategoryMatches(result.Categories)) + { + if (IDMatchesAssembly(result.Id) || NameMatches(result.FullName) || NameMatchesExactly(result.FullName)) + { + result.Clear(); + ClearAncestors(newResultList, result.ParentId); + } + } + } + } + + public ITestFilter BuildNUnitFilter() + { + var filters = new List(); + + if (testNames != null && testNames.Length != 0) + { + var nameFilter = new OrFilter(testNames.Select(n => new FullNameFilter(n)).ToArray()); + filters.Add(nameFilter); + } + + if (groupNames != null && groupNames.Length != 0) + { + var exactNamesFilter = new OrFilter(groupNames.Select(n => + { + var f = new FullNameFilter(n); + f.IsRegex = true; + return f; + }).ToArray()); + filters.Add(exactNamesFilter); + } + + if (assemblyNames != null && assemblyNames.Length != 0) + { + var assemblyFilter = new OrFilter(assemblyNames.Select(c => new AssemblyNameFilter(c)).ToArray()); + filters.Add(assemblyFilter); + } + + if (categoryNames != null && categoryNames.Length != 0) + { + var categoryFilter = new OrFilter(categoryNames.Select(c => new CategoryFilterExtended(c) {IsRegex = true}).ToArray()); + filters.Add(categoryFilter); + } + + if (synchronousOnly) + { + filters.Add(new SynchronousFilter()); + } + + return filters.Count == 0 ? TestFilter.Empty : new AndFilter(filters.ToArray()); + } + + internal interface IClearableResult + { + string Id { get; } + string FullName { get; } + string ParentId { get; } + bool IsSuite { get; } + List Categories { get; } + void Clear(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestRunnerFilter.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestRunnerFilter.cs.meta new file mode 100644 index 0000000..671327b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/TestRunnerFilter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a025ba7ee40d0104db8d08b1d9eabb0d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/UnityEngine.TestRunner.asmdef b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/UnityEngine.TestRunner.asmdef new file mode 100644 index 0000000..f85c16a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/UnityEngine.TestRunner.asmdef @@ -0,0 +1,13 @@ +{ + "name": "UnityEngine.TestRunner", + "references": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": false, + "defineConstraints": [] +} \ No newline at end of file diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/UnityEngine.TestRunner.asmdef.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/UnityEngine.TestRunner.asmdef.meta new file mode 100644 index 0000000..5f4a7ac --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/UnityEngine.TestRunner.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 27619889b8ba8c24980f49ee34dbb44a +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils.meta new file mode 100644 index 0000000..4cc1a1f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bb32bccaf32a6db448d1c0cc99c78688 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider.meta new file mode 100644 index 0000000..e12e5eb --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 51557afa652635743b264a309f0a5c60 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/AssemblyLoadProxy.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/AssemblyLoadProxy.cs new file mode 100644 index 0000000..be41950 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/AssemblyLoadProxy.cs @@ -0,0 +1,12 @@ +using System.Reflection; + +namespace UnityEngine.TestTools.Utils +{ + internal class AssemblyLoadProxy : IAssemblyLoadProxy + { + public IAssemblyWrapper Load(string assemblyString) + { + return new AssemblyWrapper(Assembly.Load(assemblyString)); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/AssemblyLoadProxy.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/AssemblyLoadProxy.cs.meta new file mode 100644 index 0000000..26b76a6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/AssemblyLoadProxy.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fb593906b7b6d824087dcaebf6c082e0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/AssemblyWrapper.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/AssemblyWrapper.cs new file mode 100644 index 0000000..86d450e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/AssemblyWrapper.cs @@ -0,0 +1,30 @@ +using System; +using System.Reflection; + +namespace UnityEngine.TestTools.Utils +{ + internal class AssemblyWrapper : IAssemblyWrapper + { + public AssemblyWrapper(Assembly assembly) + { + Assembly = assembly; + } + + public Assembly Assembly { get; } + + public virtual string Location + { + get + { + //Some platforms dont support this + throw new NotImplementedException(); + } + } + + public virtual AssemblyName[] GetReferencedAssemblies() + { + //Some platforms dont support this + throw new NotImplementedException(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/AssemblyWrapper.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/AssemblyWrapper.cs.meta new file mode 100644 index 0000000..bd3090c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/AssemblyWrapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2e3b9bbf2c1a3cd4f88883ca32882ec6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IAssemblyLoadProxy.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IAssemblyLoadProxy.cs new file mode 100644 index 0000000..6e05914 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IAssemblyLoadProxy.cs @@ -0,0 +1,7 @@ +namespace UnityEngine.TestTools.Utils +{ + internal interface IAssemblyLoadProxy + { + IAssemblyWrapper Load(string assemblyString); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IAssemblyLoadProxy.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IAssemblyLoadProxy.cs.meta new file mode 100644 index 0000000..a794168 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IAssemblyLoadProxy.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 12dfd4bdbb5c8e6419432fbc54ef25d9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IAssemblyWrapper.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IAssemblyWrapper.cs new file mode 100644 index 0000000..d423db9 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IAssemblyWrapper.cs @@ -0,0 +1,11 @@ +using System.Reflection; + +namespace UnityEngine.TestTools.Utils +{ + internal interface IAssemblyWrapper + { + Assembly Assembly { get; } + string Location { get; } + AssemblyName[] GetReferencedAssemblies(); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IAssemblyWrapper.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IAssemblyWrapper.cs.meta new file mode 100644 index 0000000..ae919ef --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IAssemblyWrapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1c5afe945b715e149a70113a4be7b32a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IScriptingRuntimeProxy.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IScriptingRuntimeProxy.cs new file mode 100644 index 0000000..2bb572d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IScriptingRuntimeProxy.cs @@ -0,0 +1,7 @@ +namespace UnityEngine.TestTools.Utils +{ + internal interface IScriptingRuntimeProxy + { + string[] GetAllUserAssemblies(); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IScriptingRuntimeProxy.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IScriptingRuntimeProxy.cs.meta new file mode 100644 index 0000000..6002d28 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/IScriptingRuntimeProxy.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fe4aef60e4ace544c8430da8ef8acba2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/ITestAssemblyProvider.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/ITestAssemblyProvider.cs new file mode 100644 index 0000000..2944936 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/ITestAssemblyProvider.cs @@ -0,0 +1,10 @@ +using NUnit.Framework.Interfaces; + +namespace UnityEngine.TestTools.Utils +{ + internal interface ITestAssemblyProvider + { + ITest GetTestsWithNUnit(); + IAssemblyWrapper[] GetUserAssemblies(); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/ITestAssemblyProvider.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/ITestAssemblyProvider.cs.meta new file mode 100644 index 0000000..f187c63 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/ITestAssemblyProvider.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c5acba6181d845c4e92146009bd4480f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/PlayerTestAssemblyProvider.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/PlayerTestAssemblyProvider.cs new file mode 100644 index 0000000..0b47e1d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/PlayerTestAssemblyProvider.cs @@ -0,0 +1,66 @@ +using System.Collections.Generic; +using System.IO; +using System.Linq; +using NUnit.Framework.Interfaces; +using UnityEngine.TestTools.NUnitExtensions; + +namespace UnityEngine.TestTools.Utils +{ + internal class PlayerTestAssemblyProvider + { + private IAssemblyLoadProxy m_AssemblyLoadProxy; + private readonly List m_AssembliesToLoad; + + //Cached until domain reload + private static List m_LoadedAssemblies; + + internal PlayerTestAssemblyProvider(IAssemblyLoadProxy assemblyLoadProxy, List assembliesToLoad) + { + m_AssemblyLoadProxy = assemblyLoadProxy; + m_AssembliesToLoad = assembliesToLoad; + LoadAssemblies(); + } + + public ITest GetTestsWithNUnit() + { + return BuildTests(TestPlatform.PlayMode, m_LoadedAssemblies.ToArray()); + } + + public List GetUserAssemblies() + { + return m_LoadedAssemblies; + } + + protected static ITest BuildTests(TestPlatform testPlatform, IAssemblyWrapper[] assemblies) + { + var settings = UnityTestAssemblyBuilder.GetNUnitTestBuilderSettings(testPlatform); + var builder = new UnityTestAssemblyBuilder(); + return builder.Build(assemblies.Select(a => a.Assembly).ToArray(), Enumerable.Repeat(testPlatform, assemblies.Length).ToArray(), settings); + } + + private void LoadAssemblies() + { + if (m_LoadedAssemblies != null) + { + return; + } + + m_LoadedAssemblies = new List(); + + foreach (var userAssembly in m_AssembliesToLoad) + { + IAssemblyWrapper a; + try + { + a = m_AssemblyLoadProxy.Load(userAssembly); + } + catch (FileNotFoundException) + { + continue; + } + if (a != null) + m_LoadedAssemblies.Add(a); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/PlayerTestAssemblyProvider.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/PlayerTestAssemblyProvider.cs.meta new file mode 100644 index 0000000..f2c86cd --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/PlayerTestAssemblyProvider.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 43a3aec217baa9644a7cf34b5f93fed9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/ScriptingRuntimeProxy.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/ScriptingRuntimeProxy.cs new file mode 100644 index 0000000..d84470e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/ScriptingRuntimeProxy.cs @@ -0,0 +1,10 @@ +namespace UnityEngine.TestTools.Utils +{ + internal class ScriptingRuntimeProxy : IScriptingRuntimeProxy + { + public string[] GetAllUserAssemblies() + { + return ScriptingRuntime.GetAllUserAssemblies(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/ScriptingRuntimeProxy.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/ScriptingRuntimeProxy.cs.meta new file mode 100644 index 0000000..2baf4f4 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AssemblyProvider/ScriptingRuntimeProxy.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f3a361a6ad1aff14ba8f48976e94ad76 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AttributeHelper.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AttributeHelper.cs new file mode 100644 index 0000000..9d2269b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AttributeHelper.cs @@ -0,0 +1,45 @@ +using System; +using System.IO; +using System.Linq; + +namespace UnityEngine.TestTools +{ + internal static class AttributeHelper + { + internal static Type GetTargetClassFromName(string targetClassName, Type attributeInterface) + { + Type targetClass = null; + foreach (var assemblyName in ScriptingRuntime.GetAllUserAssemblies()) + { + // we need to pass the assembly name without the .dll extension, so removing that first + var name = Path.GetFileNameWithoutExtension(assemblyName); + targetClass = Type.GetType(targetClassName + "," + name); + if (targetClass != null) + break; + } + + if (targetClass == null) + { + Debug.LogWarningFormat("Class type not found: " + targetClassName); + return null; + } + + ValidateTargetClass(targetClass, attributeInterface); + return targetClass; + } + + private static void ValidateTargetClass(Type targetClass, Type attributeInterface) + { + var constructorInfos = targetClass.GetConstructors(); + if (constructorInfos.All(constructor => constructor.GetParameters().Length != 0)) + { + Debug.LogWarningFormat("{0} does not implement default constructor", targetClass.Name); + } + + if (!attributeInterface.IsAssignableFrom(targetClass)) + { + Debug.LogWarningFormat("{0} does not implement {1}", targetClass.Name, attributeInterface.Name); + } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AttributeHelper.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AttributeHelper.cs.meta new file mode 100644 index 0000000..5ed31a9 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/AttributeHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ae8ce3ffe04ac2c42945fd27e0291fc3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/ColorEqualityComparer.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/ColorEqualityComparer.cs new file mode 100644 index 0000000..347ec93 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/ColorEqualityComparer.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; + +namespace UnityEngine.TestTools.Utils +{ + public class ColorEqualityComparer : IEqualityComparer + { + private const float k_DefaultError = 0.01f; + private readonly float AllowedError; + + + private static readonly ColorEqualityComparer m_Instance = new ColorEqualityComparer(); + public static ColorEqualityComparer Instance { get { return m_Instance; } } + + private ColorEqualityComparer() : this(k_DefaultError) + { + } + + public ColorEqualityComparer(float error) + { + this.AllowedError = error; + } + + public bool Equals(Color expected, Color actual) + { + return Utils.AreFloatsEqualAbsoluteError(expected.r, actual.r, AllowedError) && + Utils.AreFloatsEqualAbsoluteError(expected.g, actual.g, AllowedError) && + Utils.AreFloatsEqualAbsoluteError(expected.b, actual.b, AllowedError) && + Utils.AreFloatsEqualAbsoluteError(expected.a, actual.a, AllowedError); + } + + public int GetHashCode(Color color) + { + return 0; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/ColorEqualityComparer.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/ColorEqualityComparer.cs.meta new file mode 100644 index 0000000..87a9fe8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/ColorEqualityComparer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d6105bc8cf5ce544487daca4cbc62583 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/CoroutineRunner.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/CoroutineRunner.cs new file mode 100644 index 0000000..e775aa7 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/CoroutineRunner.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections; +using NUnit.Framework.Internal; +using UnityEngine.TestRunner.NUnitExtensions.Runner; + +namespace UnityEngine.TestTools.Utils +{ + internal class CoroutineRunner + { + private bool m_Running; + private bool m_TestFailed; + private bool m_Timeout; + private readonly MonoBehaviour m_Controller; + private readonly UnityTestExecutionContext m_Context; + private Coroutine m_TimeOutCoroutine; + private IEnumerator m_TestCoroutine; + + internal const int k_DefaultTimeout = 1000 * 180; + + public CoroutineRunner(MonoBehaviour playmodeTestsController, UnityTestExecutionContext context) + { + m_Controller = playmodeTestsController; + m_Context = context; + } + + public IEnumerator HandleEnumerableTest(IEnumerator testEnumerator) + { + if (m_Context.TestCaseTimeout == 0) + { + m_Context.TestCaseTimeout = k_DefaultTimeout; + } + do + { + if (!m_Running) + { + m_Running = true; + m_TestCoroutine = ExMethod(testEnumerator, m_Context.TestCaseTimeout); + m_Controller.StartCoroutine(m_TestCoroutine); + } + if (m_TestFailed) + { + StopAllRunningCoroutines(); + yield break; + } + + if (m_Context.ExecutionStatus == TestExecutionStatus.StopRequested || m_Context.ExecutionStatus == TestExecutionStatus.AbortRequested) + { + StopAllRunningCoroutines(); + yield break; + } + yield return null; + } + while (m_Running); + } + + private void StopAllRunningCoroutines() + { + if (m_TimeOutCoroutine != null) + { + m_Controller.StopCoroutine(m_TimeOutCoroutine); + } + + if (m_TestCoroutine != null) + { + m_Controller.StopCoroutine(m_TestCoroutine); + } + } + + private IEnumerator ExMethod(IEnumerator e, int timeout) + { + m_TimeOutCoroutine = m_Controller.StartCoroutine(StartTimer(e, timeout, + () => + { + m_TestFailed = true; + m_Timeout = true; + m_Running = false; + })); + + yield return m_Controller.StartCoroutine(e); + m_Controller.StopCoroutine(m_TimeOutCoroutine); + m_Running = false; + } + + private IEnumerator StartTimer(IEnumerator coroutineToBeKilled, int timeout, Action onTimeout) + { + yield return new WaitForSecondsRealtime(timeout / 1000f); + if (coroutineToBeKilled != null) + m_Controller.StopCoroutine(coroutineToBeKilled); + if (onTimeout != null) + onTimeout(); + } + + public bool HasFailedWithTimeout() + { + return m_Timeout; + } + + public int GetDefaultTimeout() + { + return k_DefaultTimeout; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/CoroutineRunner.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/CoroutineRunner.cs.meta new file mode 100644 index 0000000..ed7d3e9 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/CoroutineRunner.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 24a158219395ebf44a60547b97784ddc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/FloatEqualityComparer.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/FloatEqualityComparer.cs new file mode 100644 index 0000000..dfd4956 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/FloatEqualityComparer.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; + +namespace UnityEngine.TestTools.Utils +{ + public class FloatEqualityComparer : IEqualityComparer + { + private const float k_DefaultError = 0.0001f; + private readonly float AllowedError; + + private static readonly FloatEqualityComparer m_Instance = new FloatEqualityComparer(); + public static FloatEqualityComparer Instance { get { return m_Instance; } } + + private FloatEqualityComparer() : this(k_DefaultError) {} + + public FloatEqualityComparer(float allowedError) + { + this.AllowedError = allowedError; + } + + public bool Equals(float expected, float actual) + { + return Utils.AreFloatsEqual(expected, actual, AllowedError); + } + + public int GetHashCode(float value) + { + return 0; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/FloatEqualityComparer.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/FloatEqualityComparer.cs.meta new file mode 100644 index 0000000..5486c55 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/FloatEqualityComparer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: af5042802f06c804c8abddd544b77a4a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IOuterUnityTestAction.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IOuterUnityTestAction.cs new file mode 100644 index 0000000..e9eaa3c --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IOuterUnityTestAction.cs @@ -0,0 +1,19 @@ +using System.Collections; +using NUnit.Framework.Interfaces; + +namespace UnityEngine.TestTools +{ + /// + /// When implemented by an attribute, this interface implemented to provide actions to execute before setup and after teardown of tests. + /// + public interface IOuterUnityTestAction + { + /// Executed before each test is run + /// The test that is going to be run. + IEnumerator BeforeTest(ITest test); + + /// Executed after each test is run + /// The test that has just been run. + IEnumerator AfterTest(ITest test); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IOuterUnityTestAction.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IOuterUnityTestAction.cs.meta new file mode 100644 index 0000000..91da147 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IOuterUnityTestAction.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b9c2a6302985d3846b7b9f6fd9e2da9a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IPostBuildCleanup.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IPostBuildCleanup.cs new file mode 100644 index 0000000..5f79948 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IPostBuildCleanup.cs @@ -0,0 +1,7 @@ +namespace UnityEngine.TestTools +{ + public interface IPostBuildCleanup + { + void Cleanup(); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IPostBuildCleanup.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IPostBuildCleanup.cs.meta new file mode 100644 index 0000000..281b577 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IPostBuildCleanup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ff67c526455160f4690a44f74dee4cbe +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IPrebuildSceneSetup.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IPrebuildSceneSetup.cs new file mode 100644 index 0000000..c480fbf --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IPrebuildSceneSetup.cs @@ -0,0 +1,7 @@ +namespace UnityEngine.TestTools +{ + public interface IPrebuildSetup + { + void Setup(); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IPrebuildSceneSetup.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IPrebuildSceneSetup.cs.meta new file mode 100644 index 0000000..f776662 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/IPrebuildSceneSetup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: acc16f0c684508f44813662a300c574b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/ITestRunCallback.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/ITestRunCallback.cs new file mode 100644 index 0000000..dd4c170 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/ITestRunCallback.cs @@ -0,0 +1,12 @@ +using NUnit.Framework.Interfaces; + +namespace UnityEngine.TestRunner +{ + public interface ITestRunCallback + { + void RunStarted(ITest testsToRun); + void RunFinished(ITestResult testResults); + void TestStarted(ITest test); + void TestFinished(ITestResult result); + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/ITestRunCallback.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/ITestRunCallback.cs.meta new file mode 100644 index 0000000..1888c05 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/ITestRunCallback.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 38d0b8a87b967304da08a2ae9b955066 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest.meta new file mode 100644 index 0000000..9d60b01 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ce8da628f68c7594b8b9a597fa52db7b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest/IMonoBehaviourTest.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest/IMonoBehaviourTest.cs new file mode 100644 index 0000000..478d606 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest/IMonoBehaviourTest.cs @@ -0,0 +1,7 @@ +namespace UnityEngine.TestTools +{ + public interface IMonoBehaviourTest + { + bool IsTestFinished {get; } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest/IMonoBehaviourTest.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest/IMonoBehaviourTest.cs.meta new file mode 100644 index 0000000..fb11dfb --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest/IMonoBehaviourTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a002d3737b873954395b7cf862873ab8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest/MonoBehaviourTest.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest/MonoBehaviourTest.cs new file mode 100644 index 0000000..b3c1c62 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest/MonoBehaviourTest.cs @@ -0,0 +1,23 @@ +namespace UnityEngine.TestTools +{ + public class MonoBehaviourTest : CustomYieldInstruction where T : MonoBehaviour, IMonoBehaviourTest + { + public T component { get; } + public GameObject gameObject { get { return component.gameObject; } } + + public MonoBehaviourTest(bool dontDestroyOnLoad = true) + { + var go = new GameObject("MonoBehaviourTest: " + typeof(T).FullName); + component = go.AddComponent(); + if (dontDestroyOnLoad) + { + Object.DontDestroyOnLoad(go); + } + } + + public override bool keepWaiting + { + get { return !component.IsTestFinished; } + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest/MonoBehaviourTest.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest/MonoBehaviourTest.cs.meta new file mode 100644 index 0000000..d0fa5a1 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/MonoBehaviourTest/MonoBehaviourTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 164c9b1458eaab743a4b45c37a4d720d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/PostBuildCleanupAttribute.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/PostBuildCleanupAttribute.cs new file mode 100644 index 0000000..2864daf --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/PostBuildCleanupAttribute.cs @@ -0,0 +1,20 @@ +using System; + +namespace UnityEngine.TestTools +{ + [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)] + public class PostBuildCleanupAttribute : Attribute + { + public PostBuildCleanupAttribute(Type targetClass) + { + TargetClass = targetClass; + } + + public PostBuildCleanupAttribute(string targetClassName) + { + TargetClass = AttributeHelper.GetTargetClassFromName(targetClassName, typeof(IPostBuildCleanup)); + } + + internal Type TargetClass { get; private set; } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/PostBuildCleanupAttribute.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/PostBuildCleanupAttribute.cs.meta new file mode 100644 index 0000000..e3ac3e8 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/PostBuildCleanupAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 621fd19bcb071b64aa1d68f0271aa780 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/PrebuildSceneSetupAttribute.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/PrebuildSceneSetupAttribute.cs new file mode 100644 index 0000000..ea2c172 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/PrebuildSceneSetupAttribute.cs @@ -0,0 +1,20 @@ +using System; + +namespace UnityEngine.TestTools +{ + [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)] + public class PrebuildSetupAttribute : Attribute + { + public PrebuildSetupAttribute(Type targetClass) + { + TargetClass = targetClass; + } + + public PrebuildSetupAttribute(string targetClassName) + { + TargetClass = AttributeHelper.GetTargetClassFromName(targetClassName, typeof(IPrebuildSetup)); + } + + internal Type TargetClass { get; private set; } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/PrebuildSceneSetupAttribute.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/PrebuildSceneSetupAttribute.cs.meta new file mode 100644 index 0000000..15402ac --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/PrebuildSceneSetupAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d1b7ce919aa8864409412e809073cf96 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/QuaternionEqualityComparer.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/QuaternionEqualityComparer.cs new file mode 100644 index 0000000..ede7a8f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/QuaternionEqualityComparer.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +namespace UnityEngine.TestTools.Utils +{ + public class QuaternionEqualityComparer : IEqualityComparer + { + private const float k_DefaultError = 0.00001f; + private readonly float AllowedError; + + private static readonly QuaternionEqualityComparer m_Instance = new QuaternionEqualityComparer(); + public static QuaternionEqualityComparer Instance { get { return m_Instance; } } + + + private QuaternionEqualityComparer() : this(k_DefaultError) {} + + public QuaternionEqualityComparer(float allowedError) + { + AllowedError = allowedError; + } + + public bool Equals(Quaternion expected, Quaternion actual) + { + return Mathf.Abs(Quaternion.Dot(expected, actual)) > (1.0f - AllowedError); + } + + public int GetHashCode(Quaternion quaternion) + { + return 0; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/QuaternionEqualityComparer.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/QuaternionEqualityComparer.cs.meta new file mode 100644 index 0000000..8c3d16b --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/QuaternionEqualityComparer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3b28913f21577de429da928d6d05219f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/StacktraceFilter.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/StacktraceFilter.cs new file mode 100644 index 0000000..6f1e690 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/StacktraceFilter.cs @@ -0,0 +1,43 @@ +using System.Linq; +using System.Text; + +namespace UnityEngine.TestTools.Utils +{ + internal static class StackTraceFilter + { + private static readonly string[] s_FilteredLogMessages = + { + @"UnityEngine.DebugLogHandler:Internal_Log", + @"UnityEngine.DebugLogHandler:Log", + @"UnityEngine.Logger:Log", + @"UnityEngine.Debug" + }; + + private static readonly string[] s_LastMessages = + { + @"System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)", + @"UnityEditor.TestTools.TestRunner.EditModeRunner:InvokeDelegator" + }; + + public static string Filter(string inputStackTrace) + { + int idx; + foreach (var lastMessage in s_LastMessages) + { + idx = inputStackTrace.IndexOf(lastMessage); + if (idx != -1) + inputStackTrace = inputStackTrace.Substring(0, idx); + } + + var inputStackTraceLines = inputStackTrace.Split('\n'); + var result = new StringBuilder(); + foreach (var line in inputStackTraceLines) + { + if (s_FilteredLogMessages.Any(s => line.StartsWith(s))) + continue; + result.AppendLine(line); + } + return result.ToString(); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/StacktraceFilter.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/StacktraceFilter.cs.meta new file mode 100644 index 0000000..3ba70cd --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/StacktraceFilter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fc748d99f1f0d484a811a566fc7915ec +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/TestRunCallbackAttribute.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/TestRunCallbackAttribute.cs new file mode 100644 index 0000000..b8a5086 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/TestRunCallbackAttribute.cs @@ -0,0 +1,24 @@ +using System; + +namespace UnityEngine.TestRunner +{ + [AttributeUsage(AttributeTargets.Assembly)] + public class TestRunCallbackAttribute : Attribute + { + private Type m_Type; + public TestRunCallbackAttribute(Type type) + { + var interfaceType = typeof(ITestRunCallback); + if (!interfaceType.IsAssignableFrom(type)) + { + throw new ArgumentException(string.Format("Type provided to {0} does not implement {1}", this.GetType().Name, interfaceType.Name)); + } + m_Type = type; + } + + internal ITestRunCallback ConstructCallback() + { + return Activator.CreateInstance(m_Type) as ITestRunCallback; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/TestRunCallbackAttribute.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/TestRunCallbackAttribute.cs.meta new file mode 100644 index 0000000..c40da51 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/TestRunCallbackAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 76b3a3296de548f48b0c3d088fb4b490 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/TestRunCallbackListener.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/TestRunCallbackListener.cs new file mode 100644 index 0000000..4425fa0 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/TestRunCallbackListener.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; +using UnityEngine.TestTools.TestRunner; + +namespace UnityEngine.TestRunner.Utils +{ + internal class TestRunCallbackListener : ScriptableObject, ITestRunnerListener + { + private ITestRunCallback[] m_Callbacks; + public void RunStarted(ITest testsToRun) + { + InvokeAllCallbacks(callback => callback.RunStarted(testsToRun)); + } + + private static ITestRunCallback[] GetAllCallbacks() + { + var allAssemblies = AppDomain.CurrentDomain.GetAssemblies(); + allAssemblies = allAssemblies.Where(x => x.GetReferencedAssemblies().Any(z => z.Name == "UnityEngine.TestRunner")).ToArray(); + var attributes = allAssemblies.SelectMany(assembly => assembly.GetCustomAttributes(typeof(TestRunCallbackAttribute), true).OfType()).ToArray(); + return attributes.Select(attribute => attribute.ConstructCallback()).ToArray(); + } + + private void InvokeAllCallbacks(Action invoker) + { + if (m_Callbacks == null) + { + m_Callbacks = GetAllCallbacks(); + } + + foreach (var testRunCallback in m_Callbacks) + { + try + { + invoker(testRunCallback); + } + catch (Exception e) + { + Debug.LogException(e); + throw; + } + } + } + + public void RunFinished(ITestResult testResults) + { + InvokeAllCallbacks(callback => callback.RunFinished(testResults)); + } + + public void TestStarted(ITest test) + { + InvokeAllCallbacks(callback => callback.TestStarted(test)); + } + + public void TestFinished(ITestResult result) + { + InvokeAllCallbacks(callback => callback.TestFinished(result)); + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/TestRunCallbackListener.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/TestRunCallbackListener.cs.meta new file mode 100644 index 0000000..aec1caa --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/TestRunCallbackListener.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 68f09f0f82599b5448579854e622a4c1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Utils.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Utils.cs new file mode 100644 index 0000000..52a1482 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Utils.cs @@ -0,0 +1,40 @@ +using System; + +namespace UnityEngine.TestTools.Utils +{ + public static class Utils + { + public static bool AreFloatsEqual(float expected, float actual, float epsilon) + { + // special case for infinity + if (expected == Mathf.Infinity || actual == Mathf.Infinity || expected == Mathf.NegativeInfinity || actual == Mathf.NegativeInfinity) + return expected == actual; + + // we cover both relative and absolute tolerance with this check + // which is better than just relative in case of small (in abs value) args + // please note that "usually" approximation is used [i.e. abs(x)+abs(y)+1] + // but we speak about test code so we dont care that much about performance + // but we do care about checks being more precise + return Math.Abs(actual - expected) <= epsilon * Mathf.Max(Mathf.Max(Mathf.Abs(actual), Mathf.Abs(expected)), 1.0f); + } + + public static bool AreFloatsEqualAbsoluteError(float expected, float actual, float allowedAbsoluteError) + { + return Math.Abs(actual - expected) <= allowedAbsoluteError; + } + + /// + /// Analogous to GameObject.CreatePrimitive, but creates a primitive mesh renderer with fast shader instead of a default builtin shader. + /// Optimized for testing performance. + /// + /// A GameObject with primitive mesh renderer and collider. + public static GameObject CreatePrimitive(PrimitiveType type) + { + var prim = GameObject.CreatePrimitive(type); + var renderer = prim.GetComponent(); + if (renderer) + renderer.sharedMaterial = new Material(Shader.Find("VertexLit")); + return prim; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Utils.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Utils.cs.meta new file mode 100644 index 0000000..32a5d6f --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Utils.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9502550ba4785e3499d6c9251fa2114b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector2ComparerWithEqualsOperator.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector2ComparerWithEqualsOperator.cs new file mode 100644 index 0000000..074dfa5 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector2ComparerWithEqualsOperator.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace UnityEngine.TestTools.Utils +{ + public class Vector2ComparerWithEqualsOperator : IEqualityComparer + { + private static readonly Vector2ComparerWithEqualsOperator m_Instance = new Vector2ComparerWithEqualsOperator(); + public static Vector2ComparerWithEqualsOperator Instance { get { return m_Instance; } } + + private Vector2ComparerWithEqualsOperator() {} + + public bool Equals(Vector2 expected, Vector2 actual) + { + return expected == actual; + } + + public int GetHashCode(Vector2 vec2) + { + return 0; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector2ComparerWithEqualsOperator.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector2ComparerWithEqualsOperator.cs.meta new file mode 100644 index 0000000..9f25fdc --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector2ComparerWithEqualsOperator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 65701ebe8bada6b4785e9c7afe7f5bee +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector2EqualityComparer.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector2EqualityComparer.cs new file mode 100644 index 0000000..6806b7a --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector2EqualityComparer.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; + +namespace UnityEngine.TestTools.Utils +{ + public class Vector2EqualityComparer : IEqualityComparer + { + private const float k_DefaultError = 0.0001f; + private readonly float AllowedError; + + private static readonly Vector2EqualityComparer m_Instance = new Vector2EqualityComparer(); + public static Vector2EqualityComparer Instance { get { return m_Instance; } } + + private Vector2EqualityComparer() : this(k_DefaultError) + { + } + + public Vector2EqualityComparer(float error) + { + this.AllowedError = error; + } + + public bool Equals(Vector2 expected, Vector2 actual) + { + return Utils.AreFloatsEqual(expected.x, actual.x, AllowedError) && + Utils.AreFloatsEqual(expected.y, actual.y, AllowedError); + } + + public int GetHashCode(Vector2 vec2) + { + return 0; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector2EqualityComparer.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector2EqualityComparer.cs.meta new file mode 100644 index 0000000..06fc773 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector2EqualityComparer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 58ad09607a0d62d458a78d7174665566 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector3ComparerWithEqualsOperator.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector3ComparerWithEqualsOperator.cs new file mode 100644 index 0000000..0650e0e --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector3ComparerWithEqualsOperator.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace UnityEngine.TestTools.Utils +{ + public class Vector3ComparerWithEqualsOperator : IEqualityComparer + { + private static readonly Vector3ComparerWithEqualsOperator m_Instance = new Vector3ComparerWithEqualsOperator(); + public static Vector3ComparerWithEqualsOperator Instance { get { return m_Instance; } } + + private Vector3ComparerWithEqualsOperator() {} + + public bool Equals(Vector3 expected, Vector3 actual) + { + return expected == actual; + } + + public int GetHashCode(Vector3 vec3) + { + return 0; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector3ComparerWithEqualsOperator.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector3ComparerWithEqualsOperator.cs.meta new file mode 100644 index 0000000..b3c4c43 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector3ComparerWithEqualsOperator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5b994928117e3db418da69c821da7e19 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector3EqualityComparer.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector3EqualityComparer.cs new file mode 100644 index 0000000..42ff0b0 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector3EqualityComparer.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; + + +namespace UnityEngine.TestTools.Utils +{ + public class Vector3EqualityComparer : IEqualityComparer + { + private const float k_DefaultError = 0.0001f; + private readonly float AllowedError; + + private static readonly Vector3EqualityComparer m_Instance = new Vector3EqualityComparer(); + public static Vector3EqualityComparer Instance { get { return m_Instance; } } + + private Vector3EqualityComparer() : this(k_DefaultError) {} + public Vector3EqualityComparer(float allowedError) + { + this.AllowedError = allowedError; + } + + public bool Equals(Vector3 expected, Vector3 actual) + { + return Utils.AreFloatsEqual(expected.x, actual.x, AllowedError) && + Utils.AreFloatsEqual(expected.y, actual.y, AllowedError) && + Utils.AreFloatsEqual(expected.z, actual.z, AllowedError); + } + + public int GetHashCode(Vector3 vec3) + { + return 0; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector3EqualityComparer.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector3EqualityComparer.cs.meta new file mode 100644 index 0000000..1474236 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector3EqualityComparer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4bd2bc28ff24d5c488844851cb785db0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector4ComparerWithEqualsOperator.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector4ComparerWithEqualsOperator.cs new file mode 100644 index 0000000..2524817 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector4ComparerWithEqualsOperator.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace UnityEngine.TestTools.Utils +{ + public class Vector4ComparerWithEqualsOperator : IEqualityComparer + { + private static readonly Vector4ComparerWithEqualsOperator m_Instance = new Vector4ComparerWithEqualsOperator(); + public static Vector4ComparerWithEqualsOperator Instance { get { return m_Instance; } } + + private Vector4ComparerWithEqualsOperator() {} + + public bool Equals(Vector4 expected, Vector4 actual) + { + return expected == actual; + } + + public int GetHashCode(Vector4 vec4) + { + return 0; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector4ComparerWithEqualsOperator.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector4ComparerWithEqualsOperator.cs.meta new file mode 100644 index 0000000..ef9d109 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector4ComparerWithEqualsOperator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 44100f5f60f351348b9719b46d46cebe +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector4EqualityComparer.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector4EqualityComparer.cs new file mode 100644 index 0000000..23640f6 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector4EqualityComparer.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; + +namespace UnityEngine.TestTools.Utils +{ + public class Vector4EqualityComparer : IEqualityComparer + { + private const float k_DefaultError = 0.0001f; + private readonly float AllowedError; + + private static readonly Vector4EqualityComparer m_Instance = new Vector4EqualityComparer(); + public static Vector4EqualityComparer Instance { get { return m_Instance; } } + + private Vector4EqualityComparer() : this(k_DefaultError) {} + public Vector4EqualityComparer(float allowedError) + { + this.AllowedError = allowedError; + } + + public bool Equals(Vector4 expected, Vector4 actual) + { + return Utils.AreFloatsEqual(expected.x, actual.x, AllowedError) && + Utils.AreFloatsEqual(expected.y, actual.y, AllowedError) && + Utils.AreFloatsEqual(expected.z, actual.z, AllowedError) && + Utils.AreFloatsEqual(expected.w, actual.w, AllowedError); + } + + public int GetHashCode(Vector4 vec4) + { + return 0; + } + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector4EqualityComparer.cs.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector4EqualityComparer.cs.meta new file mode 100644 index 0000000..75f969d --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/Utils/Vector4EqualityComparer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 32da81683c22faf458026716a2b821aa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/package.json b/Library/PackageCache/com.unity.test-framework@1.1.11/package.json new file mode 100644 index 0000000..0fa8602 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/package.json @@ -0,0 +1,26 @@ +{ + "name": "com.unity.test-framework", + "displayName": "Test Framework", + "version": "1.1.11", + "unity": "2019.2", + "unityRelease": "0a10", + "description": "Test framework for running Edit mode and Play mode tests in Unity.", + "keywords": [ + "Test", + "TestFramework" + ], + "category": "Unity Test Framework", + "repository": { + "type": "git", + "url": "git@github.com:Unity-Technologies/com.unity.test-framework.git", + "revision": "815e122f0a538e96d3b3b29e23bb7691bd2d4844" + }, + "dependencies": { + "com.unity.ext.nunit": "1.0.0", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + }, + "relatedPackages": { + "com.unity.test-framework.tests": "1.1.11" + } +} diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/package.json.meta b/Library/PackageCache/com.unity.test-framework@1.1.11/package.json.meta new file mode 100644 index 0000000..d45c176 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d6a2e6e4803de7b43baacdc355fc144d +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: -- cgit v1.2.3