From c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sun, 19 Apr 2020 17:19:32 -0400 Subject: Inital commit --- .../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 + 329 files changed, 11162 insertions(+) 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 (limited to 'Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner') 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: -- cgit v1.2.3