Browse Source

Merge pull request #387 from FungusGames/update-test-tools

Updated test tools to fix compiler warnings
master
Chris Gregan 9 years ago
parent
commit
b7fac1bc80
  1. 3
      Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs
  2. 4
      Assets/UnityTestTools/Common/Settings/IntegrationTestsRunnerSettings.asset.meta
  3. 2
      Assets/UnityTestTools/IntegrationTestsFramework/Libs.meta
  4. 2
      Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.Mdb.dll.meta
  5. 6
      Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.dll.meta
  6. 3
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Batch.cs
  7. 2
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/EditorReferencesUtil.cs.meta
  8. 8
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerWindow.cs
  9. 5
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerConfiguration.cs
  10. 5
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettingsWindow.cs
  11. 5
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/TestComponentEditor.cs
  12. 7
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/ResultDTO.cs
  13. 5
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestComponent.cs
  14. 7
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunner.cs

3
Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs

@ -4,6 +4,7 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using UnityEditor.SceneManagement;
namespace UnityTest namespace UnityTest
{ {
@ -81,6 +82,8 @@ namespace UnityTest
DrawCompareToType(script.Action as ComparerBase); DrawCompareToType(script.Action as ComparerBase);
} }
} }
if(GUI.changed)
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
} }
private void DrawOptionsForAfterPeriodOfTime(AssertionComponent script) private void DrawOptionsForAfterPeriodOfTime(AssertionComponent script)

4
Assets/UnityTestTools/Common/Settings/IntegrationTestsRunnerSettings.asset.meta

@ -1,6 +1,6 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: ad7c6353939274fc8a5e756095b99a64 guid: ec24e4a07acd24ffaa1cd1df7fa11d54
timeCreated: 1450715835 timeCreated: 1455275624
licenseType: Free licenseType: Free
NativeFormatImporter: NativeFormatImporter:
userData: userData:

2
Assets/UnityTestTools/IntegrationTestsFramework/Libs.meta

@ -2,7 +2,7 @@ fileFormatVersion: 2
guid: e22ba039de7077c4aa95758ef723b803 guid: e22ba039de7077c4aa95758ef723b803
folderAsset: yes folderAsset: yes
timeCreated: 1445282049 timeCreated: 1445282049
licenseType: Store licenseType: Pro
DefaultImporter: DefaultImporter:
userData: userData:
assetBundleName: assetBundleName:

2
Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.Mdb.dll.meta

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 713231d47408a06408a45470c967bae8 guid: 713231d47408a06408a45470c967bae8
timeCreated: 1441797177 timeCreated: 1441797177
licenseType: Store licenseType: Pro
PluginImporter: PluginImporter:
serializedVersion: 1 serializedVersion: 1
iconMap: {} iconMap: {}

6
Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.dll.meta

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 28fc22990733f8f4ea1137f15e363609 guid: 28fc22990733f8f4ea1137f15e363609
timeCreated: 1441797177 timeCreated: 1441797177
licenseType: Store licenseType: Pro
PluginImporter: PluginImporter:
serializedVersion: 1 serializedVersion: 1
iconMap: {} iconMap: {}
@ -15,6 +15,10 @@ PluginImporter:
enabled: 1 enabled: 1
settings: settings:
DefaultValueInitialized: true DefaultValueInitialized: true
WindowsStoreApps:
enabled: 0
settings:
CPU: AnyCPU
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

3
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Batch.cs

@ -6,6 +6,7 @@ using UnityEditor;
using UnityEditorInternal; using UnityEditorInternal;
using UnityEngine; using UnityEngine;
using UnityTest.IntegrationTests; using UnityTest.IntegrationTests;
using UnityEditor.SceneManagement;
namespace UnityTest namespace UnityTest
{ {
@ -89,7 +90,7 @@ namespace UnityTest
return; return;
} }
EditorBuildSettings.scenes = (testScenes.Concat(otherBuildScenes).ToList()).Select(s => new EditorBuildSettingsScene(s, true)).ToArray(); EditorBuildSettings.scenes = (testScenes.Concat(otherBuildScenes).ToList()).Select(s => new EditorBuildSettingsScene(s, true)).ToArray();
EditorApplication.OpenScene(testScenes.First()); EditorSceneManager.OpenScene(testScenes.First());
GuiHelper.SetConsoleErrorPause(false); GuiHelper.SetConsoleErrorPause(false);
var config = new PlatformRunnerConfiguration var config = new PlatformRunnerConfiguration

2
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/EditorReferencesUtil.cs.meta

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: aad501c968b324cf3a8d1c52eb09ca04 guid: aad501c968b324cf3a8d1c52eb09ca04
timeCreated: 1437322927 timeCreated: 1437322927
licenseType: Store licenseType: Pro
MonoImporter: MonoImporter:
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []

8
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerWindow.cs

