summaryrefslogtreecommitdiff
path: root/Library/PackageCache/com.unity.ide.rider@1.1.4/Rider/Editor/UnitTesting/RiderTestRunner.cs
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2020-04-19 17:19:32 -0400
committerAndrew Lee <alee14498@protonmail.com>2020-04-19 17:19:32 -0400
commitc55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78 (patch)
treeee4d51c7c1d633e11f46453ef1edd3c77c4ef9f7 /Library/PackageCache/com.unity.ide.rider@1.1.4/Rider/Editor/UnitTesting/RiderTestRunner.cs
downloadProject-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.tar.gz
Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.tar.bz2
Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.zip
Inital commit
Diffstat (limited to 'Library/PackageCache/com.unity.ide.rider@1.1.4/Rider/Editor/UnitTesting/RiderTestRunner.cs')
-rw-r--r--Library/PackageCache/com.unity.ide.rider@1.1.4/Rider/Editor/UnitTesting/RiderTestRunner.cs47
1 files changed, 47 insertions, 0 deletions
diff --git a/Library/PackageCache/com.unity.ide.rider@1.1.4/Rider/Editor/UnitTesting/RiderTestRunner.cs b/Library/PackageCache/com.unity.ide.rider@1.1.4/Rider/Editor/UnitTesting/RiderTestRunner.cs
new file mode 100644
index 0000000..eb3b249
--- /dev/null
+++ b/Library/PackageCache/com.unity.ide.rider@1.1.4/Rider/Editor/UnitTesting/RiderTestRunner.cs
@@ -0,0 +1,47 @@
+using JetBrains.Annotations;
+using UnityEngine;
+#if TEST_FRAMEWORK
+using UnityEditor;
+using UnityEditor.TestTools.TestRunner.Api;
+#endif
+
+namespace Packages.Rider.Editor.UnitTesting
+{
+ public static class RiderTestRunner
+ {
+#if TEST_FRAMEWORK
+ private static readonly TestsCallback Callback = ScriptableObject.CreateInstance<TestsCallback>();
+#endif
+ [UsedImplicitly]
+ public static void RunTests(int testMode, string[] assemblyNames, string[] testNames, string[] categoryNames, string[] groupNames, int? buildTarget)
+ {
+#if !TEST_FRAMEWORK
+ Debug.LogError("Update Test Framework package to v.1.1.1+ to run tests from Rider.");
+#else
+ CallbackData.instance.isRider = true;
+
+ var api = ScriptableObject.CreateInstance<TestRunnerApi>();
+ var settings = new ExecutionSettings();
+ var filter = new Filter
+ {
+ assemblyNames = assemblyNames,
+ testNames = testNames,
+ categoryNames = categoryNames,
+ groupNames = groupNames,
+ targetPlatform = (BuildTarget?) buildTarget
+ };
+
+ if (testMode > 0) // for future use - test-framework would allow running both Edit and Play test at once
+ filter.testMode = (TestMode) testMode;
+
+ settings.filters = new []{
+ filter
+ };
+ api.Execute(settings);
+
+ api.UnregisterCallbacks(Callback); // avoid multiple registrations
+ api.RegisterCallbacks(Callback); // This can be used to receive information about when the test suite and individual tests starts and stops. Provide this with a scriptable object implementing ICallbacks
+#endif
+ }
+ }
+} \ No newline at end of file