@ -6,6 +6,7 @@ using System.Text.RegularExpressions;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using UnityTest.IntegrationTestRunner; using UnityTest.IntegrationTestRunner;
using UnityEngine.SceneManagement;
namespace UnityTest namespace UnityTest
{ {
@ -83,10 +84,11 @@ namespace UnityTest
private static void BackgroundSceneChangeWatch() private static void BackgroundSceneChangeWatch()
{ {
if (!s_Instance) return; if (!s_Instance) return;
if (s_Instance.m_CurrectSceneName != null && s_Instance.m_CurrectSceneName == EditorApplication.currentScene) return; var currentScene = SceneManager.GetActiveScene().path;
if (s_Instance.m_CurrectSceneName != null && s_Instance.m_CurrectSceneName == currentScene) return;
if (EditorApplication.isPlayingOrWillChangePlaymode) return; if (EditorApplication.isPlayingOrWillChangePlaymode) return;
TestComponent.DestroyAllDynamicTests(); TestComponent.DestroyAllDynamicTests();
s_Instance.m_CurrectSceneName = EditorApplication.currentScene; s_Instance.m_CurrectSceneName = currentScene;
s_Instance.m_ResultList.Clear(); s_Instance.m_ResultList.Clear();
s_Instance.RebuildTestList(); s_Instance.RebuildTestList();
} }
@ -239,7 +241,7 @@ namespace UnityTest
if (!EditorApplication.isPlayingOrWillChangePlaymode) if (!EditorApplication.isPlayingOrWillChangePlaymode)
{ {
var dynamicTestsOnScene = TestComponent.FindAllDynamicTestsOnScene(); var dynamicTestsOnScene = TestComponent.FindAllDynamicTestsOnScene();
var dynamicTestTypes = TestComponent.GetTypesWithHelpAttribute(EditorApplication.currentScene); var dynamicTestTypes = TestComponent.GetTypesWithHelpAttribute(SceneManager.GetActiveScene().path);
foreach (var dynamicTestType in dynamicTestTypes) foreach (var dynamicTestType in dynamicTestTypes)
{ {

5
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerConfiguration.cs

@ -6,6 +6,7 @@ using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement;
[Serializable] [Serializable]
public class PlatformRunnerConfiguration public class PlatformRunnerConfiguration
@ -14,7 +15,7 @@ public class PlatformRunnerConfiguration
public List<string> testScenes; public List<string> testScenes;
public BuildTarget buildTarget; public BuildTarget buildTarget;
public bool runInEditor; public bool runInEditor;
public string projectName = EditorApplication.currentScene; public string projectName = SceneManager.GetActiveScene().path;
public string resultsDir = null; public string resultsDir = null;
public bool sendResultsOverNetwork; public bool sendResultsOverNetwork;
@ -24,7 +25,7 @@ public class PlatformRunnerConfiguration
public PlatformRunnerConfiguration(BuildTarget buildTarget) public PlatformRunnerConfiguration(BuildTarget buildTarget)
{ {
this.buildTarget = buildTarget; this.buildTarget = buildTarget;
projectName = EditorApplication.currentScene; projectName = SceneManager.GetActiveScene().path;
} }
public PlatformRunnerConfiguration() public PlatformRunnerConfiguration()

5
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettingsWindow.cs

@ -6,6 +6,7 @@ using System.Net;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
using UnityEngine.SceneManagement;
namespace UnityTest.IntegrationTests namespace UnityTest.IntegrationTests
{ {
@ -47,7 +48,7 @@ namespace UnityTest.IntegrationTests
position.Set(position.xMin, position.yMin, 200, position.height); position.Set(position.xMin, position.yMin, 200, position.height);
m_AllScenesInProject = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.unity", SearchOption.AllDirectories).ToList(); m_AllScenesInProject = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.unity", SearchOption.AllDirectories).ToList();
m_AllScenesInProject.Sort(); m_AllScenesInProject.Sort();
var currentScene = (Directory.GetCurrentDirectory() + EditorApplication.currentScene).Replace("\\", "").Replace("/", ""); var currentScene = (Directory.GetCurrentDirectory() + SceneManager.GetActiveScene().path).Replace("\\", "").Replace("/", "");
var currentScenePath = m_AllScenesInProject.Where(s => s.Replace("\\", "").Replace("/", "") == currentScene); var currentScenePath = m_AllScenesInProject.Where(s => s.Replace("\\", "").Replace("/", "") == currentScene);
m_SelectedScenes.AddRange(currentScenePath); m_SelectedScenes.AddRange(currentScenePath);
@ -264,7 +265,7 @@ namespace UnityTest.IntegrationTests
buildTarget = m_BuildTarget, buildTarget = m_BuildTarget,
buildScenes = m_OtherScenesToBuild, buildScenes = m_OtherScenesToBuild,
testScenes = m_IntegrationTestScenes, testScenes = m_IntegrationTestScenes,
projectName = m_IntegrationTestScenes.Count > 1 ? "IntegrationTests" : Path.GetFileNameWithoutExtension(EditorApplication.currentScene), projectName = m_IntegrationTestScenes.Count > 1 ? "IntegrationTests" : Path.GetFileNameWithoutExtension(SceneManager.GetActiveScene().path),
resultsDir = m_Settings.resultsPath, resultsDir = m_Settings.resultsPath,
sendResultsOverNetwork = m_Settings.sendResultsOverNetwork, sendResultsOverNetwork = m_Settings.sendResultsOverNetwork,
ipList = m_Interfaces.Skip(1).ToList(), ipList = m_Interfaces.Skip(1).ToList(),

5
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/TestComponentEditor.cs

@ -4,6 +4,7 @@ using System.Linq;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
using UnityEditor.SceneManagement;
namespace UnityTest namespace UnityTest
{ {
@ -101,8 +102,8 @@ namespace UnityTest
if (!component.dynamic) if (!component.dynamic)
serializedObject.ApplyModifiedProperties(); serializedObject.ApplyModifiedProperties();
if(GUI.changed) if (GUI.changed)
EditorApplication.MarkSceneDirty(); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
} }
private string[] GetListOfIgnoredPlatforms(string[] enumList, int flags) private string[] GetListOfIgnoredPlatforms(string[] enumList, int flags)

7
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/ResultDTO.cs

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement;
namespace UnityTest namespace UnityTest
{ {
@ -18,9 +19,9 @@ namespace UnityTest
private ResultDTO(MessageType messageType) private ResultDTO(MessageType messageType)
{ {
this.messageType = messageType; this.messageType = messageType;
levelCount = Application.levelCount; levelCount = UnityEngine.SceneManagement.SceneManager.sceneCount;
loadedLevel = Application.loadedLevel; loadedLevel = UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex;
loadedLevelName = Application.loadedLevelName; loadedLevelName = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
} }
public enum MessageType : byte public enum MessageType : byte

5
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestComponent.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement;
#if UNITY_EDITOR #if UNITY_EDITOR
using UnityEditor; using UnityEditor;
@ -308,9 +309,9 @@ namespace UnityTest
public static bool AnyDynamicTestForCurrentScene() public static bool AnyDynamicTestForCurrentScene()
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
return TestComponent.GetTypesWithHelpAttribute(EditorApplication.currentScene).Any(); return TestComponent.GetTypesWithHelpAttribute(SceneManager.GetActiveScene().name).Any();
#else #else
return TestComponent.GetTypesWithHelpAttribute(Application.loadedLevelName).Any(); return TestComponent.GetTypesWithHelpAttribute(SceneManager.GetActiveScene().name).Any();
#endif #endif
} }

7
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunner.cs

@ -8,6 +8,7 @@ using System.Reflection;
using UnityEngine; using UnityEngine;
using UnityTest.IntegrationTestRunner; using UnityTest.IntegrationTestRunner;
using System.IO; using System.IO;
using UnityEngine.SceneManagement;
namespace UnityTest namespace UnityTest
{ {
@ -74,7 +75,7 @@ namespace UnityTest
} }
TestComponent.DestroyAllDynamicTests(); TestComponent.DestroyAllDynamicTests();
var dynamicTestTypes = TestComponent.GetTypesWithHelpAttribute(Application.loadedLevelName); var dynamicTestTypes = TestComponent.GetTypesWithHelpAttribute(SceneManager.GetActiveScene().name);
foreach (var dynamicTestType in dynamicTestTypes) foreach (var dynamicTestType in dynamicTestTypes)
TestComponent.CreateDynamicTest(dynamicTestType); TestComponent.CreateDynamicTest(dynamicTestType);
@ -309,7 +310,7 @@ namespace UnityTest
string testScene = m_Configurator.GetIntegrationTestScenes (TestSceneNumber); string testScene = m_Configurator.GetIntegrationTestScenes (TestSceneNumber);
if (testScene != null) if (testScene != null)
Application.LoadLevel(Path.GetFileNameWithoutExtension(testScene)); SceneManager.LoadScene(Path.GetFileNameWithoutExtension(testScene));
else else
{ {
TestRunnerCallback.AllScenesFinished(); TestRunnerCallback.AllScenesFinished();
@ -363,7 +364,7 @@ namespace UnityTest
currentTest = null; currentTest = null;
if (!testResult.IsSuccess if (!testResult.IsSuccess
&& testResult.Executed && testResult.Executed
&& !testResult.IsIgnored) k_ResultRenderer.AddResults(Application.loadedLevelName, testResult); && !testResult.IsIgnored) k_ResultRenderer.AddResults(SceneManager.GetActiveScene().name, testResult);
} }
#region Test Runner Helpers #region Test Runner Helpers

Loading…
Cancel
Save