diff --git a/Unity/Assets/UnityTestTools.meta b/Unity/Assets/UnityTestTools.meta deleted file mode 100644 index c5c092099..000000000 --- a/Unity/Assets/UnityTestTools.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 347771ee639dd4d4bbd634af5af1a20d -folderAsset: yes -timeCreated: 1455423449 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Unity/Assets/UnityTestTools/Assertions.meta b/Unity/Assets/UnityTestTools/Assertions.meta deleted file mode 100644 index 229b8b818..000000000 --- a/Unity/Assets/UnityTestTools/Assertions.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: b27b28700d3365146808b6e082748201 -folderAsset: yes -DefaultImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/AssertionComponent.cs b/Unity/Assets/UnityTestTools/Assertions/AssertionComponent.cs deleted file mode 100644 index fa40d4884..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/AssertionComponent.cs +++ /dev/null @@ -1,379 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using UnityEngine; -using Debug = UnityEngine.Debug; -using Object = UnityEngine.Object; - -namespace UnityTest -{ - [Serializable] - public class AssertionComponent : MonoBehaviour, IAssertionComponentConfigurator - { - [SerializeField] public float checkAfterTime = 1f; - [SerializeField] public bool repeatCheckTime = true; - [SerializeField] public float repeatEveryTime = 1f; - [SerializeField] public int checkAfterFrames = 1; - [SerializeField] public bool repeatCheckFrame = true; - [SerializeField] public int repeatEveryFrame = 1; - [SerializeField] public bool hasFailed; - - [SerializeField] public CheckMethod checkMethods = CheckMethod.Start; - [SerializeField] private ActionBase m_ActionBase; - - [SerializeField] public int checksPerformed = 0; - - private int m_CheckOnFrame; - - private string m_CreatedInFilePath = ""; - private int m_CreatedInFileLine = -1; - - public ActionBase Action - { - get { return m_ActionBase; } - set - { - m_ActionBase = value; - m_ActionBase.go = gameObject; - } - } - - public Object GetFailureReferenceObject() - { - #if UNITY_EDITOR - if (!string.IsNullOrEmpty(m_CreatedInFilePath)) - { - return UnityEditor.AssetDatabase.LoadAssetAtPath(m_CreatedInFilePath, typeof(Object)); - } - #endif - return this; - } - - public string GetCreationLocation() - { - if (!string.IsNullOrEmpty(m_CreatedInFilePath)) - { - var idx = m_CreatedInFilePath.LastIndexOf("\\") + 1; - return string.Format("{0}, line {1} ({2})", m_CreatedInFilePath.Substring(idx), m_CreatedInFileLine, m_CreatedInFilePath); - } - return ""; - } - - public void Awake() - { - if (!Debug.isDebugBuild) - Destroy(this); - OnComponentCopy(); - } - - public void OnValidate() - { - if (Application.isEditor) - OnComponentCopy(); - } - - private void OnComponentCopy() - { - if (m_ActionBase == null) return; - var oldActionList = Resources.FindObjectsOfTypeAll(typeof(AssertionComponent)).Where(o => ((AssertionComponent)o).m_ActionBase == m_ActionBase && o != this); - - // if it's not a copy but a new component don't do anything - if (!oldActionList.Any()) return; - if (oldActionList.Count() > 1) - Debug.LogWarning("More than one refence to comparer found. This shouldn't happen"); - - var oldAction = oldActionList.First() as AssertionComponent; - m_ActionBase = oldAction.m_ActionBase.CreateCopy(oldAction.gameObject, gameObject); - } - - public void Start() - { - CheckAssertionFor(CheckMethod.Start); - - if (IsCheckMethodSelected(CheckMethod.AfterPeriodOfTime)) - { - StartCoroutine("CheckPeriodically"); - } - if (IsCheckMethodSelected(CheckMethod.Update)) - { - m_CheckOnFrame = Time.frameCount + checkAfterFrames; - } - } - - public IEnumerator CheckPeriodically() - { - yield return new WaitForSeconds(checkAfterTime); - CheckAssertionFor(CheckMethod.AfterPeriodOfTime); - while (repeatCheckTime) - { - yield return new WaitForSeconds(repeatEveryTime); - CheckAssertionFor(CheckMethod.AfterPeriodOfTime); - } - } - - public bool ShouldCheckOnFrame() - { - if (Time.frameCount > m_CheckOnFrame) - { - if (repeatCheckFrame) - m_CheckOnFrame += repeatEveryFrame; - else - m_CheckOnFrame = Int32.MaxValue; - return true; - } - return false; - } - - public void OnDisable() - { - CheckAssertionFor(CheckMethod.OnDisable); - } - - public void OnEnable() - { - CheckAssertionFor(CheckMethod.OnEnable); - } - - public void OnDestroy() - { - CheckAssertionFor(CheckMethod.OnDestroy); - } - - public void Update() - { - if (IsCheckMethodSelected(CheckMethod.Update) && ShouldCheckOnFrame()) - { - CheckAssertionFor(CheckMethod.Update); - } - } - - public void FixedUpdate() - { - CheckAssertionFor(CheckMethod.FixedUpdate); - } - - public void LateUpdate() - { - CheckAssertionFor(CheckMethod.LateUpdate); - } - - public void OnControllerColliderHit() - { - CheckAssertionFor(CheckMethod.OnControllerColliderHit); - } - - public void OnParticleCollision() - { - CheckAssertionFor(CheckMethod.OnParticleCollision); - } - - public void OnJointBreak() - { - CheckAssertionFor(CheckMethod.OnJointBreak); - } - - public void OnBecameInvisible() - { - CheckAssertionFor(CheckMethod.OnBecameInvisible); - } - - public void OnBecameVisible() - { - CheckAssertionFor(CheckMethod.OnBecameVisible); - } - - public void OnTriggerEnter() - { - CheckAssertionFor(CheckMethod.OnTriggerEnter); - } - - public void OnTriggerExit() - { - CheckAssertionFor(CheckMethod.OnTriggerExit); - } - - public void OnTriggerStay() - { - CheckAssertionFor(CheckMethod.OnTriggerStay); - } - - public void OnCollisionEnter() - { - CheckAssertionFor(CheckMethod.OnCollisionEnter); - } - - public void OnCollisionExit() - { - CheckAssertionFor(CheckMethod.OnCollisionExit); - } - - public void OnCollisionStay() - { - CheckAssertionFor(CheckMethod.OnCollisionStay); - } - - public void OnTriggerEnter2D() - { - CheckAssertionFor(CheckMethod.OnTriggerEnter2D); - } - - public void OnTriggerExit2D() - { - CheckAssertionFor(CheckMethod.OnTriggerExit2D); - } - - public void OnTriggerStay2D() - { - CheckAssertionFor(CheckMethod.OnTriggerStay2D); - } - - public void OnCollisionEnter2D() - { - CheckAssertionFor(CheckMethod.OnCollisionEnter2D); - } - - public void OnCollisionExit2D() - { - CheckAssertionFor(CheckMethod.OnCollisionExit2D); - } - - public void OnCollisionStay2D() - { - CheckAssertionFor(CheckMethod.OnCollisionStay2D); - } - - private void CheckAssertionFor(CheckMethod checkMethod) - { - if (IsCheckMethodSelected(checkMethod)) - { - Assertions.CheckAssertions(this); - } - } - - public bool IsCheckMethodSelected(CheckMethod method) - { - return method == (checkMethods & method); - } - - - #region Assertion Component create methods - - public static T Create(CheckMethod checkOnMethods, GameObject gameObject, string propertyPath) where T : ActionBase - { - IAssertionComponentConfigurator configurator; - return Create(out configurator, checkOnMethods, gameObject, propertyPath); - } - - public static T Create(out IAssertionComponentConfigurator configurator, CheckMethod checkOnMethods, GameObject gameObject, string propertyPath) where T : ActionBase - { - return CreateAssertionComponent(out configurator, checkOnMethods, gameObject, propertyPath); - } - - public static T Create(CheckMethod checkOnMethods, GameObject gameObject, string propertyPath, GameObject gameObject2, string propertyPath2) where T : ComparerBase - { - IAssertionComponentConfigurator configurator; - return Create(out configurator, checkOnMethods, gameObject, propertyPath, gameObject2, propertyPath2); - } - - public static T Create(out IAssertionComponentConfigurator configurator, CheckMethod checkOnMethods, GameObject gameObject, string propertyPath, GameObject gameObject2, string propertyPath2) where T : ComparerBase - { - var comparer = CreateAssertionComponent(out configurator, checkOnMethods, gameObject, propertyPath); - comparer.compareToType = ComparerBase.CompareToType.CompareToObject; - comparer.other = gameObject2; - comparer.otherPropertyPath = propertyPath2; - return comparer; - } - - public static T Create(CheckMethod checkOnMethods, GameObject gameObject, string propertyPath, object constValue) where T : ComparerBase - { - IAssertionComponentConfigurator configurator; - return Create(out configurator, checkOnMethods, gameObject, propertyPath, constValue); - } - - public static T Create(out IAssertionComponentConfigurator configurator, CheckMethod checkOnMethods, GameObject gameObject, string propertyPath, object constValue) where T : ComparerBase - { - var comparer = CreateAssertionComponent(out configurator, checkOnMethods, gameObject, propertyPath); - if (constValue == null) - { - comparer.compareToType = ComparerBase.CompareToType.CompareToNull; - return comparer; - } - comparer.compareToType = ComparerBase.CompareToType.CompareToConstantValue; - comparer.ConstValue = constValue; - return comparer; - } - - private static T CreateAssertionComponent(out IAssertionComponentConfigurator configurator, CheckMethod checkOnMethods, GameObject gameObject, string propertyPath) where T : ActionBase - { - var ac = gameObject.AddComponent(); - ac.checkMethods = checkOnMethods; - var comparer = ScriptableObject.CreateInstance(); - ac.Action = comparer; - ac.Action.go = gameObject; - ac.Action.thisPropertyPath = propertyPath; - configurator = ac; - -#if !UNITY_METRO - var stackTrace = new StackTrace(true); - var thisFileName = stackTrace.GetFrame(0).GetFileName(); - for (int i = 1; i < stackTrace.FrameCount; i++) - { - var stackFrame = stackTrace.GetFrame(i); - if (stackFrame.GetFileName() != thisFileName) - { - string filePath = stackFrame.GetFileName().Substring(Application.dataPath.Length - "Assets".Length); - ac.m_CreatedInFilePath = filePath; - ac.m_CreatedInFileLine = stackFrame.GetFileLineNumber(); - break; - } - } -#endif // if !UNITY_METRO - return comparer; - } - - #endregion - - #region AssertionComponentConfigurator - public int UpdateCheckStartOnFrame { set { checkAfterFrames = value; } } - public int UpdateCheckRepeatFrequency { set { repeatEveryFrame = value; } } - public bool UpdateCheckRepeat { set { repeatCheckFrame = value; } } - public float TimeCheckStartAfter { set { checkAfterTime = value; } } - public float TimeCheckRepeatFrequency { set { repeatEveryTime = value; } } - public bool TimeCheckRepeat { set { repeatCheckTime = value; } } - public AssertionComponent Component { get { return this; } } - #endregion - } - - public interface IAssertionComponentConfigurator - { - /// - /// If the assertion is evaluated in Update, after how many frame should the evaluation start. Deafult is 1 (first frame) - /// - int UpdateCheckStartOnFrame { set; } - /// - /// If the assertion is evaluated in Update and UpdateCheckRepeat is true, how many frame should pass between evaluations - /// - int UpdateCheckRepeatFrequency { set; } - /// - /// If the assertion is evaluated in Update, should the evaluation be repeated after UpdateCheckRepeatFrequency frames - /// - bool UpdateCheckRepeat { set; } - - /// - /// If the assertion is evaluated after a period of time, after how many seconds the first evaluation should be done - /// - float TimeCheckStartAfter { set; } - /// - /// If the assertion is evaluated after a period of time and TimeCheckRepeat is true, after how many seconds should the next evaluation happen - /// - float TimeCheckRepeatFrequency { set; } - /// - /// If the assertion is evaluated after a period, should the evaluation happen again after TimeCheckRepeatFrequency seconds - /// - bool TimeCheckRepeat { set; } - - AssertionComponent Component { get; } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/AssertionComponent.cs.meta b/Unity/Assets/UnityTestTools/Assertions/AssertionComponent.cs.meta deleted file mode 100644 index 26f9ab455..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/AssertionComponent.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8bafa54482a87ac4cbd7ff1bfd1ac93a -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/AssertionException.cs b/Unity/Assets/UnityTestTools/Assertions/AssertionException.cs deleted file mode 100644 index 00c6d588a..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/AssertionException.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - public class AssertionException : Exception - { - private readonly AssertionComponent m_Assertion; - - public AssertionException(AssertionComponent assertion) : base(assertion.Action.GetFailureMessage()) - { - m_Assertion = assertion; - } - - public override string StackTrace - { - get - { - return "Created in " + m_Assertion.GetCreationLocation(); - } - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/AssertionException.cs.meta b/Unity/Assets/UnityTestTools/Assertions/AssertionException.cs.meta deleted file mode 100644 index 9605bf013..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/AssertionException.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ef3769ab00d50bc4fbb05a9a91c741d9 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Assertions.cs b/Unity/Assets/UnityTestTools/Assertions/Assertions.cs deleted file mode 100644 index 14b3fd6cb..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Assertions.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; -using Object = UnityEngine.Object; - -namespace UnityTest -{ - public static class Assertions - { - public static void CheckAssertions() - { - var assertions = Object.FindObjectsOfType(typeof(AssertionComponent)) as AssertionComponent[]; - CheckAssertions(assertions); - } - - public static void CheckAssertions(AssertionComponent assertion) - { - CheckAssertions(new[] {assertion}); - } - - public static void CheckAssertions(GameObject gameObject) - { - CheckAssertions(gameObject.GetComponents()); - } - - public static void CheckAssertions(AssertionComponent[] assertions) - { - if (!Debug.isDebugBuild) - return; - foreach (var assertion in assertions) - { - assertion.checksPerformed++; - var result = assertion.Action.Compare(); - if (!result) - { - assertion.hasFailed = true; - assertion.Action.Fail(assertion); - } - } - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Assertions.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Assertions.cs.meta deleted file mode 100644 index 00878a4fb..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Assertions.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 85280dad1e618c143bd3fb07a197b469 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/CheckMethod.cs b/Unity/Assets/UnityTestTools/Assertions/CheckMethod.cs deleted file mode 100644 index 07583dd35..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/CheckMethod.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - [Flags] - public enum CheckMethod - { - AfterPeriodOfTime = 1 << 0, - Start = 1 << 1, - Update = 1 << 2, - FixedUpdate = 1 << 3, - LateUpdate = 1 << 4, - OnDestroy = 1 << 5, - OnEnable = 1 << 6, - OnDisable = 1 << 7, - OnControllerColliderHit = 1 << 8, - OnParticleCollision = 1 << 9, - OnJointBreak = 1 << 10, - OnBecameInvisible = 1 << 11, - OnBecameVisible = 1 << 12, - OnTriggerEnter = 1 << 13, - OnTriggerExit = 1 << 14, - OnTriggerStay = 1 << 15, - OnCollisionEnter = 1 << 16, - OnCollisionExit = 1 << 17, - OnCollisionStay = 1 << 18, - OnTriggerEnter2D = 1 << 19, - OnTriggerExit2D = 1 << 20, - OnTriggerStay2D = 1 << 21, - OnCollisionEnter2D = 1 << 22, - OnCollisionExit2D = 1 << 23, - OnCollisionStay2D = 1 << 24, - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/CheckMethod.cs.meta b/Unity/Assets/UnityTestTools/Assertions/CheckMethod.cs.meta deleted file mode 100644 index d3f6ec9d2..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/CheckMethod.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: cbb75d1643c5a55439f8861a827f411b -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers.meta b/Unity/Assets/UnityTestTools/Assertions/Comparers.meta deleted file mode 100644 index 15d3a928b..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: bb9e10c25f478c84f826ea85b03ec179 -folderAsset: yes -DefaultImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/ActionBase.cs b/Unity/Assets/UnityTestTools/Assertions/Comparers/ActionBase.cs deleted file mode 100644 index a73e0e254..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/ActionBase.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using UnityEngine; - -namespace UnityTest -{ - public abstract class ActionBase : ScriptableObject - { - public GameObject go; - protected object m_ObjVal; - - private MemberResolver m_MemberResolver; - - public string thisPropertyPath = ""; - public virtual Type[] GetAccepatbleTypesForA() - { - return null; - } - public virtual int GetDepthOfSearch() { return 2; } - - public virtual string[] GetExcludedFieldNames() - { - return new string[] { }; - } - - public bool Compare() - { - if (m_MemberResolver == null) - m_MemberResolver = new MemberResolver(go, thisPropertyPath); - m_ObjVal = m_MemberResolver.GetValue(UseCache); - var result = Compare(m_ObjVal); - return result; - } - - protected abstract bool Compare(object objVal); - - virtual protected bool UseCache { get { return false; } } - - public virtual Type GetParameterType() { return typeof(object); } - - public virtual string GetConfigurationDescription() - { - string result = ""; -#if !UNITY_METRO - foreach (var prop in GetType().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly) - .Where(info => info.FieldType.IsSerializable)) - { - var value = prop.GetValue(this); - if (value is double) - value = ((double)value).ToString("0.########"); - if (value is float) - value = ((float)value).ToString("0.########"); - result += value + " "; - } -#endif // if !UNITY_METRO - return result; - } - - IEnumerable GetFields(Type type) - { -#if !UNITY_METRO - return type.GetFields(BindingFlags.Public | BindingFlags.Instance); -#else - return null; -#endif - } - - public ActionBase CreateCopy(GameObject oldGameObject, GameObject newGameObject) - { -#if !UNITY_METRO - var newObj = CreateInstance(GetType()) as ActionBase; -#else - var newObj = (ActionBase) this.MemberwiseClone(); -#endif - var fields = GetFields(GetType()); - foreach (var field in fields) - { - var value = field.GetValue(this); - if (value is GameObject) - { - if (value as GameObject == oldGameObject) - value = newGameObject; - } - field.SetValue(newObj, value); - } - return newObj; - } - - public virtual void Fail(AssertionComponent assertion) - { - Debug.LogException(new AssertionException(assertion), assertion.GetFailureReferenceObject()); - } - - public virtual string GetFailureMessage() - { - return GetType().Name + " assertion failed.\n(" + go + ")." + thisPropertyPath + " failed. Value: " + m_ObjVal; - } - } - - public abstract class ActionBaseGeneric : ActionBase - { - protected override bool Compare(object objVal) - { - return Compare((T)objVal); - } - protected abstract bool Compare(T objVal); - - public override Type[] GetAccepatbleTypesForA() - { - return new[] { typeof(T) }; - } - - public override Type GetParameterType() - { - return typeof(T); - } - protected override bool UseCache { get { return true; } } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/ActionBase.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Comparers/ActionBase.cs.meta deleted file mode 100644 index 6d4c3ab00..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/ActionBase.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b4995756bd539804e8143ff1e730f806 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/BoolComparer.cs b/Unity/Assets/UnityTestTools/Assertions/Comparers/BoolComparer.cs deleted file mode 100644 index 3987cc278..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/BoolComparer.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - public class BoolComparer : ComparerBaseGeneric - { - protected override bool Compare(bool a, bool b) - { - return a == b; - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/BoolComparer.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Comparers/BoolComparer.cs.meta deleted file mode 100644 index 7ee21b601..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/BoolComparer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 2586c8e41f35d2f4fadde53020bf4207 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/ColliderComparer.cs b/Unity/Assets/UnityTestTools/Assertions/Comparers/ColliderComparer.cs deleted file mode 100644 index cfca05df4..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/ColliderComparer.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - public class ColliderComparer : ComparerBaseGeneric - { - public enum CompareType - { - Intersects, - DoesNotIntersect - }; - - public CompareType compareType; - - protected override bool Compare(Bounds a, Bounds b) - { - switch (compareType) - { - case CompareType.Intersects: - return a.Intersects(b); - case CompareType.DoesNotIntersect: - return !a.Intersects(b); - } - throw new Exception(); - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/ColliderComparer.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Comparers/ColliderComparer.cs.meta deleted file mode 100644 index ab3aa4777..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/ColliderComparer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4eff45b2ac4067b469d7994298341db6 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/ComparerBase.cs b/Unity/Assets/UnityTestTools/Assertions/Comparers/ComparerBase.cs deleted file mode 100644 index db9021184..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/ComparerBase.cs +++ /dev/null @@ -1,145 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; -using Object = System.Object; - -namespace UnityTest -{ - public abstract class ComparerBase : ActionBase - { - public enum CompareToType - { - CompareToObject, - CompareToConstantValue, - CompareToNull - } - - public CompareToType compareToType = CompareToType.CompareToObject; - - public GameObject other; - protected object m_ObjOtherVal; - public string otherPropertyPath = ""; - private MemberResolver m_MemberResolverB; - - protected abstract bool Compare(object a, object b); - - protected override bool Compare(object objValue) - { - if (compareToType == CompareToType.CompareToConstantValue) - { - m_ObjOtherVal = ConstValue; - } - else if (compareToType == CompareToType.CompareToNull) - { - m_ObjOtherVal = null; - } - else - { - if (other == null) - m_ObjOtherVal = null; - else - { - if (m_MemberResolverB == null) - m_MemberResolverB = new MemberResolver(other, otherPropertyPath); - m_ObjOtherVal = m_MemberResolverB.GetValue(UseCache); - } - } - return Compare(objValue, m_ObjOtherVal); - } - - public virtual Type[] GetAccepatbleTypesForB() - { - return null; - } - - #region Const value - - public virtual object ConstValue { get; set; } - public virtual object GetDefaultConstValue() - { - throw new NotImplementedException(); - } - - #endregion - - public override string GetFailureMessage() - { - var message = GetType().Name + " assertion failed.\n" + go.name + "." + thisPropertyPath + " " + compareToType; - switch (compareToType) - { - case CompareToType.CompareToObject: - message += " (" + other + ")." + otherPropertyPath + " failed."; - break; - case CompareToType.CompareToConstantValue: - message += " " + ConstValue + " failed."; - break; - case CompareToType.CompareToNull: - message += " failed."; - break; - } - message += " Expected: " + m_ObjOtherVal + " Actual: " + m_ObjVal; - return message; - } - } - - [Serializable] - public abstract class ComparerBaseGeneric : ComparerBaseGeneric - { - } - - [Serializable] - public abstract class ComparerBaseGeneric : ComparerBase - { - public T2 constantValueGeneric = default(T2); - - public override Object ConstValue - { - get - { - return constantValueGeneric; - } - set - { - constantValueGeneric = (T2)value; - } - } - - public override Object GetDefaultConstValue() - { - return default(T2); - } - - static bool IsValueType(Type type) - { -#if !UNITY_METRO - return type.IsValueType; -#else - return false; -#endif - } - - protected override bool Compare(object a, object b) - { - var type = typeof(T2); - if (b == null && IsValueType(type)) - { - throw new ArgumentException("Null was passed to a value-type argument"); - } - return Compare((T1)a, (T2)b); - } - - protected abstract bool Compare(T1 a, T2 b); - - public override Type[] GetAccepatbleTypesForA() - { - return new[] { typeof(T1) }; - } - - public override Type[] GetAccepatbleTypesForB() - { - return new[] {typeof(T2)}; - } - - protected override bool UseCache { get { return true; } } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/ComparerBase.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Comparers/ComparerBase.cs.meta deleted file mode 100644 index 65909eb9d..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/ComparerBase.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c86508f389d643b40b6e1d7dcc1d4df2 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/FloatComparer.cs b/Unity/Assets/UnityTestTools/Assertions/Comparers/FloatComparer.cs deleted file mode 100644 index ce0a2c24b..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/FloatComparer.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - public class FloatComparer : ComparerBaseGeneric - { - public enum CompareTypes - { - Equal, - NotEqual, - Greater, - Less - } - - public CompareTypes compareTypes; - public double floatingPointError = 0.0001f; - - protected override bool Compare(float a, float b) - { - switch (compareTypes) - { - case CompareTypes.Equal: - return Math.Abs(a - b) < floatingPointError; - case CompareTypes.NotEqual: - return Math.Abs(a - b) > floatingPointError; - case CompareTypes.Greater: - return a > b; - case CompareTypes.Less: - return a < b; - } - throw new Exception(); - } - public override int GetDepthOfSearch() - { - return 3; - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/FloatComparer.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Comparers/FloatComparer.cs.meta deleted file mode 100644 index 07353adfe..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/FloatComparer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a4928c6c2b973874c8d4e6c9a69bb5b4 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/GeneralComparer.cs b/Unity/Assets/UnityTestTools/Assertions/Comparers/GeneralComparer.cs deleted file mode 100644 index 96892aa67..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/GeneralComparer.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - public class GeneralComparer : ComparerBase - { - public enum CompareType { AEqualsB, ANotEqualsB } - - public CompareType compareType; - - protected override bool Compare(object a, object b) - { - if (compareType == CompareType.AEqualsB) - return a.Equals(b); - if (compareType == CompareType.ANotEqualsB) - return !a.Equals(b); - throw new Exception(); - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/GeneralComparer.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Comparers/GeneralComparer.cs.meta deleted file mode 100644 index 6b7edb327..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/GeneralComparer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 902961c69f102f4409c29b9e54258701 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/IntComparer.cs b/Unity/Assets/UnityTestTools/Assertions/Comparers/IntComparer.cs deleted file mode 100644 index 25c43aad5..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/IntComparer.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - public class IntComparer : ComparerBaseGeneric - { - public enum CompareType - { - Equal, - NotEqual, - Greater, - GreaterOrEqual, - Less, - LessOrEqual - }; - - public CompareType compareType; - - protected override bool Compare(int a, int b) - { - switch (compareType) - { - case CompareType.Equal: - return a == b; - case CompareType.NotEqual: - return a != b; - case CompareType.Greater: - return a > b; - case CompareType.GreaterOrEqual: - return a >= b; - case CompareType.Less: - return a < b; - case CompareType.LessOrEqual: - return a <= b; - } - throw new Exception(); - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/IntComparer.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Comparers/IntComparer.cs.meta deleted file mode 100644 index 64f4fc3ec..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/IntComparer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: da4a3a521c5c1494aae123742ca5c8f5 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/IsRenderedByCamera.cs b/Unity/Assets/UnityTestTools/Assertions/Comparers/IsRenderedByCamera.cs deleted file mode 100644 index bc5d370e1..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/IsRenderedByCamera.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - public class IsRenderedByCamera : ComparerBaseGeneric - { - public enum CompareType - { - IsVisible, - IsNotVisible, - }; - - public CompareType compareType; - - protected override bool Compare(Renderer renderer, Camera camera) - { - var planes = GeometryUtility.CalculateFrustumPlanes(camera); - var isVisible = GeometryUtility.TestPlanesAABB(planes, renderer.bounds); - switch (compareType) - { - case CompareType.IsVisible: - return isVisible; - case CompareType.IsNotVisible: - return !isVisible; - } - throw new Exception(); - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/IsRenderedByCamera.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Comparers/IsRenderedByCamera.cs.meta deleted file mode 100644 index 9cfc1f22e..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/IsRenderedByCamera.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8d45a1674f5e2e04485eafef922fac41 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/StringComparer.cs b/Unity/Assets/UnityTestTools/Assertions/Comparers/StringComparer.cs deleted file mode 100644 index 398f3e9f6..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/StringComparer.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - public class StringComparer : ComparerBaseGeneric - { - public enum CompareType - { - Equal, - NotEqual, - Shorter, - Longer - } - - public CompareType compareType; - public StringComparison comparisonType = StringComparison.Ordinal; - public bool ignoreCase = false; - - protected override bool Compare(string a, string b) - { - if (ignoreCase) - { - a = a.ToLower(); - b = b.ToLower(); - } - switch (compareType) - { - case CompareType.Equal: - return String.Compare(a, b, comparisonType) == 0; - case CompareType.NotEqual: - return String.Compare(a, b, comparisonType) != 0; - case CompareType.Longer: - return String.Compare(a, b, comparisonType) > 0; - case CompareType.Shorter: - return String.Compare(a, b, comparisonType) < 0; - } - throw new Exception(); - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/StringComparer.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Comparers/StringComparer.cs.meta deleted file mode 100644 index a414f61c5..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/StringComparer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 58783f051e477fd4e93b42ec7a43bb64 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/TransformComparer.cs b/Unity/Assets/UnityTestTools/Assertions/Comparers/TransformComparer.cs deleted file mode 100644 index 5221c0326..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/TransformComparer.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - public class TransformComparer : ComparerBaseGeneric - { - public enum CompareType { Equals, NotEquals } - - public CompareType compareType; - - protected override bool Compare(Transform a, Transform b) - { - if (compareType == CompareType.Equals) - { - return a.position == b.position; - } - if (compareType == CompareType.NotEquals) - { - return a.position != b.position; - } - throw new Exception(); - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/TransformComparer.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Comparers/TransformComparer.cs.meta deleted file mode 100644 index f3d72e46c..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/TransformComparer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 927f2d7e4f63632448b2a63d480e601a -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/ValueDoesNotChange.cs b/Unity/Assets/UnityTestTools/Assertions/Comparers/ValueDoesNotChange.cs deleted file mode 100644 index 49a3cc769..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/ValueDoesNotChange.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - public class ValueDoesNotChange : ActionBase - { - private object m_Value; - - protected override bool Compare(object a) - { - if (m_Value == null) - m_Value = a; - if (!m_Value.Equals(a)) - return false; - return true; - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/ValueDoesNotChange.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Comparers/ValueDoesNotChange.cs.meta deleted file mode 100644 index b913d35d6..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/ValueDoesNotChange.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9d6d16a58a17940419a1dcbff3c60ca5 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/Vector2Comparer.cs b/Unity/Assets/UnityTestTools/Assertions/Comparers/Vector2Comparer.cs deleted file mode 100644 index 345d76d16..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/Vector2Comparer.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - public class Vector2Comparer : VectorComparerBase - { - public enum CompareType - { - MagnitudeEquals, - MagnitudeNotEquals - } - - public CompareType compareType; - public float floatingPointError = 0.0001f; - - protected override bool Compare(Vector2 a, Vector2 b) - { - switch (compareType) - { - case CompareType.MagnitudeEquals: - return AreVectorMagnitudeEqual(a.magnitude, - b.magnitude, floatingPointError); - case CompareType.MagnitudeNotEquals: - return !AreVectorMagnitudeEqual(a.magnitude, - b.magnitude, floatingPointError); - } - throw new Exception(); - } - public override int GetDepthOfSearch() - { - return 3; - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/Vector2Comparer.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Comparers/Vector2Comparer.cs.meta deleted file mode 100644 index 19ef5d2e8..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/Vector2Comparer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a713db190443e814f8254a5a59014ec4 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/Vector3Comparer.cs b/Unity/Assets/UnityTestTools/Assertions/Comparers/Vector3Comparer.cs deleted file mode 100644 index 56f0b5b9e..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/Vector3Comparer.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - public class Vector3Comparer : VectorComparerBase - { - public enum CompareType - { - MagnitudeEquals, - MagnitudeNotEquals - } - - public CompareType compareType; - public double floatingPointError = 0.0001f; - - protected override bool Compare(Vector3 a, Vector3 b) - { - switch (compareType) - { - case CompareType.MagnitudeEquals: - return AreVectorMagnitudeEqual(a.magnitude, - b.magnitude, floatingPointError); - case CompareType.MagnitudeNotEquals: - return !AreVectorMagnitudeEqual(a.magnitude, - b.magnitude, floatingPointError); - } - throw new Exception(); - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/Vector3Comparer.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Comparers/Vector3Comparer.cs.meta deleted file mode 100644 index b871f248d..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/Vector3Comparer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6febd2d5046657040b3da98b7010ee29 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/Vector4Comparer.cs b/Unity/Assets/UnityTestTools/Assertions/Comparers/Vector4Comparer.cs deleted file mode 100644 index 4eda04392..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/Vector4Comparer.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - public class Vector4Comparer : VectorComparerBase - { - public enum CompareType - { - MagnitudeEquals, - MagnitudeNotEquals - } - - public CompareType compareType; - public double floatingPointError; - - protected override bool Compare(Vector4 a, Vector4 b) - { - switch (compareType) - { - case CompareType.MagnitudeEquals: - return AreVectorMagnitudeEqual(a.magnitude, - b.magnitude, - floatingPointError); - case CompareType.MagnitudeNotEquals: - return !AreVectorMagnitudeEqual(a.magnitude, - b.magnitude, - floatingPointError); - } - throw new Exception(); - } - public override int GetDepthOfSearch() - { - return 3; - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/Vector4Comparer.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Comparers/Vector4Comparer.cs.meta deleted file mode 100644 index 1e0314f27..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/Vector4Comparer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 383a85a79f164d04b8a56b0ff4e04cb7 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/VectorComparerBase.cs b/Unity/Assets/UnityTestTools/Assertions/Comparers/VectorComparerBase.cs deleted file mode 100644 index cb394dfb5..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/VectorComparerBase.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - public abstract class VectorComparerBase : ComparerBaseGeneric - { - protected bool AreVectorMagnitudeEqual(float a, float b, double floatingPointError) - { - if (Math.Abs(a) < floatingPointError && Math.Abs(b) < floatingPointError) - return true; - if (Math.Abs(a - b) < floatingPointError) - return true; - return false; - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Comparers/VectorComparerBase.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Comparers/VectorComparerBase.cs.meta deleted file mode 100644 index d4da9f79c..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Comparers/VectorComparerBase.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7b35a237804d5eb42bd8c4e67568ae24 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor.meta b/Unity/Assets/UnityTestTools/Assertions/Editor.meta deleted file mode 100644 index 2fa5238dc..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: a28bb39b4fb20514990895d9cb4eaea9 -folderAsset: yes -DefaultImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs b/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs deleted file mode 100644 index c806621c7..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs +++ /dev/null @@ -1,223 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using UnityEditor; -using UnityEngine; - -namespace UnityTest -{ - [CustomEditor(typeof(AssertionComponent))] - public class AssertionComponentEditor : Editor - { - private readonly DropDownControl m_ComparerDropDown = new DropDownControl(); - - private readonly PropertyPathSelector m_ThisPathSelector = new PropertyPathSelector("Compare"); - private readonly PropertyPathSelector m_OtherPathSelector = new PropertyPathSelector("Compare to"); - - #region GUI Contents - private readonly GUIContent m_GUICheckAfterTimeGuiContent = new GUIContent("Check after (seconds)", "After how many seconds the assertion should be checked"); - private readonly GUIContent m_GUIRepeatCheckTimeGuiContent = new GUIContent("Repeat check", "Should the check be repeated."); - private readonly GUIContent m_GUIRepeatEveryTimeGuiContent = new GUIContent("Frequency of repetitions", "How often should the check be done"); - private readonly GUIContent m_GUICheckAfterFramesGuiContent = new GUIContent("Check after (frames)", "After how many frames the assertion should be checked"); - private readonly GUIContent m_GUIRepeatCheckFrameGuiContent = new GUIContent("Repeat check", "Should the check be repeated."); - #endregion - - private static List allComparersList = null; - - public AssertionComponentEditor() - { - m_ComparerDropDown.convertForButtonLabel = type => type.Name; - m_ComparerDropDown.convertForGUIContent = type => type.Name; - m_ComparerDropDown.ignoreConvertForGUIContent = types => false; - m_ComparerDropDown.tooltip = "Comparer that will be used to compare values and determine the result of assertion."; - } - - public override void OnInspectorGUI() - { - var script = (AssertionComponent)target; - EditorGUILayout.BeginHorizontal(); - var obj = DrawComparerSelection(script); - script.checkMethods = (CheckMethod)EditorGUILayout.EnumMaskField(script.checkMethods, - EditorStyles.popup, - GUILayout.ExpandWidth(false)); - EditorGUILayout.EndHorizontal(); - - if (script.IsCheckMethodSelected(CheckMethod.AfterPeriodOfTime)) - { - DrawOptionsForAfterPeriodOfTime(script); - } - - if (script.IsCheckMethodSelected(CheckMethod.Update)) - { - DrawOptionsForOnUpdate(script); - } - - if (obj) - { - EditorGUILayout.Space(); - - m_ThisPathSelector.Draw(script.Action.go, script.Action, - script.Action.thisPropertyPath, script.Action.GetAccepatbleTypesForA(), - go => - { - script.Action.go = go; - AssertionExplorerWindow.Reload(); - }, - s => - { - script.Action.thisPropertyPath = s; - AssertionExplorerWindow.Reload(); - }); - - EditorGUILayout.Space(); - - DrawCustomFields(script); - - EditorGUILayout.Space(); - - if (script.Action is ComparerBase) - { - DrawCompareToType(script.Action as ComparerBase); - } - } - } - - private void DrawOptionsForAfterPeriodOfTime(AssertionComponent script) - { - EditorGUILayout.Space(); - script.checkAfterTime = EditorGUILayout.FloatField(m_GUICheckAfterTimeGuiContent, - script.checkAfterTime); - if (script.checkAfterTime < 0) - script.checkAfterTime = 0; - script.repeatCheckTime = EditorGUILayout.Toggle(m_GUIRepeatCheckTimeGuiContent, - script.repeatCheckTime); - if (script.repeatCheckTime) - { - script.repeatEveryTime = EditorGUILayout.FloatField(m_GUIRepeatEveryTimeGuiContent, - script.repeatEveryTime); - if (script.repeatEveryTime < 0) - script.repeatEveryTime = 0; - } - } - - private void DrawOptionsForOnUpdate(AssertionComponent script) - { - EditorGUILayout.Space(); - script.checkAfterFrames = EditorGUILayout.IntField(m_GUICheckAfterFramesGuiContent, - script.checkAfterFrames); - if (script.checkAfterFrames < 1) - script.checkAfterFrames = 1; - script.repeatCheckFrame = EditorGUILayout.Toggle(m_GUIRepeatCheckFrameGuiContent, - script.repeatCheckFrame); - if (script.repeatCheckFrame) - { - script.repeatEveryFrame = EditorGUILayout.IntField(m_GUIRepeatEveryTimeGuiContent, - script.repeatEveryFrame); - if (script.repeatEveryFrame < 1) - script.repeatEveryFrame = 1; - } - } - - private void DrawCompareToType(ComparerBase comparer) - { - comparer.compareToType = (ComparerBase.CompareToType)EditorGUILayout.EnumPopup("Compare to type", - comparer.compareToType, - EditorStyles.popup); - - if (comparer.compareToType == ComparerBase.CompareToType.CompareToConstantValue) - { - try - { - DrawConstCompareField(comparer); - } - catch (NotImplementedException) - { - Debug.LogWarning("This comparer can't compare to static value"); - comparer.compareToType = ComparerBase.CompareToType.CompareToObject; - } - } - else if (comparer.compareToType == ComparerBase.CompareToType.CompareToObject) - { - DrawObjectCompareField(comparer); - } - } - - private void DrawObjectCompareField(ComparerBase comparer) - { - m_OtherPathSelector.Draw(comparer.other, comparer, - comparer.otherPropertyPath, comparer.GetAccepatbleTypesForB(), - go => - { - comparer.other = go; - AssertionExplorerWindow.Reload(); - }, - s => - { - comparer.otherPropertyPath = s; - AssertionExplorerWindow.Reload(); - } - ); - } - - private void DrawConstCompareField(ComparerBase comparer) - { - if (comparer.ConstValue == null) - { - comparer.ConstValue = comparer.GetDefaultConstValue(); - } - - var so = new SerializedObject(comparer); - var sp = so.FindProperty("constantValueGeneric"); - if (sp != null) - { - EditorGUILayout.PropertyField(sp, new GUIContent("Constant"), true); - so.ApplyModifiedProperties(); - } - } - - private bool DrawComparerSelection(AssertionComponent script) - { - if(allComparersList == null) - { - allComparersList = new List(); - var allAssemblies = AppDomain.CurrentDomain.GetAssemblies(); - foreach (var assembly in allAssemblies) - { - var types = assembly.GetTypes(); - allComparersList.AddRange(types.Where(type => type.IsSubclassOf(typeof(ActionBase)) && !type.IsAbstract)); - } - } - var allComparers = allComparersList.ToArray(); - - if (script.Action == null) - script.Action = (ActionBase)CreateInstance(allComparers.First()); - - m_ComparerDropDown.Draw(script.Action.GetType(), allComparers, - type => - { - if (script.Action == null || script.Action.GetType().Name != type.Name) - { - script.Action = (ActionBase)CreateInstance(type); - AssertionExplorerWindow.Reload(); - } - }); - - return script.Action != null; - } - - private void DrawCustomFields(AssertionComponent script) - { - foreach (var prop in script.Action.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)) - { - var so = new SerializedObject(script.Action); - var sp = so.FindProperty(prop.Name); - if (sp != null) - { - EditorGUILayout.PropertyField(sp, true); - so.ApplyModifiedProperties(); - } - } - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs.meta deleted file mode 100644 index eb4174d21..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: fd1cabf2c45d0a8489635607a6048621 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionExplorerWindow.cs b/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionExplorerWindow.cs deleted file mode 100644 index ecd7fdaff..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionExplorerWindow.cs +++ /dev/null @@ -1,194 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEditor; -using UnityEngine; - -#if UNITY_METRO -#warning Assertion component is not supported on Windows Store apps -#endif - -namespace UnityTest -{ - [Serializable] - public class AssertionExplorerWindow : EditorWindow - { - private List m_AllAssertions = new List(); - [SerializeField] - private string m_FilterText = ""; - [SerializeField] - private FilterType m_FilterType; - [SerializeField] - private List m_FoldMarkers = new List(); - [SerializeField] - private GroupByType m_GroupBy; - [SerializeField] - private Vector2 m_ScrollPosition = Vector2.zero; - private DateTime m_NextReload = DateTime.Now; - [SerializeField] - private static bool s_ShouldReload; - [SerializeField] - private ShowType m_ShowType; - - public AssertionExplorerWindow() - { - titleContent = new GUIContent("Assertion Explorer"); - } - - public void OnDidOpenScene() - { - ReloadAssertionList(); - } - - public void OnFocus() - { - ReloadAssertionList(); - } - - private void ReloadAssertionList() - { - m_NextReload = DateTime.Now.AddSeconds(1); - s_ShouldReload = true; - } - - public void OnHierarchyChange() - { - ReloadAssertionList(); - } - - public void OnInspectorUpdate() - { - if (s_ShouldReload && m_NextReload < DateTime.Now) - { - s_ShouldReload = false; - m_AllAssertions = new List((AssertionComponent[])Resources.FindObjectsOfTypeAll(typeof(AssertionComponent))); - Repaint(); - } - } - - public void OnGUI() - { - DrawMenuPanel(); - - m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition); - if (m_AllAssertions != null) - GetResultRendere().Render(FilterResults(m_AllAssertions, m_FilterText.ToLower()), m_FoldMarkers); - EditorGUILayout.EndScrollView(); - } - - private IEnumerable FilterResults(List assertionComponents, string text) - { - if (m_ShowType == ShowType.ShowDisabled) - assertionComponents = assertionComponents.Where(c => !c.enabled).ToList(); - else if (m_ShowType == ShowType.ShowEnabled) - assertionComponents = assertionComponents.Where(c => c.enabled).ToList(); - - if (string.IsNullOrEmpty(text)) - return assertionComponents; - - switch (m_FilterType) - { - case FilterType.ComparerName: - return assertionComponents.Where(c => c.Action.GetType().Name.ToLower().Contains(text)); - case FilterType.AttachedGameObject: - return assertionComponents.Where(c => c.gameObject.name.ToLower().Contains(text)); - case FilterType.FirstComparedGameObjectPath: - return assertionComponents.Where(c => c.Action.thisPropertyPath.ToLower().Contains(text)); - case FilterType.FirstComparedGameObject: - return assertionComponents.Where(c => c.Action.go != null - && c.Action.go.name.ToLower().Contains(text)); - case FilterType.SecondComparedGameObjectPath: - return assertionComponents.Where(c => - c.Action is ComparerBase - && (c.Action as ComparerBase).otherPropertyPath.ToLower().Contains(text)); - case FilterType.SecondComparedGameObject: - return assertionComponents.Where(c => - c.Action is ComparerBase - && (c.Action as ComparerBase).other != null - && (c.Action as ComparerBase).other.name.ToLower().Contains(text)); - default: - return assertionComponents; - } - } - - private readonly IListRenderer m_GroupByComparerRenderer = new GroupByComparerRenderer(); - private readonly IListRenderer m_GroupByExecutionMethodRenderer = new GroupByExecutionMethodRenderer(); - private readonly IListRenderer m_GroupByGoRenderer = new GroupByGoRenderer(); - private readonly IListRenderer m_GroupByTestsRenderer = new GroupByTestsRenderer(); - private readonly IListRenderer m_GroupByNothingRenderer = new GroupByNothingRenderer(); - - private IListRenderer GetResultRendere() - { - switch (m_GroupBy) - { - case GroupByType.Comparer: - return m_GroupByComparerRenderer; - case GroupByType.ExecutionMethod: - return m_GroupByExecutionMethodRenderer; - case GroupByType.GameObjects: - return m_GroupByGoRenderer; - case GroupByType.Tests: - return m_GroupByTestsRenderer; - default: - return m_GroupByNothingRenderer; - } - } - - private void DrawMenuPanel() - { - EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); - EditorGUILayout.LabelField("Group by:", Styles.toolbarLabel, GUILayout.MaxWidth(60)); - m_GroupBy = (GroupByType)EditorGUILayout.EnumPopup(m_GroupBy, EditorStyles.toolbarPopup, GUILayout.MaxWidth(150)); - - GUILayout.FlexibleSpace(); - - m_ShowType = (ShowType)EditorGUILayout.EnumPopup(m_ShowType, EditorStyles.toolbarPopup, GUILayout.MaxWidth(100)); - - EditorGUILayout.LabelField("Filter by:", Styles.toolbarLabel, GUILayout.MaxWidth(50)); - m_FilterType = (FilterType)EditorGUILayout.EnumPopup(m_FilterType, EditorStyles.toolbarPopup, GUILayout.MaxWidth(100)); - m_FilterText = GUILayout.TextField(m_FilterText, "ToolbarSeachTextField", GUILayout.MaxWidth(100)); - if (GUILayout.Button(GUIContent.none, string.IsNullOrEmpty(m_FilterText) ? "ToolbarSeachCancelButtonEmpty" : "ToolbarSeachCancelButton", GUILayout.ExpandWidth(false))) - m_FilterText = ""; - EditorGUILayout.EndHorizontal(); - } - - [MenuItem("Unity Test Tools/Assertion Explorer")] - public static AssertionExplorerWindow ShowWindow() - { - var w = GetWindow(typeof(AssertionExplorerWindow)); - w.Show(); - return w as AssertionExplorerWindow; - } - - private enum FilterType - { - ComparerName, - FirstComparedGameObject, - FirstComparedGameObjectPath, - SecondComparedGameObject, - SecondComparedGameObjectPath, - AttachedGameObject - } - - private enum ShowType - { - ShowAll, - ShowEnabled, - ShowDisabled - } - - private enum GroupByType - { - Nothing, - Comparer, - GameObjects, - ExecutionMethod, - Tests - } - - public static void Reload() - { - s_ShouldReload = true; - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionExplorerWindow.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionExplorerWindow.cs.meta deleted file mode 100644 index f5591ab48..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionExplorerWindow.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1a1e855053e7e2f46ace1dc93f2036f2 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionListRenderer.cs b/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionListRenderer.cs deleted file mode 100644 index 31e1b1e55..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionListRenderer.cs +++ /dev/null @@ -1,251 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEditor; -using UnityEngine; - -namespace UnityTest -{ - public interface IListRenderer - { - void Render(IEnumerable allAssertions, List foldMarkers); - } - - public abstract class AssertionListRenderer : IListRenderer - { - private static class Styles - { - public static readonly GUIStyle redLabel; - static Styles() - { - redLabel = new GUIStyle(EditorStyles.label); - redLabel.normal.textColor = Color.red; - } - } - - public void Render(IEnumerable allAssertions, List foldMarkers) - { - foreach (var grouping in GroupResult(allAssertions)) - { - var key = GetStringKey(grouping.Key); - bool isFolded = foldMarkers.Contains(key); - if (key != "") - { - EditorGUILayout.BeginHorizontal(); - - EditorGUI.BeginChangeCheck(); - isFolded = PrintFoldout(isFolded, - grouping.Key); - if (EditorGUI.EndChangeCheck()) - { - if (isFolded) - foldMarkers.Add(key); - else - foldMarkers.Remove(key); - } - EditorGUILayout.EndHorizontal(); - if (isFolded) - continue; - } - foreach (var assertionComponent in grouping) - { - EditorGUILayout.BeginVertical(); - EditorGUILayout.BeginHorizontal(); - - if (key != "") - GUILayout.Space(15); - - var assertionKey = assertionComponent.GetHashCode().ToString(); - bool isDetailsFolded = foldMarkers.Contains(assertionKey); - - EditorGUI.BeginChangeCheck(); - if (GUILayout.Button("", - EditorStyles.foldout, - GUILayout.Width(15))) - { - isDetailsFolded = !isDetailsFolded; - } - if (EditorGUI.EndChangeCheck()) - { - if (isDetailsFolded) - foldMarkers.Add(assertionKey); - else - foldMarkers.Remove(assertionKey); - } - PrintFoldedAssertionLine(assertionComponent); - EditorGUILayout.EndHorizontal(); - - if (isDetailsFolded) - { - EditorGUILayout.BeginHorizontal(); - if (key != "") - GUILayout.Space(15); - PrintAssertionLineDetails(assertionComponent); - EditorGUILayout.EndHorizontal(); - } - GUILayout.Box("", new[] {GUILayout.ExpandWidth(true), GUILayout.Height(1)}); - - EditorGUILayout.EndVertical(); - } - } - } - - protected abstract IEnumerable> GroupResult(IEnumerable assertionComponents); - - protected virtual string GetStringKey(T key) - { - return key.GetHashCode().ToString(); - } - - protected virtual bool PrintFoldout(bool isFolded, T key) - { - var content = new GUIContent(GetFoldoutDisplayName(key)); - var size = EditorStyles.foldout.CalcSize(content); - - var rect = GUILayoutUtility.GetRect(content, - EditorStyles.foldout, - GUILayout.MaxWidth(size.x)); - var res = EditorGUI.Foldout(rect, - !isFolded, - content, - true); - - return !res; - } - - protected virtual string GetFoldoutDisplayName(T key) - { - return key.ToString(); - } - - protected virtual void PrintFoldedAssertionLine(AssertionComponent assertionComponent) - { - EditorGUILayout.BeginHorizontal(); - - EditorGUILayout.BeginVertical(GUILayout.MaxWidth(300)); - EditorGUILayout.BeginHorizontal(GUILayout.MaxWidth(300)); - PrintPath(assertionComponent.Action.go, - assertionComponent.Action.thisPropertyPath); - EditorGUILayout.EndHorizontal(); - EditorGUILayout.EndVertical(); - - EditorGUILayout.BeginVertical(GUILayout.MaxWidth(250)); - var labelStr = assertionComponent.Action.GetType().Name; - var labelStr2 = assertionComponent.Action.GetConfigurationDescription(); - if (labelStr2 != "") - labelStr += "( " + labelStr2 + ")"; - EditorGUILayout.LabelField(labelStr); - EditorGUILayout.EndVertical(); - - if (assertionComponent.Action is ComparerBase) - { - var comparer = assertionComponent.Action as ComparerBase; - - var otherStrVal = "(no value selected)"; - EditorGUILayout.BeginVertical(); - EditorGUILayout.BeginHorizontal(GUILayout.MaxWidth(300)); - switch (comparer.compareToType) - { - case ComparerBase.CompareToType.CompareToObject: - if (comparer.other != null) - { - PrintPath(comparer.other, - comparer.otherPropertyPath); - } - else - { - EditorGUILayout.LabelField(otherStrVal, - Styles.redLabel); - } - break; - case ComparerBase.CompareToType.CompareToConstantValue: - otherStrVal = comparer.ConstValue.ToString(); - EditorGUILayout.LabelField(otherStrVal); - break; - case ComparerBase.CompareToType.CompareToNull: - otherStrVal = "null"; - EditorGUILayout.LabelField(otherStrVal); - break; - } - EditorGUILayout.EndHorizontal(); - EditorGUILayout.EndVertical(); - } - else - { - EditorGUILayout.LabelField(""); - } - EditorGUILayout.EndHorizontal(); - EditorGUILayout.Space(); - } - - protected virtual void PrintAssertionLineDetails(AssertionComponent assertionComponent) - { - EditorGUILayout.BeginHorizontal(); - - - EditorGUILayout.BeginVertical(GUILayout.MaxWidth(320)); - EditorGUILayout.BeginHorizontal(); - EditorGUILayout.LabelField("Attached to", - GUILayout.Width(70)); - var sss = EditorStyles.objectField.CalcSize(new GUIContent(assertionComponent.gameObject.name)); - EditorGUILayout.ObjectField(assertionComponent.gameObject, - typeof(GameObject), - true, - GUILayout.Width(sss.x)); - EditorGUILayout.EndHorizontal(); - EditorGUILayout.EndVertical(); - - - EditorGUILayout.BeginVertical(GUILayout.MaxWidth(250)); - EditorGUILayout.EnumMaskField(assertionComponent.checkMethods, - EditorStyles.popup, - GUILayout.MaxWidth(150)); - EditorGUILayout.EndVertical(); - - - EditorGUILayout.BeginVertical(); - EditorGUILayout.BeginHorizontal(); - EditorGUILayout.LabelField("Disabled", - GUILayout.Width(55)); - assertionComponent.enabled = !EditorGUILayout.Toggle(!assertionComponent.enabled, - GUILayout.Width(15)); - EditorGUILayout.EndHorizontal(); - EditorGUILayout.EndVertical(); - - EditorGUILayout.EndHorizontal(); - } - - private void PrintPath(GameObject go, string propertyPath) - { - string contentString = ""; - GUIStyle styleThisPath = EditorStyles.label; - if (go != null) - { - var sss = EditorStyles.objectField.CalcSize(new GUIContent(go.name)); - EditorGUILayout.ObjectField( - go, - typeof(GameObject), - true, - GUILayout.Width(sss.x)); - - if (!string.IsNullOrEmpty(propertyPath)) - contentString = "." + propertyPath; - } - else - { - contentString = "(no value selected)"; - styleThisPath = Styles.redLabel; - } - - var content = new GUIContent(contentString, - contentString); - var rect = GUILayoutUtility.GetRect(content, - EditorStyles.label, - GUILayout.MaxWidth(200)); - - EditorGUI.LabelField(rect, - content, - styleThisPath); - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionListRenderer.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionListRenderer.cs.meta deleted file mode 100644 index 8e6a0d451..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionListRenderer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d83c02fb0f220344da42a8213ed36cb5 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionStripper.cs b/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionStripper.cs deleted file mode 100644 index 1b6bd04d5..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionStripper.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEditor.Callbacks; -using UnityEngine; -using UnityTest; -using Object = UnityEngine.Object; - -public class AssertionStripper -{ - [PostProcessScene] - public static void OnPostprocessScene() - { - if (Debug.isDebugBuild) return; - RemoveAssertionsFromGameObjects(); - } - - private static void RemoveAssertionsFromGameObjects() - { - var allAssertions = Resources.FindObjectsOfTypeAll(typeof(AssertionComponent)) as AssertionComponent[]; - foreach (var assertion in allAssertions) - { - Object.DestroyImmediate(assertion); - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionStripper.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionStripper.cs.meta deleted file mode 100644 index bf18bbed0..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/AssertionStripper.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 95c9cd9570a6fba4198b6e4f15e11e5e -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/DropDownControl.cs b/Unity/Assets/UnityTestTools/Assertions/Editor/DropDownControl.cs deleted file mode 100644 index 79804f959..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/DropDownControl.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEditor; -using UnityEngine; - -namespace UnityTest -{ - [Serializable] - internal class DropDownControl - { - private readonly GUILayoutOption[] m_ButtonLayoutOptions = { GUILayout.ExpandWidth(true) }; - public Func convertForButtonLabel = s => s.ToString(); - public Func convertForGUIContent = s => s.ToString(); - public Func ignoreConvertForGUIContent = t => t.Length <= 40; - public Action printContextMenu = null; - public string tooltip = ""; - - private object m_SelectedValue; - - - public void Draw(T selected, T[] options, Action onValueSelected) - { - Draw(null, - selected, - options, - onValueSelected); - } - - public void Draw(string label, T selected, T[] options, Action onValueSelected) - { - Draw(label, selected, () => options, onValueSelected); - } - - public void Draw(string label, T selected, Func loadOptions, Action onValueSelected) - { - if (!string.IsNullOrEmpty(label)) - EditorGUILayout.BeginHorizontal(); - var guiContent = new GUIContent(label); - var labelSize = EditorStyles.label.CalcSize(guiContent); - - if (!string.IsNullOrEmpty(label)) - GUILayout.Label(label, EditorStyles.label, GUILayout.Width(labelSize.x)); - - if (GUILayout.Button(new GUIContent(convertForButtonLabel(selected), tooltip), - EditorStyles.popup, m_ButtonLayoutOptions)) - { - if (Event.current.button == 0) - { - PrintMenu(loadOptions()); - } - else if (printContextMenu != null && Event.current.button == 1) - printContextMenu(selected); - } - - if (m_SelectedValue != null) - { - onValueSelected((T)m_SelectedValue); - m_SelectedValue = null; - } - if (!string.IsNullOrEmpty(label)) - EditorGUILayout.EndHorizontal(); - } - - public void PrintMenu(T[] options) - { - var menu = new GenericMenu(); - foreach (var s in options) - { - var localS = s; - menu.AddItem(new GUIContent((ignoreConvertForGUIContent(options) ? localS.ToString() : convertForGUIContent(localS))), - false, - () => { m_SelectedValue = localS; } - ); - } - menu.ShowAsContext(); - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/DropDownControl.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Editor/DropDownControl.cs.meta deleted file mode 100644 index 424d24376..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/DropDownControl.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 83ec3ed09f8f2f34ea7483e055f6d76d -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByComparerRenderer.cs b/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByComparerRenderer.cs deleted file mode 100644 index 6d7875bc6..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByComparerRenderer.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace UnityTest -{ - public class GroupByComparerRenderer : AssertionListRenderer - { - protected override IEnumerable> GroupResult(IEnumerable assertionComponents) - { - return assertionComponents.GroupBy(c => c.Action.GetType()); - } - - protected override string GetStringKey(Type key) - { - return key.Name; - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByComparerRenderer.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByComparerRenderer.cs.meta deleted file mode 100644 index e9173993d..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByComparerRenderer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: efab536803bd0154a8a7dc78e8767ad9 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByExecutionMethodRenderer.cs b/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByExecutionMethodRenderer.cs deleted file mode 100644 index b4b6d3fc6..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByExecutionMethodRenderer.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace UnityTest -{ - public class GroupByExecutionMethodRenderer : AssertionListRenderer - { - protected override IEnumerable> GroupResult(IEnumerable assertionComponents) - { - var enumVals = Enum.GetValues(typeof(CheckMethod)).Cast(); - var pairs = new List(); - - foreach (var checkMethod in enumVals) - { - var components = assertionComponents.Where(c => (c.checkMethods & checkMethod) == checkMethod); - var componentPairs = components.Select(a => new CheckFunctionAssertionPair {checkMethod = checkMethod, assertionComponent = a}); - pairs.AddRange(componentPairs); - } - return pairs.GroupBy(pair => pair.checkMethod, - pair => pair.assertionComponent); - } - - private class CheckFunctionAssertionPair - { - public AssertionComponent assertionComponent; - public CheckMethod checkMethod; - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByExecutionMethodRenderer.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByExecutionMethodRenderer.cs.meta deleted file mode 100644 index e542ae1d6..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByExecutionMethodRenderer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 97340abf816b1424fa835a4f26bbdc78 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByGORenderer.cs b/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByGORenderer.cs deleted file mode 100644 index 6d76ca51a..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByGORenderer.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEditor; -using UnityEngine; - -namespace UnityTest -{ - public class GroupByGoRenderer : AssertionListRenderer - { - protected override IEnumerable> GroupResult(IEnumerable assertionComponents) - { - return assertionComponents.GroupBy(c => c.gameObject); - } - - protected override bool PrintFoldout(bool isFolded, GameObject key) - { - isFolded = base.PrintFoldout(isFolded, - key); - - EditorGUILayout.ObjectField(key, - typeof(GameObject), - true, - GUILayout.ExpandWidth(false)); - - return isFolded; - } - - protected override string GetFoldoutDisplayName(GameObject key) - { - return key.name; - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByGORenderer.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByGORenderer.cs.meta deleted file mode 100644 index a11d1dca9..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByGORenderer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: cb824de9146b42343a985aaf63beffd1 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByNothingRenderer.cs b/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByNothingRenderer.cs deleted file mode 100644 index db5d824af..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByNothingRenderer.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace UnityTest -{ - public class GroupByNothingRenderer : AssertionListRenderer - { - protected override IEnumerable> GroupResult(IEnumerable assertionComponents) - { - return assertionComponents.GroupBy(c => ""); - } - - protected override string GetStringKey(string key) - { - return ""; - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByNothingRenderer.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByNothingRenderer.cs.meta deleted file mode 100644 index f7d9d2ac7..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByNothingRenderer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 33bf96aa461ea1d478bb757c52f51c95 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByTestsRenderer.cs b/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByTestsRenderer.cs deleted file mode 100644 index a126a513b..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByTestsRenderer.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace UnityTest -{ - public class GroupByTestsRenderer : AssertionListRenderer - { - protected override IEnumerable> GroupResult(IEnumerable assertionComponents) - { - return assertionComponents.GroupBy(c => - { - var temp = c.transform; - while (temp != null) - { - if (temp.GetComponent("TestComponent") != null) return c.gameObject; - temp = temp.parent.transform; - } - return null; - }); - } - - protected override string GetFoldoutDisplayName(GameObject key) - { - return key.name; - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByTestsRenderer.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByTestsRenderer.cs.meta deleted file mode 100644 index cbc31246d..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/GroupByTestsRenderer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5e577f31e55208b4d8a1774b958e6ed5 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/PropertyPathSelector.cs b/Unity/Assets/UnityTestTools/Assertions/Editor/PropertyPathSelector.cs deleted file mode 100644 index 3bf3911bc..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/PropertyPathSelector.cs +++ /dev/null @@ -1,207 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using UnityEditor; -using UnityEngine; - -namespace UnityTest -{ - public class PropertyPathSelector - { - private readonly DropDownControl m_ThisDropDown = new DropDownControl(); - private readonly Func m_ReplaceDotWithSlashAndAddGoGroup = s => s.Replace('.', '/'); - - private readonly string m_Name; - private bool m_FocusBackToEdit; - private SelectedPathError m_Error; - - public PropertyPathSelector(string name) - { - m_Name = name; - m_ThisDropDown.convertForGUIContent = m_ReplaceDotWithSlashAndAddGoGroup; - m_ThisDropDown.tooltip = "Select the path to the value you want to use for comparison."; - } - - public void Draw(GameObject go, ActionBase comparer, string propertPath, Type[] accepatbleTypes, Action onSelectedGo, Action onSelectedPath) - { - var newGo = (GameObject)EditorGUILayout.ObjectField(m_Name, go, typeof(GameObject), true); - if (newGo != go) - onSelectedGo(newGo); - - if (go != null) - { - var newPath = DrawListOfMethods(go, comparer, propertPath, accepatbleTypes, m_ThisDropDown); - - if (newPath != propertPath) - onSelectedPath(newPath); - } - } - - private string DrawListOfMethods(GameObject go, ActionBase comparer, string propertPath, Type[] accepatbleTypes, DropDownControl dropDown) - { - string result = propertPath; - if (accepatbleTypes == null) - { - result = DrawManualPropertyEditField(go, propertPath, accepatbleTypes, dropDown); - } - else - { - bool isPropertyOrFieldFound = true; - if (string.IsNullOrEmpty(result)) - { - var options = GetFieldsAndProperties(go, comparer, result, accepatbleTypes); - isPropertyOrFieldFound = options.Any(); - if (isPropertyOrFieldFound) - { - result = options.First(); - } - } - - if (isPropertyOrFieldFound) - { - dropDown.Draw(go.name + '.', result, - () => - { - try - { - var options = GetFieldsAndProperties(go, comparer, result, accepatbleTypes); - return options.ToArray(); - } - catch (Exception) - { - Debug.LogWarning("An exception was thrown while resolving a property list. Resetting property path."); - result = ""; - return new string[0]; - } - }, s => result = s); - } - else - { - result = DrawManualPropertyEditField(go, propertPath, accepatbleTypes, dropDown); - } - } - return result; - } - - private static List GetFieldsAndProperties(GameObject go, ActionBase comparer, string extendPath, Type[] accepatbleTypes) - { - var propertyResolver = new PropertyResolver {AllowedTypes = accepatbleTypes, ExcludedFieldNames = comparer.GetExcludedFieldNames()}; - var options = propertyResolver.GetFieldsAndPropertiesFromGameObject(go, comparer.GetDepthOfSearch(), extendPath).ToList(); - options.Sort((x, y) => - { - if (char.IsLower(x[0])) - return -1; - if (char.IsLower(y[0])) - return 1; - return x.CompareTo(y); - }); - return options; - } - - private string DrawManualPropertyEditField(GameObject go, string propertPath, Type[] acceptableTypes, DropDownControl dropDown) - { - var propertyResolver = new PropertyResolver { AllowedTypes = acceptableTypes }; - IList list; - - var loadProps = new Func(() => - { - try - { - list = propertyResolver.GetFieldsAndPropertiesUnderPath(go, propertPath); - } - catch (ArgumentException) - { - list = propertyResolver.GetFieldsAndPropertiesUnderPath(go, ""); - } - return list.ToArray(); - }); - - EditorGUILayout.BeginHorizontal(); - - var labelSize = EditorStyles.label.CalcSize(new GUIContent(go.name + '.')); - GUILayout.Label(go.name + (propertPath.Length > 0 ? "." : ""), EditorStyles.label, GUILayout.Width(labelSize.x)); - - string btnName = "hintBtn"; - if (GUI.GetNameOfFocusedControl() == btnName - && Event.current.type == EventType.KeyDown - && Event.current.keyCode == KeyCode.DownArrow) - { - Event.current.Use(); - dropDown.PrintMenu(loadProps()); - GUI.FocusControl(""); - m_FocusBackToEdit = true; - } - - EditorGUI.BeginChangeCheck(); - GUI.SetNextControlName(btnName); - var result = GUILayout.TextField(propertPath, EditorStyles.textField); - if (EditorGUI.EndChangeCheck()) - { - m_Error = DoesPropertyExist(go, result); - } - - if (m_FocusBackToEdit) - { - m_FocusBackToEdit = false; - GUI.FocusControl(btnName); - } - - if (GUILayout.Button("Clear", EditorStyles.miniButton, GUILayout.Width(38))) - { - result = ""; - GUI.FocusControl(null); - m_FocusBackToEdit = true; - m_Error = DoesPropertyExist(go, result); - } - EditorGUILayout.EndHorizontal(); - EditorGUILayout.BeginHorizontal(); - GUILayout.Label("", GUILayout.Width(labelSize.x)); - - dropDown.Draw("", result ?? "", loadProps, s => - { - result = s; - GUI.FocusControl(null); - m_FocusBackToEdit = true; - m_Error = DoesPropertyExist(go, result); - }); - EditorGUILayout.EndHorizontal(); - - switch (m_Error) - { - case SelectedPathError.InvalidPath: - EditorGUILayout.HelpBox("This property does not exist", MessageType.Error); - break; - case SelectedPathError.MissingComponent: - EditorGUILayout.HelpBox("This property or field is not attached or set. It will fail unless it will be attached before the check is perfomed.", MessageType.Warning); - break; - } - - return result; - } - - private SelectedPathError DoesPropertyExist(GameObject go, string propertPath) - { - try - { - object obj; - if (MemberResolver.TryGetValue(go, propertPath, out obj)) - return SelectedPathError.None; - return SelectedPathError.InvalidPath; - } - catch (TargetInvocationException e) - { - if (e.InnerException is MissingComponentException) - return SelectedPathError.MissingComponent; - throw; - } - } - - private enum SelectedPathError - { - None, - MissingComponent, - InvalidPath - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/PropertyPathSelector.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Editor/PropertyPathSelector.cs.meta deleted file mode 100644 index b1998a874..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/PropertyPathSelector.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6619da1897737044080bdb8bc60eff87 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/PropertyResolver.cs b/Unity/Assets/UnityTestTools/Assertions/Editor/PropertyResolver.cs deleted file mode 100644 index 5d705daa5..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/PropertyResolver.cs +++ /dev/null @@ -1,188 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text.RegularExpressions; -using UnityEngine; - -namespace UnityTest -{ - [Serializable] - public class PropertyResolver - { - public string[] ExcludedFieldNames { get; set; } - public Type[] ExcludedTypes { get; set; } - public Type[] AllowedTypes { get; set; } - - public PropertyResolver() - { - ExcludedFieldNames = new string[] { }; - ExcludedTypes = new Type[] { }; - AllowedTypes = new Type[] { }; - } - - public IList GetFieldsAndPropertiesUnderPath(GameObject go, string propertPath) - { - propertPath = propertPath.Trim(); - if (!PropertyPathIsValid(propertPath)) - { - throw new ArgumentException("Incorrect property path: " + propertPath); - } - - var idx = propertPath.LastIndexOf('.'); - - if (idx < 0) - { - var components = GetFieldsAndPropertiesFromGameObject(go, 2, null); - return components; - } - - var propertyToSearch = propertPath; - Type type; - if (MemberResolver.TryGetMemberType(go, propertyToSearch, out type)) - { - idx = propertPath.Length - 1; - } - else - { - propertyToSearch = propertPath.Substring(0, idx); - if (!MemberResolver.TryGetMemberType(go, propertyToSearch, out type)) - { - var components = GetFieldsAndPropertiesFromGameObject(go, 2, null); - return components.Where(s => s.StartsWith(propertPath.Substring(idx + 1))).ToArray(); - } - } - - var resultList = new List(); - var path = ""; - if (propertyToSearch.EndsWith(".")) - propertyToSearch = propertyToSearch.Substring(0, propertyToSearch.Length - 1); - foreach (var c in propertyToSearch) - { - if (c == '.') - resultList.Add(path); - path += c; - } - resultList.Add(path); - foreach (var prop in type.GetProperties().Where(info => info.GetIndexParameters().Length == 0)) - { - if (prop.Name.StartsWith(propertPath.Substring(idx + 1))) - resultList.Add(propertyToSearch + "." + prop.Name); - } - foreach (var prop in type.GetFields()) - { - if (prop.Name.StartsWith(propertPath.Substring(idx + 1))) - resultList.Add(propertyToSearch + "." + prop.Name); - } - return resultList.ToArray(); - } - - internal bool PropertyPathIsValid(string propertPath) - { - if (propertPath.StartsWith(".")) - return false; - if (propertPath.IndexOf("..") >= 0) - return false; - if (Regex.IsMatch(propertPath, @"\s")) - return false; - return true; - } - - public IList GetFieldsAndPropertiesFromGameObject(GameObject gameObject, int depthOfSearch, string extendPath) - { - if (depthOfSearch < 1) throw new ArgumentOutOfRangeException("depthOfSearch has to be greater than 0"); - - var goVals = GetPropertiesAndFieldsFromType(typeof(GameObject), - depthOfSearch - 1).Select(s => "gameObject." + s); - - var result = new List(); - if (AllowedTypes == null || !AllowedTypes.Any() || AllowedTypes.Contains(typeof(GameObject))) - result.Add("gameObject"); - result.AddRange(goVals); - - foreach (var componentType in GetAllComponents(gameObject)) - { - if (AllowedTypes == null || !AllowedTypes.Any() || AllowedTypes.Any(t => t.IsAssignableFrom(componentType))) - result.Add(componentType.Name); - - if (depthOfSearch > 1) - { - var vals = GetPropertiesAndFieldsFromType(componentType, depthOfSearch - 1); - var valsFullName = vals.Select(s => componentType.Name + "." + s); - result.AddRange(valsFullName); - } - } - - if (!string.IsNullOrEmpty(extendPath)) - { - var memberResolver = new MemberResolver(gameObject, extendPath); - var pathType = memberResolver.GetMemberType(); - var vals = GetPropertiesAndFieldsFromType(pathType, depthOfSearch - 1); - var valsFullName = vals.Select(s => extendPath + "." + s); - result.AddRange(valsFullName); - } - - return result; - } - - private string[] GetPropertiesAndFieldsFromType(Type type, int level) - { - level--; - - var result = new List(); - var fields = new List(); - fields.AddRange(type.GetFields().Where(f => !Attribute.IsDefined(f, typeof(ObsoleteAttribute))).ToArray()); - fields.AddRange(type.GetProperties().Where(info => info.GetIndexParameters().Length == 0 && !Attribute.IsDefined(info, typeof(ObsoleteAttribute))).ToArray()); - - foreach (var member in fields) - { - var memberType = GetMemberFieldType(member); - var memberTypeName = memberType.Name; - - if (AllowedTypes == null - || !AllowedTypes.Any() - || (AllowedTypes.Any(t => t.IsAssignableFrom(memberType)) && !ExcludedFieldNames.Contains(memberTypeName))) - { - result.Add(member.Name); - } - - if (level > 0 && IsTypeOrNameNotExcluded(memberType, memberTypeName)) - { - var vals = GetPropertiesAndFieldsFromType(memberType, level); - var valsFullName = vals.Select(s => member.Name + "." + s); - result.AddRange(valsFullName); - } - } - return result.ToArray(); - } - - private Type GetMemberFieldType(MemberInfo info) - { - if (info.MemberType == MemberTypes.Property) - return (info as PropertyInfo).PropertyType; - if (info.MemberType == MemberTypes.Field) - return (info as FieldInfo).FieldType; - throw new Exception("Only properties and fields are allowed"); - } - - internal Type[] GetAllComponents(GameObject gameObject) - { - var result = new List(); - var components = gameObject.GetComponents(typeof(Component)); - foreach (var component in components) - { - var componentType = component.GetType(); - if (IsTypeOrNameNotExcluded(componentType, null)) - { - result.Add(componentType); - } - } - return result.ToArray(); - } - - private bool IsTypeOrNameNotExcluded(Type memberType, string memberTypeName) - { - return !ExcludedTypes.Contains(memberType) && !ExcludedFieldNames.Contains(memberTypeName); - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/Editor/PropertyResolver.cs.meta b/Unity/Assets/UnityTestTools/Assertions/Editor/PropertyResolver.cs.meta deleted file mode 100644 index 22210c779..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/Editor/PropertyResolver.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: bbbd193a27920d9478c2a766a7291d72 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/InvalidPathException.cs b/Unity/Assets/UnityTestTools/Assertions/InvalidPathException.cs deleted file mode 100644 index 9ddde07eb..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/InvalidPathException.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - public class InvalidPathException : Exception - { - public InvalidPathException(string path) - : base("Invalid path part " + path) - { - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/InvalidPathException.cs.meta b/Unity/Assets/UnityTestTools/Assertions/InvalidPathException.cs.meta deleted file mode 100644 index a5f882dda..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/InvalidPathException.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3b85786dfd1aef544bf8bb873d6a4ebb -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Assertions/MemberResolver.cs b/Unity/Assets/UnityTestTools/Assertions/MemberResolver.cs deleted file mode 100644 index 65f7351c1..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/MemberResolver.cs +++ /dev/null @@ -1,208 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Text.RegularExpressions; -using UnityEngine; - -namespace UnityTest -{ - public class MemberResolver - { - private object m_CallingObjectRef; - private MemberInfo[] m_Callstack; - private readonly GameObject m_GameObject; - private readonly string m_Path; - - public MemberResolver(GameObject gameObject, string path) - { - path = path.Trim(); - ValidatePath(path); - - m_GameObject = gameObject; - m_Path = path.Trim(); - } - - public object GetValue(bool useCache) - { - if (useCache && m_CallingObjectRef != null) - { - object val = m_CallingObjectRef; - for (int i = 0; i < m_Callstack.Length; i++) - val = GetValueFromMember(val, m_Callstack[i]); - return val; - } - - object result = GetBaseObject(); - var fullCallStack = GetCallstack(); - - m_CallingObjectRef = result; - var tempCallstack = new List(); - for (int i = 0; i < fullCallStack.Length; i++) - { - var member = fullCallStack[i]; - result = GetValueFromMember(result, member); - tempCallstack.Add(member); - if (result == null) return null; - var type = result.GetType(); - - //String is not a value type but we don't want to cache it - if (!IsValueType(type) && type != typeof(System.String)) - { - tempCallstack.Clear(); - m_CallingObjectRef = result; - } - } - m_Callstack = tempCallstack.ToArray(); - return result; - } - - public Type GetMemberType() - { - var callstack = GetCallstack(); - if (callstack.Length == 0) return GetBaseObject().GetType(); - - var member = callstack[callstack.Length - 1]; - if (member is FieldInfo) - return (member as FieldInfo).FieldType; - if (member is MethodInfo) - return (member as MethodInfo).ReturnType; - return null; - } - - #region Static wrappers - public static bool TryGetMemberType(GameObject gameObject, string path, out Type value) - { - try - { - var mr = new MemberResolver(gameObject, path); - value = mr.GetMemberType(); - return true; - } - catch (InvalidPathException) - { - value = null; - return false; - } - } - - public static bool TryGetValue(GameObject gameObject, string path, out object value) - { - try - { - var mr = new MemberResolver(gameObject, path); - value = mr.GetValue(false); - return true; - } - catch (InvalidPathException) - { - value = null; - return false; - } - } - #endregion - - private object GetValueFromMember(object obj, MemberInfo memberInfo) - { - if (memberInfo is FieldInfo) - return (memberInfo as FieldInfo).GetValue(obj); - if (memberInfo is MethodInfo) - return (memberInfo as MethodInfo).Invoke(obj, null); - throw new InvalidPathException(memberInfo.Name); - } - - private object GetBaseObject() - { - if (string.IsNullOrEmpty(m_Path)) return m_GameObject; - var firstElement = m_Path.Split('.')[0]; - var comp = m_GameObject.GetComponent(firstElement); - if (comp != null) - return comp; - return m_GameObject; - } - - private MemberInfo[] GetCallstack() - { - if (m_Path == "") return new MemberInfo[0]; - var propsQueue = new Queue(m_Path.Split('.')); - - Type type = GetBaseObject().GetType(); - if (type != typeof(GameObject)) - propsQueue.Dequeue(); - - PropertyInfo propertyTemp; - FieldInfo fieldTemp; - var list = new List(); - while (propsQueue.Count != 0) - { - var nameToFind = propsQueue.Dequeue(); - fieldTemp = GetField(type, nameToFind); - if (fieldTemp != null) - { - type = fieldTemp.FieldType; - list.Add(fieldTemp); - continue; - } - propertyTemp = GetProperty(type, nameToFind); - if (propertyTemp != null) - { - type = propertyTemp.PropertyType; - var getMethod = GetGetMethod(propertyTemp); - list.Add(getMethod); - continue; - } - throw new InvalidPathException(nameToFind); - } - return list.ToArray(); - } - - private void ValidatePath(string path) - { - bool invalid = false; - if (path.StartsWith(".") || path.EndsWith(".")) - invalid = true; - if (path.IndexOf("..") >= 0) - invalid = true; - if (Regex.IsMatch(path, @"\s")) - invalid = true; - - if (invalid) - throw new InvalidPathException(path); - } - - private static bool IsValueType(Type type) - { - #if !UNITY_METRO - return type.IsValueType; - #else - return false; - #endif - } - - private static FieldInfo GetField(Type type, string fieldName) - { - #if !UNITY_METRO - return type.GetField(fieldName); - #else - return null; - #endif - } - - private static PropertyInfo GetProperty(Type type, string propertyName) - { - #if !UNITY_METRO - return type.GetProperty(propertyName); - #else - return null; - #endif - } - - private static MethodInfo GetGetMethod(PropertyInfo propertyInfo) - { - #if !UNITY_METRO - return propertyInfo.GetGetMethod(); - #else - return null; - #endif - } - } -} diff --git a/Unity/Assets/UnityTestTools/Assertions/MemberResolver.cs.meta b/Unity/Assets/UnityTestTools/Assertions/MemberResolver.cs.meta deleted file mode 100644 index 6b1ea4253..000000000 --- a/Unity/Assets/UnityTestTools/Assertions/MemberResolver.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 80df8ef907961e34dbcc7c89b22729b9 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Common.meta b/Unity/Assets/UnityTestTools/Common.meta deleted file mode 100644 index 5f0acfe78..000000000 --- a/Unity/Assets/UnityTestTools/Common.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: a2caba6436df568499c84c1c607ce766 -folderAsset: yes -DefaultImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/Common/Editor.meta b/Unity/Assets/UnityTestTools/Common/Editor.meta deleted file mode 100644 index 2021d4fe3..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: f4ab061d0035ee545a936bdf8f3f8620 -DefaultImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/Common/Editor/Icons.cs b/Unity/Assets/UnityTestTools/Common/Editor/Icons.cs deleted file mode 100644 index 8fd7bfae8..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/Icons.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using UnityEditor; -using UnityEngine; - -namespace UnityTest -{ - public static class Icons - { - const string k_IconsFolderName = "icons"; - private static readonly string k_IconsFolderPath = String.Format("UnityTestTools{0}Common{0}Editor{0}{1}", Path.DirectorySeparatorChar, k_IconsFolderName); - - private static readonly string k_IconsAssetsPath = ""; - - public static readonly Texture2D FailImg; - public static readonly Texture2D IgnoreImg; - public static readonly Texture2D SuccessImg; - public static readonly Texture2D UnknownImg; - public static readonly Texture2D InconclusiveImg; - public static readonly Texture2D StopwatchImg; - - public static readonly GUIContent GUIUnknownImg; - public static readonly GUIContent GUIInconclusiveImg; - public static readonly GUIContent GUIIgnoreImg; - public static readonly GUIContent GUISuccessImg; - public static readonly GUIContent GUIFailImg; - - static Icons() - { - var dirs = Directory.GetDirectories("Assets", k_IconsFolderName, SearchOption.AllDirectories).Where(s => s.EndsWith(k_IconsFolderPath)); - if (dirs.Any()) - k_IconsAssetsPath = dirs.First(); - else - Debug.LogWarning("The UnityTestTools asset folder path is incorrect. If you relocated the tools please change the path accordingly (Icons.cs)."); - - FailImg = LoadTexture("failed.png"); - IgnoreImg = LoadTexture("ignored.png"); - SuccessImg = LoadTexture("passed.png"); - UnknownImg = LoadTexture("normal.png"); - InconclusiveImg = LoadTexture("inconclusive.png"); - StopwatchImg = LoadTexture("stopwatch.png"); - - GUIUnknownImg = new GUIContent(UnknownImg); - GUIInconclusiveImg = new GUIContent(InconclusiveImg); - GUIIgnoreImg = new GUIContent(IgnoreImg); - GUISuccessImg = new GUIContent(SuccessImg); - GUIFailImg = new GUIContent(FailImg); - } - - private static Texture2D LoadTexture(string fileName) - { - return (Texture2D)AssetDatabase.LoadAssetAtPath(k_IconsAssetsPath + Path.DirectorySeparatorChar + fileName, typeof(Texture2D)); - } - } -} diff --git a/Unity/Assets/UnityTestTools/Common/Editor/Icons.cs.meta b/Unity/Assets/UnityTestTools/Common/Editor/Icons.cs.meta deleted file mode 100644 index 267269a9a..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/Icons.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8571844b0c115b84cbe8b3f67e8dec04 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Common/Editor/ProjectSettingsBase.cs b/Unity/Assets/UnityTestTools/Common/Editor/ProjectSettingsBase.cs deleted file mode 100644 index 99cafad80..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/ProjectSettingsBase.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using UnityEditor; -using UnityEngine; - -namespace UnityTest -{ - public abstract class ProjectSettingsBase : ScriptableObject - { - private static readonly string k_SettingsPath = Path.Combine("UnityTestTools", "Common"); - const string k_SettingsFolder = "Settings"; - - public virtual void Save() - { - EditorUtility.SetDirty(this); - } - - public static T Load() where T : ProjectSettingsBase, new () - { - var pathsInProject = Directory.GetDirectories("Assets", "*", SearchOption.AllDirectories) - .Where(s => s.Contains(k_SettingsPath)); - - if (pathsInProject.Count() == 0) Debug.LogError("Can't find settings path: " + k_SettingsPath); - - string pathInProject = Path.Combine(pathsInProject.First(), k_SettingsFolder); - var assetPath = Path.Combine(pathInProject, typeof(T).Name) + ".asset"; - var settings = AssetDatabase.LoadAssetAtPath(assetPath, typeof(T)) as T; - - if (settings != null) return settings; - - settings = CreateInstance(); - Directory.CreateDirectory(pathInProject); - AssetDatabase.CreateAsset(settings, assetPath); - return settings; - } - } -} diff --git a/Unity/Assets/UnityTestTools/Common/Editor/ProjectSettingsBase.cs.meta b/Unity/Assets/UnityTestTools/Common/Editor/ProjectSettingsBase.cs.meta deleted file mode 100644 index db5944b97..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/ProjectSettingsBase.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9ac961be07107124a88dcb81927143d4 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter.meta b/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter.meta deleted file mode 100644 index 9b2e13b3f..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: 4ffbf5a07740aa5479651bd415f52ebb -folderAsset: yes -DefaultImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter/ResultSummarizer.cs b/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter/ResultSummarizer.cs deleted file mode 100644 index cfd39ca34..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter/ResultSummarizer.cs +++ /dev/null @@ -1,173 +0,0 @@ -// **************************************************************** -// Based on nUnit 2.6.2 (http://www.nunit.org/) -// **************************************************************** - -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - /// - /// Summary description for ResultSummarizer. - /// - public class ResultSummarizer - { - private int m_ErrorCount; - private int m_FailureCount; - private int m_IgnoreCount; - private int m_InconclusiveCount; - private int m_NotRunnable; - private int m_ResultCount; - private int m_SkipCount; - private int m_SuccessCount; - private int m_TestsRun; - - private TimeSpan m_Duration; - - 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(ITestResult result) - { - m_Duration += TimeSpan.FromSeconds(result.Duration); - m_ResultCount++; - - if(!result.Executed) - { - if(result.IsIgnored) - { - m_IgnoreCount++; - return; - } - - m_SkipCount++; - return; - } - - switch (result.ResultState) - { - case TestResultState.Success: - m_SuccessCount++; - m_TestsRun++; - break; - case TestResultState.Failure: - m_FailureCount++; - m_TestsRun++; - break; - 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/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter/ResultSummarizer.cs.meta b/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter/ResultSummarizer.cs.meta deleted file mode 100644 index ca3c41ff5..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter/ResultSummarizer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ce89106be5bd4204388d58510e4e55da -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter/StackTraceFilter.cs b/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter/StackTraceFilter.cs deleted file mode 100644 index 686de9267..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter/StackTraceFilter.cs +++ /dev/null @@ -1,62 +0,0 @@ -// **************************************************************** -// Based on nUnit 2.6.2 (http://www.nunit.org/) -// **************************************************************** - -using System; -using System.Collections.Generic; -using System.IO; -using UnityEngine; - -namespace UnityTest -{ - /// - /// Summary description for StackTraceFilter. - /// - public class StackTraceFilter - { - public static string Filter(string stack) - { - if (stack == null) return null; - var sw = new StringWriter(); - var sr = new StringReader(stack); - - try - { - string line; - while ((line = sr.ReadLine()) != null) - { - if (!FilterLine(line)) - sw.WriteLine(line.Trim()); - } - } - catch (Exception) - { - return stack; - } - return sw.ToString(); - } - - static bool FilterLine(string line) - { - string[] patterns = - { - "NUnit.Core.TestCase", - "NUnit.Core.ExpectedExceptionTestCase", - "NUnit.Core.TemplateTestCase", - "NUnit.Core.TestResult", - "NUnit.Core.TestSuite", - "NUnit.Framework.Assertion", - "NUnit.Framework.Assert", - "System.Reflection.MonoMethod" - }; - - for (int i = 0; i < patterns.Length; i++) - { - if (line.IndexOf(patterns[i]) > 0) - return true; - } - - return false; - } - } -} diff --git a/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter/StackTraceFilter.cs.meta b/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter/StackTraceFilter.cs.meta deleted file mode 100644 index 705184399..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter/StackTraceFilter.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: fe6b4d68575d4ba44b1d5c5c3f0e96d3 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter/XmlResultWriter.cs b/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter/XmlResultWriter.cs deleted file mode 100644 index 3115e4f26..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter/XmlResultWriter.cs +++ /dev/null @@ -1,303 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Security; -using System.Text; -using UnityEngine; - -namespace UnityTest -{ - public class XmlResultWriter - { - private readonly StringBuilder m_ResultWriter = new StringBuilder(); - private int m_Indend; - private readonly string m_SuiteName; - private readonly ITestResult[] m_Results; - string m_Platform; - - public XmlResultWriter(string suiteName, string platform, ITestResult[] results) - { - m_SuiteName = suiteName; - m_Results = results; - m_Platform = platform; - } - - private const string k_NUnitVersion = "2.6.2-Unity"; - - public string GetTestResult() - { - InitializeXmlFile(m_SuiteName, new ResultSummarizer(m_Results)); - foreach (var result in m_Results) - { - WriteResultElement(result); - } - TerminateXmlFile(); - return m_ResultWriter.ToString(); - } - - private void InitializeXmlFile(string resultsName, ResultSummarizer summaryResults) - { - WriteHeader(); - - DateTime now = DateTime.Now; - var attributes = new Dictionary - { - {"name", "Unity Tests"}, - {"total", summaryResults.TestsRun.ToString()}, - {"errors", summaryResults.Errors.ToString()}, - {"failures", summaryResults.Failures.ToString()}, - {"not-run", summaryResults.TestsNotRun.ToString()}, - {"inconclusive", summaryResults.Inconclusive.ToString()}, - {"ignored", summaryResults.Ignored.ToString()}, - {"skipped", summaryResults.Skipped.ToString()}, - {"invalid", summaryResults.NotRunnable.ToString()}, - {"date", now.ToString("yyyy-MM-dd")}, - {"time", now.ToString("HH:mm:ss")} - }; - - WriteOpeningElement("test-results", attributes); - - WriteEnvironment(m_Platform); - WriteCultureInfo(); - WriteTestSuite(resultsName, summaryResults); - WriteOpeningElement("results"); - } - - private void WriteOpeningElement(string elementName) - { - WriteOpeningElement(elementName, new Dictionary()); - } - - private void WriteOpeningElement(string elementName, Dictionary attributes) - { - WriteOpeningElement(elementName, attributes, false); - } - - - private void WriteOpeningElement(string elementName, Dictionary attributes, bool closeImmediatelly) - { - WriteIndend(); - m_Indend++; - m_ResultWriter.Append("<"); - m_ResultWriter.Append(elementName); - foreach (var attribute in attributes) - { - m_ResultWriter.AppendFormat(" {0}=\"{1}\"", attribute.Key, SecurityElement.Escape(attribute.Value)); - } - if (closeImmediatelly) - { - m_ResultWriter.Append(" /"); - m_Indend--; - } - m_ResultWriter.AppendLine(">"); - } - - private void WriteIndend() - { - for (int i = 0; i < m_Indend; i++) - { - m_ResultWriter.Append(" "); - } - } - - private void WriteClosingElement(string elementName) - { - m_Indend--; - WriteIndend(); - m_ResultWriter.AppendLine(""); - } - - private void WriteHeader() - { - m_ResultWriter.AppendLine(""); - m_ResultWriter.AppendLine(""); - } - - static string GetEnvironmentUserName() - { - return Environment.UserName; - } - - static string GetEnvironmentMachineName() - { - return Environment.MachineName; - } - - static string GetEnvironmentUserDomainName() - { - return Environment.UserDomainName; - } - - static string GetEnvironmentVersion() - { - return Environment.Version.ToString(); - } - - static string GetEnvironmentOSVersion() - { - return Environment.OSVersion.ToString(); - } - - static string GetEnvironmentOSVersionPlatform() - { - return Environment.OSVersion.Platform.ToString(); - } - - static string EnvironmentGetCurrentDirectory() - { - return Environment.CurrentDirectory; - } - - private void WriteEnvironment( string targetPlatform ) - { - var attributes = new Dictionary - { - {"nunit-version", k_NUnitVersion}, - {"clr-version", GetEnvironmentVersion()}, - {"os-version", GetEnvironmentOSVersion()}, - {"platform", GetEnvironmentOSVersionPlatform()}, - {"cwd", EnvironmentGetCurrentDirectory()}, - {"machine-name", GetEnvironmentMachineName()}, - {"user", GetEnvironmentUserName()}, - {"user-domain", GetEnvironmentUserDomainName()}, - {"unity-version", Application.unityVersion}, - {"unity-platform", targetPlatform} - }; - WriteOpeningElement("environment", attributes, true); - } - - private void WriteCultureInfo() - { - var attributes = new Dictionary - { - {"current-culture", CultureInfo.CurrentCulture.ToString()}, - {"current-uiculture", CultureInfo.CurrentUICulture.ToString()} - }; - WriteOpeningElement("culture-info", attributes, true); - } - - private void WriteTestSuite(string resultsName, ResultSummarizer summaryResults) - { - var attributes = new Dictionary - { - {"name", resultsName}, - {"type", "Assembly"}, - {"executed", "True"}, - {"result", summaryResults.Success ? "Success" : "Failure"}, - {"success", summaryResults.Success ? "True" : "False"}, - {"time", summaryResults.Duration.ToString("#####0.000", NumberFormatInfo.InvariantInfo)} - }; - WriteOpeningElement("test-suite", attributes); - } - - private void WriteResultElement(ITestResult result) - { - StartTestElement(result); - - switch (result.ResultState) - { - case TestResultState.Ignored: - case TestResultState.NotRunnable: - case TestResultState.Skipped: - WriteReasonElement(result); - break; - - case TestResultState.Failure: - case TestResultState.Error: - case TestResultState.Cancelled: - WriteFailureElement(result); - break; - case TestResultState.Success: - case TestResultState.Inconclusive: - if (result.Message != null) - WriteReasonElement(result); - break; - }; - - WriteClosingElement("test-case"); - } - - private void TerminateXmlFile() - { - WriteClosingElement("results"); - WriteClosingElement("test-suite"); - WriteClosingElement("test-results"); - } - - #region Element Creation Helpers - - private void StartTestElement(ITestResult result) - { - var attributes = new Dictionary - { - {"name", result.FullName}, - {"executed", result.Executed.ToString()} - }; - string resultString; - switch (result.ResultState) - { - case TestResultState.Cancelled: - resultString = TestResultState.Failure.ToString(); - break; - default: - resultString = result.ResultState.ToString(); - break; - } - attributes.Add("result", resultString); - if (result.Executed) - { - attributes.Add("success", result.IsSuccess.ToString()); - attributes.Add("time", result.Duration.ToString("#####0.000", NumberFormatInfo.InvariantInfo)); - } - WriteOpeningElement("test-case", attributes); - } - - private void WriteReasonElement(ITestResult result) - { - WriteOpeningElement("reason"); - WriteOpeningElement("message"); - WriteCData(result.Message); - WriteClosingElement("message"); - WriteClosingElement("reason"); - } - - private void WriteFailureElement(ITestResult result) - { - WriteOpeningElement("failure"); - WriteOpeningElement("message"); - WriteCData(result.Message); - WriteClosingElement("message"); - WriteOpeningElement("stack-trace"); - if (result.StackTrace != null) - WriteCData(StackTraceFilter.Filter(result.StackTrace)); - WriteClosingElement("stack-trace"); - WriteClosingElement("failure"); - } - - #endregion - - private void WriteCData(string text) - { - if (string.IsNullOrEmpty(text)) - return; - m_ResultWriter.AppendFormat("", text); - m_ResultWriter.AppendLine(); - } - - public void WriteToFile(string resultDestiantion, string resultFileName) - { - try - { - var path = Path.Combine(resultDestiantion, resultFileName); - Debug.Log("Saving results in " + path); - File.WriteAllText(path, GetTestResult(), Encoding.UTF8); - } - catch (Exception e) - { - Debug.LogError("Error while opening file"); - Debug.LogException(e); - } - } - } -} diff --git a/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter/XmlResultWriter.cs.meta b/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter/XmlResultWriter.cs.meta deleted file mode 100644 index 2fffa90d1..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/ResultWriter/XmlResultWriter.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e9bba41ace7686d4ab0c400d1e7f55b7 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Common/Editor/Styles.cs b/Unity/Assets/UnityTestTools/Common/Editor/Styles.cs deleted file mode 100644 index 0caf6e1a9..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/Styles.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEditor; -using UnityEngine; - -namespace UnityTest -{ - public static class Styles - { - public static GUIStyle info; - public static GUIStyle testList; - - public static GUIStyle selectedFoldout; - public static GUIStyle foldout; - public static GUIStyle toolbarLabel; - - public static GUIStyle testName; - - private static readonly Color k_SelectedColor = new Color(0.3f, 0.5f, 0.85f); - - 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; - - foldout = new GUIStyle(EditorStyles.foldout); - selectedFoldout = new GUIStyle(EditorStyles.foldout); - selectedFoldout.onFocused.textColor = selectedFoldout.focused.textColor = - selectedFoldout.onActive.textColor = selectedFoldout.active.textColor = - selectedFoldout.onNormal.textColor = selectedFoldout.normal.textColor = k_SelectedColor; - - toolbarLabel = new GUIStyle(EditorStyles.toolbarButton); - toolbarLabel.normal.background = null; - toolbarLabel.contentOffset = new Vector2(0, -2); - - testName = new GUIStyle(EditorStyles.label); - testName.padding.left += 12; - testName.focused.textColor = testName.onFocused.textColor = k_SelectedColor; - } - } -} diff --git a/Unity/Assets/UnityTestTools/Common/Editor/Styles.cs.meta b/Unity/Assets/UnityTestTools/Common/Editor/Styles.cs.meta deleted file mode 100644 index 294a61941..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/Styles.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a8b92379e11501742b1badcbb08da812 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Common/Editor/TestFilterSettings.cs b/Unity/Assets/UnityTestTools/Common/Editor/TestFilterSettings.cs deleted file mode 100644 index cef016a06..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/TestFilterSettings.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; -using System.Linq; - -namespace UnityTest -{ - public class TestFilterSettings - { - public bool ShowSucceeded; - public bool ShowFailed; - public bool ShowIgnored; - public bool ShowNotRun; - - public string FilterByName; - public int FilterByCategory; - - private GUIContent _succeededBtn; - private GUIContent _failedBtn; - private GUIContent _ignoredBtn; - private GUIContent _notRunBtn; - - public string[] AvailableCategories; - - private readonly string _prefsKey; - - public TestFilterSettings(string prefsKey) - { - _prefsKey = prefsKey; - Load(); - UpdateCounters(Enumerable.Empty()); - } - - public void Load() - { - ShowSucceeded = EditorPrefs.GetBool(_prefsKey + ".ShowSucceeded", true); - ShowFailed = EditorPrefs.GetBool(_prefsKey + ".ShowFailed", true); - ShowIgnored = EditorPrefs.GetBool(_prefsKey + ".ShowIgnored", true); - ShowNotRun = EditorPrefs.GetBool(_prefsKey + ".ShowNotRun", true); - FilterByName = EditorPrefs.GetString(_prefsKey + ".FilterByName", string.Empty); - FilterByCategory = EditorPrefs.GetInt(_prefsKey + ".FilterByCategory", 0); - } - - public void Save() - { - EditorPrefs.SetBool(_prefsKey + ".ShowSucceeded", ShowSucceeded); - EditorPrefs.SetBool(_prefsKey + ".ShowFailed", ShowFailed); - EditorPrefs.SetBool(_prefsKey + ".ShowIgnored", ShowIgnored); - EditorPrefs.SetBool(_prefsKey + ".ShowNotRun", ShowNotRun); - EditorPrefs.SetString(_prefsKey + ".FilterByName", FilterByName); - EditorPrefs.SetInt(_prefsKey + ".FilterByCategory", FilterByCategory); - } - - public void UpdateCounters(IEnumerable results) - { - var summary = new ResultSummarizer(results); - - _succeededBtn = new GUIContent(summary.Passed.ToString(), Icons.SuccessImg, "Show tests that succeeded"); - _failedBtn = new GUIContent((summary.Errors + summary.Failures + summary.Inconclusive).ToString(), Icons.FailImg, "Show tests that failed"); - _ignoredBtn = new GUIContent((summary.Ignored + summary.NotRunnable).ToString(), Icons.IgnoreImg, "Show tests that are ignored"); - _notRunBtn = new GUIContent((summary.TestsNotRun - summary.Ignored - summary.NotRunnable).ToString(), Icons.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, _succeededBtn, EditorStyles.toolbarButton); - ShowFailed = GUILayout.Toggle(ShowFailed, _failedBtn, EditorStyles.toolbarButton); - ShowIgnored = GUILayout.Toggle(ShowIgnored, _ignoredBtn, EditorStyles.toolbarButton); - ShowNotRun = GUILayout.Toggle(ShowNotRun, _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/Unity/Assets/UnityTestTools/Common/Editor/TestFilterSettings.cs.meta b/Unity/Assets/UnityTestTools/Common/Editor/TestFilterSettings.cs.meta deleted file mode 100644 index 9a7a0e32c..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/TestFilterSettings.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5a2d025e58bff433e963d0a4cd7599ef -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Common/Editor/icons.meta b/Unity/Assets/UnityTestTools/Common/Editor/icons.meta deleted file mode 100644 index 58c52486d..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/icons.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: e8bb6eae11352f44da0d6d8a8959b69e -DefaultImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/Common/Editor/icons/failed.png b/Unity/Assets/UnityTestTools/Common/Editor/icons/failed.png deleted file mode 100644 index 7c0aba4c3..000000000 Binary files a/Unity/Assets/UnityTestTools/Common/Editor/icons/failed.png and /dev/null differ diff --git a/Unity/Assets/UnityTestTools/Common/Editor/icons/failed.png.meta b/Unity/Assets/UnityTestTools/Common/Editor/icons/failed.png.meta deleted file mode 100644 index 03673daab..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/icons/failed.png.meta +++ /dev/null @@ -1,35 +0,0 @@ -fileFormatVersion: 2 -guid: 41488feb372865440b7c01773f04c0cf -TextureImporter: - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: .25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 1024 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - textureType: 2 - buildTargetSettings: [] - userData: diff --git a/Unity/Assets/UnityTestTools/Common/Editor/icons/ignored.png b/Unity/Assets/UnityTestTools/Common/Editor/icons/ignored.png deleted file mode 100644 index 0190e59bc..000000000 Binary files a/Unity/Assets/UnityTestTools/Common/Editor/icons/ignored.png and /dev/null differ diff --git a/Unity/Assets/UnityTestTools/Common/Editor/icons/ignored.png.meta b/Unity/Assets/UnityTestTools/Common/Editor/icons/ignored.png.meta deleted file mode 100644 index d14cc3b79..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/icons/ignored.png.meta +++ /dev/null @@ -1,35 +0,0 @@ -fileFormatVersion: 2 -guid: 0076bfa6073f17546b3535ac1b456b0b -TextureImporter: - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: .25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 1024 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - textureType: 2 - buildTargetSettings: [] - userData: diff --git a/Unity/Assets/UnityTestTools/Common/Editor/icons/inconclusive.png b/Unity/Assets/UnityTestTools/Common/Editor/icons/inconclusive.png deleted file mode 100644 index df398ddbb..000000000 Binary files a/Unity/Assets/UnityTestTools/Common/Editor/icons/inconclusive.png and /dev/null differ diff --git a/Unity/Assets/UnityTestTools/Common/Editor/icons/inconclusive.png.meta b/Unity/Assets/UnityTestTools/Common/Editor/icons/inconclusive.png.meta deleted file mode 100644 index 7c93bc454..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/icons/inconclusive.png.meta +++ /dev/null @@ -1,35 +0,0 @@ -fileFormatVersion: 2 -guid: e28761099904678488cdddf7b6be2ceb -TextureImporter: - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: .25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 1024 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - textureType: 2 - buildTargetSettings: [] - userData: diff --git a/Unity/Assets/UnityTestTools/Common/Editor/icons/normal.png b/Unity/Assets/UnityTestTools/Common/Editor/icons/normal.png deleted file mode 100644 index 6a04f7951..000000000 Binary files a/Unity/Assets/UnityTestTools/Common/Editor/icons/normal.png and /dev/null differ diff --git a/Unity/Assets/UnityTestTools/Common/Editor/icons/normal.png.meta b/Unity/Assets/UnityTestTools/Common/Editor/icons/normal.png.meta deleted file mode 100644 index 34895eb59..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/icons/normal.png.meta +++ /dev/null @@ -1,35 +0,0 @@ -fileFormatVersion: 2 -guid: a9f3c491f4c2f9f43ac33a27c16913dd -TextureImporter: - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: .25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 1024 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - textureType: 2 - buildTargetSettings: [] - userData: diff --git a/Unity/Assets/UnityTestTools/Common/Editor/icons/passed.png b/Unity/Assets/UnityTestTools/Common/Editor/icons/passed.png deleted file mode 100644 index 1edd28604..000000000 Binary files a/Unity/Assets/UnityTestTools/Common/Editor/icons/passed.png and /dev/null differ diff --git a/Unity/Assets/UnityTestTools/Common/Editor/icons/passed.png.meta b/Unity/Assets/UnityTestTools/Common/Editor/icons/passed.png.meta deleted file mode 100644 index 876d32d9a..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/icons/passed.png.meta +++ /dev/null @@ -1,35 +0,0 @@ -fileFormatVersion: 2 -guid: 31f7928179ee46d4690d274579efb037 -TextureImporter: - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: .25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 1024 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - textureType: 2 - buildTargetSettings: [] - userData: diff --git a/Unity/Assets/UnityTestTools/Common/Editor/icons/stopwatch.png b/Unity/Assets/UnityTestTools/Common/Editor/icons/stopwatch.png deleted file mode 100644 index ac5721c5f..000000000 Binary files a/Unity/Assets/UnityTestTools/Common/Editor/icons/stopwatch.png and /dev/null differ diff --git a/Unity/Assets/UnityTestTools/Common/Editor/icons/stopwatch.png.meta b/Unity/Assets/UnityTestTools/Common/Editor/icons/stopwatch.png.meta deleted file mode 100644 index f39adad65..000000000 --- a/Unity/Assets/UnityTestTools/Common/Editor/icons/stopwatch.png.meta +++ /dev/null @@ -1,35 +0,0 @@ -fileFormatVersion: 2 -guid: f73f95ae19d51af47ad56044f2779aa1 -TextureImporter: - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: .25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 1024 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - textureType: 2 - buildTargetSettings: [] - userData: diff --git a/Unity/Assets/UnityTestTools/Common/ITestResult.cs b/Unity/Assets/UnityTestTools/Common/ITestResult.cs deleted file mode 100644 index 13f5fc3a7..000000000 --- a/Unity/Assets/UnityTestTools/Common/ITestResult.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityTest; - -public interface ITestResult -{ - TestResultState ResultState { get; } - - string Message { get; } - - string Logs { get; } - - bool Executed { get; } - - string Name { get; } - - string FullName { get; } - - string Id { get; } - - bool IsSuccess { get; } - - double Duration { get; } - - string StackTrace { get; } - - bool IsIgnored { get; } -} diff --git a/Unity/Assets/UnityTestTools/Common/ITestResult.cs.meta b/Unity/Assets/UnityTestTools/Common/ITestResult.cs.meta deleted file mode 100644 index 4864197ad..000000000 --- a/Unity/Assets/UnityTestTools/Common/ITestResult.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d1e4e2c4d00b3f2469494fc0f67cdeae -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Common/TestResultState.cs b/Unity/Assets/UnityTestTools/Common/TestResultState.cs deleted file mode 100644 index 3dc4eb8c6..000000000 --- a/Unity/Assets/UnityTestTools/Common/TestResultState.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - public enum TestResultState : byte - { - Inconclusive = 0, - - /// - /// The test was not runnable. - /// - NotRunnable = 1, - - /// - /// The test has been skipped. - /// - Skipped = 2, - - /// - /// The test has been ignored. - /// - Ignored = 3, - - /// - /// The test succeeded - /// - Success = 4, - - /// - /// The test failed - /// - Failure = 5, - - /// - /// The test encountered an unexpected exception - /// - Error = 6, - - /// - /// The test was cancelled by the user - /// - Cancelled = 7 - } -} diff --git a/Unity/Assets/UnityTestTools/Common/TestResultState.cs.meta b/Unity/Assets/UnityTestTools/Common/TestResultState.cs.meta deleted file mode 100644 index e1576c7c8..000000000 --- a/Unity/Assets/UnityTestTools/Common/TestResultState.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: da3ca54ee4cce064989d27165f3081fb -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/Documentation.url b/Unity/Assets/UnityTestTools/Documentation.url deleted file mode 100644 index 9ebdf1ad2..000000000 --- a/Unity/Assets/UnityTestTools/Documentation.url +++ /dev/null @@ -1,3 +0,0 @@ -[InternetShortcut] -URL=https://bitbucket.org/Unity-Technologies/unitytesttools/wiki -IconIndex=0 \ No newline at end of file diff --git a/Unity/Assets/UnityTestTools/Documentation.url.meta b/Unity/Assets/UnityTestTools/Documentation.url.meta deleted file mode 100644 index b5db4964e..000000000 --- a/Unity/Assets/UnityTestTools/Documentation.url.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 28f1b62e1364e5a4e88f7bb94dbcf183 -DefaultImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework.meta deleted file mode 100644 index da2287228..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: 241054a0fe63fbb4bb51609fce9b3112 -folderAsset: yes -DefaultImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/Libs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/Libs.meta deleted file mode 100644 index 1b7497510..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/Libs.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: e22ba039de7077c4aa95758ef723b803 -folderAsset: yes -timeCreated: 1445282049 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.Mdb.dll b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.Mdb.dll deleted file mode 100644 index 161d2fdc9..000000000 Binary files a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.Mdb.dll and /dev/null differ diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.Mdb.dll.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.Mdb.dll.meta deleted file mode 100644 index a040b4f38..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.Mdb.dll.meta +++ /dev/null @@ -1,24 +0,0 @@ -fileFormatVersion: 2 -guid: 713231d47408a06408a45470c967bae8 -timeCreated: 1441797177 -licenseType: Store -PluginImporter: - serializedVersion: 1 - iconMap: {} - executionOrder: {} - isPreloaded: 0 - platformData: - Any: - enabled: 0 - settings: {} - Editor: - enabled: 1 - settings: - DefaultValueInitialized: true - WindowsStoreApps: - enabled: 0 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.dll b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.dll deleted file mode 100644 index f55f7a5d0..000000000 Binary files a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.dll and /dev/null differ diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.dll.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.dll.meta deleted file mode 100644 index 88805bddf..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/Libs/Mono.Cecil.dll.meta +++ /dev/null @@ -1,24 +0,0 @@ -fileFormatVersion: 2 -guid: 28fc22990733f8f4ea1137f15e363609 -timeCreated: 1441797177 -licenseType: Store -PluginImporter: - serializedVersion: 1 - iconMap: {} - executionOrder: {} - isPreloaded: 0 - platformData: - Any: - enabled: 0 - settings: {} - Editor: - enabled: 1 - settings: - DefaultValueInitialized: true - WindowsStoreApps: - enabled: 0 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner.meta deleted file mode 100644 index c65a67d50..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: da93545c3ab1aa043bcfb22281b1f66c -folderAsset: yes -DefaultImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/DTOFormatter.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/DTOFormatter.cs deleted file mode 100644 index f974b7c1b..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/DTOFormatter.cs +++ /dev/null @@ -1,140 +0,0 @@ -using System; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using UnityEngine; - -namespace UnityTest -{ - - public class DTOFormatter { - - private interface ITransferInterface - { - void Transfer(ref ResultDTO.MessageType val); - void Transfer(ref TestResultState val); - void Transfer(ref byte val); - void Transfer(ref bool val); - void Transfer(ref int val); - void Transfer(ref float val); - void Transfer(ref double val); - void Transfer(ref string val); - } - - private class Writer : ITransferInterface - { - private readonly Stream _stream; - public Writer(Stream stream) { _stream = stream; } - - private void WriteConvertedNumber(byte[] bytes) - { - if(BitConverter.IsLittleEndian) - Array.Reverse(bytes); - _stream.Write(bytes, 0, bytes.Length); - } - - public void Transfer(ref ResultDTO.MessageType val) { _stream.WriteByte((byte)val); } - public void Transfer(ref TestResultState val) { _stream.WriteByte((byte)val); } - public void Transfer(ref byte val) { _stream.WriteByte(val); } - public void Transfer(ref bool val) { _stream.WriteByte((byte)(val ? 0x01 : 0x00)); } - public void Transfer(ref int val) { WriteConvertedNumber(BitConverter.GetBytes(val)); } - public void Transfer(ref float val) { WriteConvertedNumber(BitConverter.GetBytes(val)); } - public void Transfer(ref double val) { WriteConvertedNumber(BitConverter.GetBytes(val)); } - - public void Transfer(ref string val) - { - var bytes = Encoding.BigEndianUnicode.GetBytes(val); - int length = bytes.Length; - Transfer(ref length); - _stream.Write(bytes, 0, bytes.Length); - } - } - - private class Reader : ITransferInterface - { - private readonly Stream _stream; - public Reader(Stream stream) { _stream = stream; } - - private byte[] ReadConvertedNumber(int size) - { - byte[] buffer = new byte[size]; - _stream.Read (buffer, 0, buffer.Length); - if(BitConverter.IsLittleEndian) - Array.Reverse(buffer); - return buffer; - } - - public void Transfer(ref ResultDTO.MessageType val) { val = (ResultDTO.MessageType)_stream.ReadByte(); } - public void Transfer(ref TestResultState val) { val = (TestResultState)_stream.ReadByte(); } - public void Transfer(ref byte val) { val = (byte)_stream.ReadByte(); } - public void Transfer(ref bool val) { val = (_stream.ReadByte() != 0); } - public void Transfer(ref int val) { val = BitConverter.ToInt32(ReadConvertedNumber(4), 0); } - public void Transfer(ref float val) { val = BitConverter.ToSingle(ReadConvertedNumber(4), 0); } - public void Transfer(ref double val) { val = BitConverter.ToDouble(ReadConvertedNumber(8), 0); } - - public void Transfer(ref string val) - { - int length = 0; - Transfer (ref length); - var bytes = new byte[length]; - int remain = length; - int index = 0; - do { - int bytesRead = _stream.Read(bytes, index, remain); - remain -= bytesRead; - index += bytesRead; - } while (remain > 0); - val = Encoding.BigEndianUnicode.GetString(bytes); - } - } - - private void Transfer(ResultDTO dto, ITransferInterface transfer) - { - transfer.Transfer(ref dto.messageType); - - transfer.Transfer(ref dto.levelCount); - transfer.Transfer(ref dto.loadedLevel); - transfer.Transfer(ref dto.loadedLevelName); - - if(dto.messageType == ResultDTO.MessageType.Ping - || dto.messageType == ResultDTO.MessageType.RunStarted - || dto.messageType == ResultDTO.MessageType.RunFinished - || dto.messageType == ResultDTO.MessageType.RunInterrupted - || dto.messageType == ResultDTO.MessageType.AllScenesFinished) - return; - - transfer.Transfer(ref dto.testName); - transfer.Transfer(ref dto.testTimeout); - - if(dto.messageType == ResultDTO.MessageType.TestStarted) - return; - - if(transfer is Reader) - dto.testResult = new SerializableTestResult(); - SerializableTestResult str = (SerializableTestResult)dto.testResult; - - transfer.Transfer(ref str.resultState); - transfer.Transfer(ref str.message); - transfer.Transfer(ref str.executed); - transfer.Transfer(ref str.name); - transfer.Transfer(ref str.fullName); - transfer.Transfer(ref str.id); - transfer.Transfer(ref str.isSuccess); - transfer.Transfer(ref str.duration); - transfer.Transfer(ref str.stackTrace); - } - - public void Serialize (Stream stream, ResultDTO dto) - { - Transfer(dto, new Writer(stream)); - } - - public object Deserialize (Stream stream) - { - var result = (ResultDTO)FormatterServices.GetSafeUninitializedObject(typeof(ResultDTO)); - Transfer (result, new Reader(stream)); - return result; - } - } - -} \ No newline at end of file diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/DTOFormatter.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/DTOFormatter.cs.meta deleted file mode 100644 index f83bde0c7..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/DTOFormatter.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7ae2470508a854b1c9df5375d03f8f58 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor.meta deleted file mode 100644 index bd38839c5..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: caee08596a5965747b8edfde19e2f873 -folderAsset: yes -DefaultImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Batch.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Batch.cs deleted file mode 100644 index 14a82c642..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Batch.cs +++ /dev/null @@ -1,188 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using UnityEditor; -using UnityEditorInternal; -using UnityEngine; -using UnityTest.IntegrationTests; - -namespace UnityTest -{ - public static partial class Batch - { - const string k_ResultFilePathParam = "-resultFilePath="; - private const string k_TestScenesParam = "-testscenes="; - private const string k_OtherBuildScenesParam = "-includeBuildScenes="; - const string k_TargetPlatformParam = "-targetPlatform="; - const string k_ResultFileDirParam = "-resultsFileDirectory="; - - public static int returnCodeTestsOk = 0; - public static int returnCodeTestsFailed = 2; - public static int returnCodeRunError = 3; - - public static void RunIntegrationTests() - { - var targetPlatform = GetTargetPlatform(); - var otherBuildScenes = GetSceneListFromParam (k_OtherBuildScenesParam); - - var testScenes = GetSceneListFromParam(k_TestScenesParam); - if (testScenes.Count == 0) - testScenes = FindTestScenesInProject(); - - RunIntegrationTests(targetPlatform, testScenes, otherBuildScenes); - } - - public static void RunIntegrationTests(BuildTarget ? targetPlatform) - { - var sceneList = FindTestScenesInProject(); - RunIntegrationTests(targetPlatform, sceneList, new List()); - } - - - public static void RunIntegrationTests(BuildTarget? targetPlatform, List testScenes, List otherBuildScenes) - { - if (targetPlatform.HasValue) - BuildAndRun(targetPlatform.Value, testScenes, otherBuildScenes); - else - RunInEditor(testScenes, otherBuildScenes); - } - - private static void BuildAndRun(BuildTarget target, List testScenes, List otherBuildScenes) - { - var resultFilePath = GetParameterArgument(k_ResultFileDirParam); - - const int port = 0; - var ipList = TestRunnerConfigurator.GetAvailableNetworkIPs(); - - var config = new PlatformRunnerConfiguration - { - buildTarget = target, - buildScenes = otherBuildScenes, - testScenes = testScenes, - projectName = "IntegrationTests", - resultsDir = resultFilePath, - sendResultsOverNetwork = InternalEditorUtility.inBatchMode, - ipList = ipList, - port = port - }; - - if (Application.isWebPlayer) - { - config.sendResultsOverNetwork = false; - Debug.Log("You can't use WebPlayer as active platform for running integration tests. Switching to Standalone"); - EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.StandaloneWindows); - } - - PlatformRunner.BuildAndRunInPlayer(config); - } - - private static void RunInEditor(List testScenes, List otherBuildScenes) - { - CheckActiveBuildTarget(); - - NetworkResultsReceiver.StopReceiver(); - if (testScenes == null || testScenes.Count == 0) - { - Debug.Log("No test scenes on the list"); - EditorApplication.Exit(returnCodeRunError); - return; - } - EditorBuildSettings.scenes = (testScenes.Concat(otherBuildScenes).ToList()).Select(s => new EditorBuildSettingsScene(s, true)).ToArray(); - EditorApplication.OpenScene(testScenes.First()); - GuiHelper.SetConsoleErrorPause(false); - - var config = new PlatformRunnerConfiguration - { - resultsDir = GetParameterArgument(k_ResultFileDirParam), - ipList = TestRunnerConfigurator.GetAvailableNetworkIPs(), - port = PlatformRunnerConfiguration.TryToGetFreePort(), - runInEditor = true - }; - - var settings = new PlayerSettingConfigurator(true); - settings.AddConfigurationFile(TestRunnerConfigurator.integrationTestsNetwork, string.Join("\n", config.GetConnectionIPs())); - - NetworkResultsReceiver.StartReceiver(config); - - EditorApplication.isPlaying = true; - } - - private static string GetParameterArgument(string parameterName) - { - foreach (var arg in Environment.GetCommandLineArgs()) - { - if (arg.ToLower().StartsWith(parameterName.ToLower())) - { - return arg.Substring(parameterName.Length); - } - } - return null; - } - - static void CheckActiveBuildTarget() - { - var notSupportedPlatforms = new[] { "MetroPlayer", "WebPlayer", "WebPlayerStreamed" }; - if (notSupportedPlatforms.Contains(EditorUserBuildSettings.activeBuildTarget.ToString())) - { - Debug.Log("activeBuildTarget can not be " - + EditorUserBuildSettings.activeBuildTarget + - " use buildTarget parameter to open Unity."); - } - } - - private static BuildTarget ? GetTargetPlatform() - { - string platformString = null; - BuildTarget buildTarget; - foreach (var arg in Environment.GetCommandLineArgs()) - { - if (arg.ToLower().StartsWith(k_TargetPlatformParam.ToLower())) - { - platformString = arg.Substring(k_ResultFilePathParam.Length); - break; - } - } - try - { - if (platformString == null) return null; - buildTarget = (BuildTarget)Enum.Parse(typeof(BuildTarget), platformString); - } - catch - { - return null; - } - return buildTarget; - } - - private static List FindTestScenesInProject() - { - var integrationTestScenePattern = "*Test?.unity"; - return Directory.GetFiles("Assets", integrationTestScenePattern, SearchOption.AllDirectories).ToList(); - } - - private static List GetSceneListFromParam(string param) - { - var sceneList = new List(); - foreach (var arg in Environment.GetCommandLineArgs()) - { - if (arg.ToLower().StartsWith(param.ToLower())) - { - var scenesFromParam = arg.Substring(param.Length).Split(','); - foreach (var scene in scenesFromParam) - { - var sceneName = scene; - if (!sceneName.EndsWith(".unity")) - sceneName += ".unity"; - var foundScenes = Directory.GetFiles(Directory.GetCurrentDirectory(), sceneName, SearchOption.AllDirectories); - if (foundScenes.Length == 1) - sceneList.Add(foundScenes[0].Substring(Directory.GetCurrentDirectory().Length + 1)); - else - Debug.Log(sceneName + " not found or multiple entries found"); - } - } - } - return sceneList.Where(s => !string.IsNullOrEmpty(s)).Distinct().ToList(); - } - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Batch.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Batch.cs.meta deleted file mode 100644 index 248a6ce21..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Batch.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 29d4fb050362c5b43aea52342045543a -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/EditorReferencesUtil.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/EditorReferencesUtil.cs deleted file mode 100644 index 3d762b80d..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/EditorReferencesUtil.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using UnityEditor; -using UnityEngine; -using Object = UnityEngine.Object; - -namespace UnityTest -{ - public static class EditorReferencesUtil - { - - public static List FindScenesWhichContainAsset(string file) - { - string assetPath = GetAssetPathFromFileNameAndExtension (file); - Object cur = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Object)); - return AllScenes.Where(a => ADependsOnB(a, cur)).ToList(); - } - - private static string CleanPathSeparators(string s) - { - const string forwardSlash = "/"; - const string backSlash = "\\"; - return s.Replace(backSlash, forwardSlash); - } - - private static string GetRelativeAssetPathFromFullPath(string fullPath) - { - fullPath = CleanPathSeparators(fullPath); - if (fullPath.Contains(Application.dataPath)) - { - return fullPath.Replace(Application.dataPath, "Assets"); - } - Debug.LogWarning("Path does not point to a location within Assets: " + fullPath); - return null; - } - - private static string GetAssetPathFromFileNameAndExtension(string assetName) - { - string[] assets = AssetDatabase.FindAssets (Path.GetFileNameWithoutExtension (assetName)); - string assetPath = null; - - foreach (string guid in assets) { - string relativePath = AssetDatabase.GUIDToAssetPath (guid); - - if (Path.GetFileName (relativePath) == Path.GetFileName (assetName)) - assetPath = relativePath; - } - - return assetPath; - } - - private static List DirSearch(DirectoryInfo d, string searchFor) - { - List founditems = d.GetFiles(searchFor).ToList(); - - // Add (by recursing) subdirectory items. - DirectoryInfo[] dis = d.GetDirectories(); - foreach (DirectoryInfo di in dis) - founditems.AddRange(DirSearch(di, searchFor)); - - return (founditems); - } - - private static List AllScenes - { - get - { - // get every single one of the files in the Assets folder. - List files = DirSearch(new DirectoryInfo(Application.dataPath), "*.unity"); - - // now make them all into Asset references. - List assetRefs = new List(); - - foreach (FileInfo fi in files) - { - if (fi.Name.StartsWith(".")) - continue; // Unity ignores dotfiles. - assetRefs.Add(AssetDatabase.LoadMainAssetAtPath(GetRelativeAssetPathFromFullPath(fi.FullName))); - } - return assetRefs; - } - } - - private static bool ADependsOnB(Object obj, Object selectedObj) - { - if (selectedObj == null) return false; - - //optionally, exclude self. - if (selectedObj == obj) return false; - - Object[] dependencies = EditorUtility.CollectDependencies(new Object[1] { obj }); - if (dependencies.Length < 2) return false; // if there's only one, it's us. - - foreach (Object dep in dependencies) - if (dep == selectedObj) - return true; - return false; - } - } -} \ No newline at end of file diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/EditorReferencesUtil.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/EditorReferencesUtil.cs.meta deleted file mode 100644 index 78bcfabf8..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/EditorReferencesUtil.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: aad501c968b324cf3a8d1c52eb09ca04 -timeCreated: 1437322927 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/GuiHelper.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/GuiHelper.cs deleted file mode 100644 index 7c213ba04..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/GuiHelper.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text.RegularExpressions; -using Mono.Cecil; -using Mono.Cecil.Cil; -using Mono.Cecil.Mdb; -using Mono.Collections.Generic; -using UnityEditor; -using UnityEditorInternal; -using UnityEngine; - -namespace UnityTest -{ - public static class GuiHelper - { - public static bool GetConsoleErrorPause() - { - Assembly assembly = Assembly.GetAssembly(typeof(SceneView)); - Type type = assembly.GetType("UnityEditorInternal.LogEntries"); - PropertyInfo method = type.GetProperty("consoleFlags"); - var result = (int)method.GetValue(new object(), new object[] { }); - return (result & (1 << 2)) != 0; - } - - public static void SetConsoleErrorPause(bool b) - { - Assembly assembly = Assembly.GetAssembly(typeof(SceneView)); - Type type = assembly.GetType("UnityEditorInternal.LogEntries"); - MethodInfo method = type.GetMethod("SetConsoleFlag"); - method.Invoke(new object(), new object[] { 1 << 2, b }); - } - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/GuiHelper.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/GuiHelper.cs.meta deleted file mode 100644 index 596d39f3e..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/GuiHelper.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b0b95014154ef554485afc9c0316556d -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsHierarchyAnnotation.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsHierarchyAnnotation.cs deleted file mode 100644 index 4aa5dc417..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsHierarchyAnnotation.cs +++ /dev/null @@ -1,44 +0,0 @@ -using UnityEngine; -using System.Collections; -using UnityEditor; - -namespace UnityTest -{ - - [InitializeOnLoad] - public class IntegrationTestsHierarchyAnnotation { - - static IntegrationTestsHierarchyAnnotation() - { - EditorApplication.hierarchyWindowItemOnGUI += DoAnnotationGUI; - } - - public static void DoAnnotationGUI(int id, Rect rect) - { - var obj = EditorUtility.InstanceIDToObject(id) as GameObject; - if(!obj) return; - - var tc = obj.GetComponent(); - if(!tc) return; - - if (!EditorApplication.isPlayingOrWillChangePlaymode - && rect.Contains(Event.current.mousePosition) - && Event.current.type == EventType.MouseDown - && Event.current.button == 1) - { - IntegrationTestRendererBase.DrawContextMenu(tc); - Event.current.Use (); - } - - EditorGUIUtility.SetIconSize(new Vector2(15, 15)); - var result = IntegrationTestsRunnerWindow.GetResultForTest(tc); - if (result != null) - { - var icon = result.Executed ? IntegrationTestRendererBase.GetIconForResult(result.resultType) : Icons.UnknownImg; - EditorGUI.LabelField(new Rect(rect.xMax - 18, rect.yMin - 2, rect.width, rect.height), new GUIContent(icon)); - } - EditorGUIUtility.SetIconSize(Vector2.zero); - } - } - -} \ No newline at end of file diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsHierarchyAnnotation.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsHierarchyAnnotation.cs.meta deleted file mode 100644 index 4154bdc98..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsHierarchyAnnotation.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 219cdb080b08741948fc5deb8c7d47f0 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerSettings.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerSettings.cs deleted file mode 100644 index 1e8e466d7..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerSettings.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace UnityTest -{ - public class IntegrationTestsRunnerSettings : ProjectSettingsBase - { - public bool blockUIWhenRunning = true; - public bool pauseOnTestFailure; - - public void ToggleBlockUIWhenRunning () - { - blockUIWhenRunning = !blockUIWhenRunning; - Save (); - } - - public void TogglePauseOnTestFailure() - { - pauseOnTestFailure = !pauseOnTestFailure; - Save (); - } - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerSettings.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerSettings.cs.meta deleted file mode 100644 index d18086a76..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerSettings.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5d01dc4c8f278da489d7d54c83f19cb9 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerWindow.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerWindow.cs deleted file mode 100644 index 961503cff..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerWindow.cs +++ /dev/null @@ -1,588 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using UnityEditor; -using UnityEngine; -using UnityTest.IntegrationTestRunner; - -namespace UnityTest -{ - [Serializable] - public class IntegrationTestsRunnerWindow : EditorWindow, IHasCustomMenu - { - #region GUI Contents - private readonly GUIContent m_GUICreateNewTest = new GUIContent("Create", "Create new test"); - private readonly GUIContent m_GUIRunSelectedTests = new GUIContent("Run Selected", "Run selected test(s)"); - private readonly GUIContent m_GUIRunAllTests = new GUIContent("Run All", "Run all tests"); - private readonly GUIContent m_GUIBlockUI = new GUIContent("Block UI when running", "Block UI when running tests"); - private readonly GUIContent m_GUIPauseOnFailure = new GUIContent("Pause on test failure"); - #endregion - - #region runner steerign vars - private static IntegrationTestsRunnerWindow s_Instance; - [SerializeField] private List m_TestsToRun; - [SerializeField] private List m_DynamicTestsToRun; - [SerializeField] private bool m_ReadyToRun; - private bool m_IsBuilding; - public static bool selectedInHierarchy; - private float m_HorizontalSplitBarPosition = 200; - private Vector2 m_TestInfoScroll, m_TestListScroll; - private IntegrationTestRendererBase[] m_TestLines; - private string m_CurrectSceneName; - private TestFilterSettings m_FilterSettings; - - Vector2 m_resultTextSize; - string m_resultText; - GameObject m_lastSelectedGO; - int m_resultTestMaxLength = 15000; - - [SerializeField] private GameObject m_SelectedLine; - [SerializeField] private List m_ResultList = new List(); - [SerializeField] private List m_FoldMarkers = new List(); - - private IntegrationTestsRunnerSettings m_Settings; - - #endregion - - - static IntegrationTestsRunnerWindow() - { - InitBackgroundRunners(); - } - - private static void InitBackgroundRunners() - { - EditorApplication.hierarchyWindowItemOnGUI -= OnHierarchyWindowItemDraw; - EditorApplication.hierarchyWindowItemOnGUI += OnHierarchyWindowItemDraw; - EditorApplication.hierarchyWindowChanged -= OnHierarchyChangeUpdate; - EditorApplication.hierarchyWindowChanged += OnHierarchyChangeUpdate; - EditorApplication.update -= BackgroundSceneChangeWatch; - EditorApplication.update += BackgroundSceneChangeWatch; - EditorApplication.playmodeStateChanged -= OnPlaymodeStateChanged; - EditorApplication.playmodeStateChanged += OnPlaymodeStateChanged; - } - - private static void OnPlaymodeStateChanged() - { - if (s_Instance && EditorApplication.isPlaying == EditorApplication.isPlayingOrWillChangePlaymode) - s_Instance.RebuildTestList(); - } - - public void OnDestroy() - { - EditorApplication.hierarchyWindowItemOnGUI -= OnHierarchyWindowItemDraw; - EditorApplication.update -= BackgroundSceneChangeWatch; - EditorApplication.hierarchyWindowChanged -= OnHierarchyChangeUpdate; - EditorApplication.playmodeStateChanged -= OnPlaymodeStateChanged; - - TestComponent.DestroyAllDynamicTests(); - } - - private static void BackgroundSceneChangeWatch() - { - if (!s_Instance) return; - if (s_Instance.m_CurrectSceneName != null && s_Instance.m_CurrectSceneName == EditorApplication.currentScene) return; - if (EditorApplication.isPlayingOrWillChangePlaymode) return; - TestComponent.DestroyAllDynamicTests(); - s_Instance.m_CurrectSceneName = EditorApplication.currentScene; - s_Instance.m_ResultList.Clear(); - s_Instance.RebuildTestList(); - } - - public void OnEnable() - { - titleContent = new GUIContent("Integration Tests"); - s_Instance = this; - - m_Settings = ProjectSettingsBase.Load(); - m_FilterSettings = new TestFilterSettings("UnityTest.IntegrationTestsRunnerWindow"); - - InitBackgroundRunners(); - if (!EditorApplication.isPlayingOrWillChangePlaymode && !m_ReadyToRun) RebuildTestList(); - } - - public void OnSelectionChange() - { - if (EditorApplication.isPlayingOrWillChangePlaymode - || Selection.objects == null - || Selection.objects.Length == 0) return; - - if (Selection.gameObjects.Length == 1) - { - var go = Selection.gameObjects.Single(); - var temp = go.transform; - while (temp != null) - { - var tc = temp.GetComponent(); - if (tc != null) break; - temp = temp.parent; - } - - if (temp != null) - { - SelectInHierarchy(temp.gameObject); - Selection.activeGameObject = temp.gameObject; - m_SelectedLine = temp.gameObject; - } - } - } - - public static void OnHierarchyChangeUpdate() - { - if (!s_Instance || s_Instance.m_TestLines == null || EditorApplication.isPlayingOrWillChangePlaymode) return; - - // create a test runner if it doesn't exist - TestRunner.GetTestRunner(); - - // make tests are not places under a go that is not a test itself - foreach (var test in TestComponent.FindAllTestsOnScene()) - { - if (test.gameObject.transform.parent != null && test.gameObject.transform.parent.gameObject.GetComponent() == null) - { - test.gameObject.transform.parent = null; - Debug.LogWarning("Tests need to be on top of the hierarchy or directly under another test."); - } - } - if (selectedInHierarchy) selectedInHierarchy = false; - else s_Instance.RebuildTestList(); - } - - public static TestResult GetResultForTest(TestComponent tc) - { - if(!s_Instance) return new TestResult(tc); - return s_Instance.m_ResultList.FirstOrDefault(r => r.GameObject == tc.gameObject); - } - - public static void OnHierarchyWindowItemDraw(int id, Rect rect) - { - var o = EditorUtility.InstanceIDToObject(id); - if (o is GameObject) - { - var go = o as GameObject; - - if (Event.current.type == EventType.MouseDown - && Event.current.button == 0 - && rect.Contains(Event.current.mousePosition)) - { - var temp = go.transform; - while (temp != null) - { - var c = temp.GetComponent(); - if (c != null) break; - temp = temp.parent; - } - if (temp != null) SelectInHierarchy(temp.gameObject); - } - } - } - - private static void SelectInHierarchy(GameObject gameObject) - { - if (!s_Instance) return; - if (gameObject == s_Instance.m_SelectedLine && gameObject.activeInHierarchy) return; - if (EditorApplication.isPlayingOrWillChangePlaymode) return; - if (!gameObject.activeSelf) - { - selectedInHierarchy = true; - gameObject.SetActive(true); - } - - var tests = TestComponent.FindAllTestsOnScene(); - var skipList = gameObject.GetComponentsInChildren(typeof(TestComponent), true).ToList(); - tests.RemoveAll(skipList.Contains); - foreach (var test in tests) - { - var enable = test.GetComponentsInChildren(typeof(TestComponent), true).Any(c => c.gameObject == gameObject); - if (test.gameObject.activeSelf != enable) test.gameObject.SetActive(enable); - } - } - - private void RunTests(IList tests) - { - if (!tests.Any() || EditorApplication.isCompiling || EditorApplication.isPlayingOrWillChangePlaymode) - return; - FocusWindowIfItsOpen(GetType()); - - var testComponents = tests.Where(t => t is TestComponent).Cast().ToList(); - var dynaminTests = testComponents.Where(t => t.dynamic).ToList(); - m_DynamicTestsToRun = dynaminTests.Select(c => c.dynamicTypeName).ToList(); - testComponents.RemoveAll(dynaminTests.Contains); - - m_TestsToRun = testComponents.Select( tc => tc.gameObject ).ToList(); - - m_ReadyToRun = true; - TestComponent.DisableAllTests(); - - EditorApplication.isPlaying = true; - } - - public void Update() - { - if (m_ReadyToRun && EditorApplication.isPlaying) - { - m_ReadyToRun = false; - var testRunner = TestRunner.GetTestRunner(); - testRunner.TestRunnerCallback.Add(new RunnerCallback(this)); - var testComponents = m_TestsToRun.Select(go => go.GetComponent()).ToList(); - testRunner.InitRunner(testComponents, m_DynamicTestsToRun); - } - } - - private void RebuildTestList() - { - m_TestLines = null; - if (!TestComponent.AnyTestsOnScene() - && !TestComponent.AnyDynamicTestForCurrentScene()) return; - - if (!EditorApplication.isPlayingOrWillChangePlaymode) - { - var dynamicTestsOnScene = TestComponent.FindAllDynamicTestsOnScene(); - var dynamicTestTypes = TestComponent.GetTypesWithHelpAttribute(EditorApplication.currentScene); - - foreach (var dynamicTestType in dynamicTestTypes) - { - var existingTests = dynamicTestsOnScene.Where(component => component.dynamicTypeName == dynamicTestType.AssemblyQualifiedName); - if (existingTests.Any()) - { - var testComponent = existingTests.Single(); - foreach (var c in testComponent.gameObject.GetComponents()) - { - var type = Type.GetType(testComponent.dynamicTypeName); - if (c is TestComponent || c is Transform || type.IsInstanceOfType(c)) continue; - DestroyImmediate(c); - } - dynamicTestsOnScene.Remove(existingTests.Single()); - continue; - } - TestComponent.CreateDynamicTest(dynamicTestType); - } - - foreach (var testComponent in dynamicTestsOnScene) - DestroyImmediate(testComponent.gameObject); - } - - var topTestList = TestComponent.FindAllTopTestsOnScene(); - - var newResultList = new List(); - m_TestLines = ParseTestList(topTestList, newResultList); - - var oldDynamicResults = m_ResultList.Where(result => result.dynamicTest); - foreach (var oldResult in m_ResultList) - { - var result = newResultList.Find(r => r.Id == oldResult.Id); - if (result == null) continue; - result.Update(oldResult); - } - newResultList.AddRange(oldDynamicResults.Where(r => !newResultList.Contains(r))); - m_ResultList = newResultList; - - IntegrationTestRendererBase.RunTest = RunTests; - IntegrationTestGroupLine.FoldMarkers = m_FoldMarkers; - IntegrationTestLine.Results = m_ResultList; - - m_FilterSettings.UpdateCounters(m_ResultList.Cast()); - - m_FoldMarkers.RemoveAll(o => o == null); - - selectedInHierarchy = true; - Repaint(); - } - - - private IntegrationTestRendererBase[] ParseTestList(List testList, List results) - { - var tempList = new List(); - foreach (var testObject in testList) - { - if (!testObject.IsTestGroup()) - { - var result = new TestResult(testObject); - if (results != null) - results.Add(result); - tempList.Add(new IntegrationTestLine(testObject.gameObject, result)); - continue; - } - var group = new IntegrationTestGroupLine(testObject.gameObject); - var children = testObject.gameObject.GetComponentsInChildren(typeof(TestComponent), true).Cast().ToList(); - children = children.Where(c => c.gameObject.transform.parent == testObject.gameObject.transform).ToList(); - group.AddChildren(ParseTestList(children, results)); - tempList.Add(group); - } - tempList.Sort(); - return tempList.ToArray(); - } - - public void OnGUI() - { - if (BuildPipeline.isBuildingPlayer) - { - m_IsBuilding = true; - } - else if (m_IsBuilding) - { - m_IsBuilding = false; - Repaint(); - } - - PrintHeadPanel(); - - EditorGUILayout.BeginVertical(Styles.testList); - m_TestListScroll = EditorGUILayout.BeginScrollView(m_TestListScroll); - bool repaint = PrintTestList(m_TestLines); - GUILayout.FlexibleSpace(); - EditorGUILayout.EndScrollView(); - EditorGUILayout.EndVertical(); - - RenderDetails(); - - if (repaint) Repaint(); - } - - public void PrintHeadPanel() - { - EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); - EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode); - if (GUILayout.Button(m_GUIRunAllTests, EditorStyles.toolbarButton)) - { - RunTests(TestComponent.FindAllTestsOnScene().Cast().ToList()); - } - EditorGUI.BeginDisabledGroup(!Selection.gameObjects.Any (t => t.GetComponent(typeof(ITestComponent)))); - if (GUILayout.Button(m_GUIRunSelectedTests, EditorStyles.toolbarButton)) - { - RunTests(Selection.gameObjects.Select(t => t.GetComponent(typeof(TestComponent))).Cast().ToList()); - } - EditorGUI.EndDisabledGroup(); - if (GUILayout.Button(m_GUICreateNewTest, EditorStyles.toolbarButton)) - { - var test = TestComponent.CreateTest(); - if (Selection.gameObjects.Length == 1 - && Selection.activeGameObject != null - && Selection.activeGameObject.GetComponent()) - { - test.transform.parent = Selection.activeGameObject.transform.parent; - } - Selection.activeGameObject = test; - RebuildTestList(); - } - EditorGUI.EndDisabledGroup(); - - GUILayout.FlexibleSpace (); - - m_FilterSettings.OnGUI (); - - EditorGUILayout.EndHorizontal (); - } - - public void AddItemsToMenu(GenericMenu menu) - { - menu.AddItem(m_GUIBlockUI, m_Settings.blockUIWhenRunning, m_Settings.ToggleBlockUIWhenRunning); - menu.AddItem(m_GUIPauseOnFailure, m_Settings.pauseOnTestFailure, m_Settings.TogglePauseOnTestFailure); - } - - private bool PrintTestList(IntegrationTestRendererBase[] renderedLines) - { - if (renderedLines == null) return false; - - var filter = m_FilterSettings.BuildRenderingOptions(); - - bool repaint = false; - foreach (var renderedLine in renderedLines) - { - repaint |= renderedLine.Render(filter); - } - return repaint; - } - - private void RenderDetails() - { - var ctrlId = GUIUtility.GetControlID(FocusType.Passive); - - Rect rect = GUILayoutUtility.GetLastRect(); - rect.y = rect.height + rect.y - 1; - rect.height = 3; - - EditorGUIUtility.AddCursorRect(rect, MouseCursor.ResizeVertical); - var e = Event.current; - switch (e.type) - { - case EventType.MouseDown: - if (GUIUtility.hotControl == 0 && rect.Contains(e.mousePosition)) - GUIUtility.hotControl = ctrlId; - break; - case EventType.MouseDrag: - if (GUIUtility.hotControl == ctrlId) - { - m_HorizontalSplitBarPosition -= e.delta.y; - if (m_HorizontalSplitBarPosition < 20) m_HorizontalSplitBarPosition = 20; - Repaint(); - } - break; - case EventType.MouseUp: - if (GUIUtility.hotControl == ctrlId) - GUIUtility.hotControl = 0; - break; - } - - m_TestInfoScroll = EditorGUILayout.BeginScrollView(m_TestInfoScroll, GUILayout.MinHeight(m_HorizontalSplitBarPosition)); - - if (m_SelectedLine != null) - UpdateResultText(m_SelectedLine); - - EditorGUILayout.SelectableLabel(m_resultText, Styles.info, - GUILayout.ExpandHeight(true), - GUILayout.ExpandWidth(true), - GUILayout.MinWidth(m_resultTextSize.x), - GUILayout.MinHeight(m_resultTextSize.y)); - EditorGUILayout.EndScrollView(); - } - - private void UpdateResultText(GameObject go) - { - if(go == m_lastSelectedGO) return; - m_lastSelectedGO = go; - var result = m_ResultList.Find(r => r.GameObject == go); - if (result == null) - { - m_resultText = string.Empty; - m_resultTextSize = Styles.info.CalcSize(new GUIContent(string.Empty)); - return; - } - var sb = new StringBuilder(result.Name.Trim()); - 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(sb.Length>m_resultTestMaxLength) - { - sb.Length = m_resultTestMaxLength; - sb.AppendFormat("...\n\n---MESSAGE TRUNCATED AT {0} CHARACTERS---", m_resultTestMaxLength); - } - m_resultText = sb.ToString().Trim(); - m_resultTextSize = Styles.info.CalcSize(new GUIContent(m_resultText)); - } - - public void OnInspectorUpdate() - { - if (focusedWindow != this) Repaint(); - } - - private void SetCurrentTest(TestComponent tc) - { - foreach (var line in m_TestLines) - line.SetCurrentTest(tc); - } - - class RunnerCallback : ITestRunnerCallback - { - private readonly IntegrationTestsRunnerWindow m_Window; - private int m_TestNumber; - private int m_CurrentTestNumber; - - private readonly bool m_ConsoleErrorOnPauseValue; - private readonly bool m_RunInBackground; - private TestComponent m_CurrentTest; - - public RunnerCallback(IntegrationTestsRunnerWindow window) - { - m_Window = window; - - m_ConsoleErrorOnPauseValue = GuiHelper.GetConsoleErrorPause(); - GuiHelper.SetConsoleErrorPause(false); - m_RunInBackground = PlayerSettings.runInBackground; - PlayerSettings.runInBackground = true; - } - - public void RunStarted(string platform, List testsToRun) - { - EditorApplication.update += OnEditorUpdate; - m_TestNumber = testsToRun.Count; - foreach (var test in testsToRun) - { - var result = m_Window.m_ResultList.Find(r => r.TestComponent == test); - if (result != null) result.Reset(); - } - } - - public void RunFinished(List testResults) - { - m_Window.SetCurrentTest(null); - m_CurrentTest = null; - EditorApplication.update -= OnEditorUpdate; - EditorApplication.isPlaying = false; - EditorUtility.ClearProgressBar(); - GuiHelper.SetConsoleErrorPause(m_ConsoleErrorOnPauseValue); - PlayerSettings.runInBackground = m_RunInBackground; - } - - public void AllScenesFinished() - { - - } - - public void TestStarted(TestResult test) - { - m_Window.SetCurrentTest(test.TestComponent); - m_CurrentTest = test.TestComponent; - } - - - public void TestFinished(TestResult test) - { - m_CurrentTestNumber++; - - var result = m_Window.m_ResultList.Find(r => r.Id == test.Id); - if (result != null) - result.Update(test); - else - m_Window.m_ResultList.Add(test); - - if(test.IsFailure && m_Window.m_Settings.pauseOnTestFailure) - { - EditorUtility.ClearProgressBar(); - EditorApplication.isPaused = true; - } - } - - public void TestRunInterrupted(List testsNotRun) - { - Debug.Log("Test run interrupted"); - RunFinished(new List()); - } - - private void OnEditorUpdate() - { - if(!EditorApplication.isPlaying) - { - TestRunInterrupted(null); - return; - } - - if (m_Window.m_Settings.blockUIWhenRunning - && m_CurrentTest != null - && !EditorApplication.isPaused - && EditorUtility.DisplayCancelableProgressBar("Integration Test Runner", - "Running " + m_CurrentTest.Name, - (float)m_CurrentTestNumber / m_TestNumber)) - { - TestRunInterrupted(null); - } - } - } - - [MenuItem("Unity Test Tools/Integration Test Runner %#&t")] - public static IntegrationTestsRunnerWindow ShowWindow() - { - var w = GetWindow(typeof(IntegrationTestsRunnerWindow)); - w.Show(); - return w as IntegrationTestsRunnerWindow; - } - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerWindow.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerWindow.cs.meta deleted file mode 100644 index 86b5775e0..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/IntegrationTestsRunnerWindow.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 2c898357efb599944818326bb43ba879 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner.meta deleted file mode 100644 index b7631ee54..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: c44e9167d633ee94bb6e078238178308 -DefaultImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/NetworkResultsReceiver.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/NetworkResultsReceiver.cs deleted file mode 100644 index f3be33805..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/NetworkResultsReceiver.cs +++ /dev/null @@ -1,261 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Net.Sockets; -using UnityEditor; -using UnityEditorInternal; -using UnityEngine; - -namespace UnityTest -{ - [Serializable] - public class NetworkResultsReceiver : EditorWindow - { - public static NetworkResultsReceiver Instance; - - private string m_StatusLabel; - private TcpListener m_Listener; - - [SerializeField] - private PlatformRunnerConfiguration m_Configuration; - - private List m_TestResults = new List(); - - #region steering variables - private bool m_RunFinished; - private bool m_Repaint; - - private TimeSpan m_TestTimeout = TimeSpan.Zero; - private DateTime m_LastMessageReceived; - private bool m_Running; - - public TimeSpan ReceiveMessageTimeout = TimeSpan.FromSeconds(30); - private readonly TimeSpan m_InitialConnectionTimeout = TimeSpan.FromSeconds(300); - private bool m_TestFailed; - #endregion - - private void AcceptCallback(TcpClient client) - { - m_Repaint = true; - ResultDTO dto; - try - { - m_LastMessageReceived = DateTime.Now; - using (var stream = client.GetStream()) - { - var bf = new DTOFormatter(); - dto = (ResultDTO)bf.Deserialize(stream); - stream.Close(); - } - client.Close(); - } - catch (ObjectDisposedException e) - { - Debug.LogException(e); - m_StatusLabel = "Got disconnected"; - return; - } - catch (Exception e) - { - Debug.LogException(e); - return; - } - - switch (dto.messageType) - { - case ResultDTO.MessageType.TestStarted: - m_StatusLabel = dto.testName; - m_TestTimeout = TimeSpan.FromSeconds(dto.testTimeout); - break; - case ResultDTO.MessageType.TestFinished: - m_TestResults.Add(dto.testResult); - m_TestTimeout = TimeSpan.Zero; - if (dto.testResult.Executed && dto.testResult.ResultState != TestResultState.Ignored && !dto.testResult.IsSuccess) - m_TestFailed = true; - break; - case ResultDTO.MessageType.RunStarted: - m_TestResults = new List(); - m_StatusLabel = "Run started: " + dto.loadedLevelName; - break; - case ResultDTO.MessageType.RunFinished: - WriteResultsToLog(dto, m_TestResults); - if (!string.IsNullOrEmpty(m_Configuration.resultsDir)) - { - var platform = m_Configuration.runInEditor ? "Editor" : m_Configuration.buildTarget.ToString(); - var resultWriter = new XmlResultWriter(dto.loadedLevelName, platform, m_TestResults.ToArray()); - try - { - if (!Directory.Exists(m_Configuration.resultsDir)) - { - Directory.CreateDirectory(m_Configuration.resultsDir); - } - var filePath = Path.Combine(m_Configuration.resultsDir, dto.loadedLevelName + ".xml"); - File.WriteAllText(filePath, resultWriter.GetTestResult()); - } - catch (Exception e) - { - Debug.LogException(e); - } - } - break; - case ResultDTO.MessageType.AllScenesFinished: - m_Running = false; - m_RunFinished = true; - break; - case ResultDTO.MessageType.Ping: - break; - } - } - - private void WriteResultsToLog(ResultDTO dto, List list) - { - string result = "Run finished for: " + dto.loadedLevelName; - var failCount = list.Count(t => t.Executed && !t.IsSuccess); - if (failCount == 0) - result += "\nAll tests passed"; - else - result += "\n" + failCount + " tests failed"; - - if (failCount == 0) - Debug.Log(result); - else - Debug.LogWarning(result); - } - - public void Update() - { - if (EditorApplication.isCompiling - && m_Listener != null) - { - m_Running = false; - m_Listener.Stop(); - return; - } - - if (m_Running) - { - try - { - if (m_Listener != null && m_Listener.Pending()) - { - using (var client = m_Listener.AcceptTcpClient()) - { - AcceptCallback(client); - client.Close(); - } - } - } - catch (InvalidOperationException e) - { - m_StatusLabel = "Exception happened: " + e.Message; - Repaint(); - Debug.LogException(e); - } - } - - if (m_Running) - { - var adjustedtestTimeout = m_TestTimeout.Add(m_TestTimeout); - var timeout = ReceiveMessageTimeout > adjustedtestTimeout ? ReceiveMessageTimeout : adjustedtestTimeout; - if ((DateTime.Now - m_LastMessageReceived) > timeout) - { - Debug.LogError("Timeout when waiting for test results"); - m_RunFinished = true; - } - } - if (m_RunFinished) - { - if (InternalEditorUtility.inBatchMode) - EditorApplication.Exit(m_TestFailed ? Batch.returnCodeTestsFailed : Batch.returnCodeTestsOk); - Close(); - } - if (m_Repaint) Repaint(); - } - - public void OnEnable() - { - minSize = new Vector2(300, 100); - titleContent = new GUIContent("Test run monitor"); - Instance = this; - m_StatusLabel = "Initializing..."; - if (EditorApplication.isCompiling) return; - EnableServer(); - } - - private void EnableServer() - { - if (m_Configuration == null) throw new Exception("No result receiver server configuration."); - - var ipAddress = IPAddress.Any; - if (m_Configuration.ipList != null && m_Configuration.ipList.Count == 1) - ipAddress = IPAddress.Parse(m_Configuration.ipList.Single()); - - var ipAddStr = Equals(ipAddress, IPAddress.Any) ? "[All interfaces]" : ipAddress.ToString(); - - m_Listener = new TcpListener(ipAddress, m_Configuration.port); - m_StatusLabel = "Waiting for connection on: " + ipAddStr + ":" + m_Configuration.port; - - try - { - m_Listener.Start(100); - } - catch (SocketException e) - { - m_StatusLabel = "Exception happened: " + e.Message; - Repaint(); - Debug.LogException(e); - } - m_Running = true; - m_LastMessageReceived = DateTime.Now + m_InitialConnectionTimeout; - } - - public void OnDisable() - { - Instance = null; - if (m_Listener != null) - m_Listener.Stop(); - } - - public void OnGUI() - { - EditorGUILayout.LabelField("Status:", EditorStyles.boldLabel); - EditorGUILayout.LabelField(m_StatusLabel); - GUILayout.FlexibleSpace(); - if (GUILayout.Button("Stop")) - { - StopReceiver(); - if (InternalEditorUtility.inBatchMode) - EditorApplication.Exit(Batch.returnCodeRunError); - } - } - - public static void StartReceiver(PlatformRunnerConfiguration configuration) - { - var w = (NetworkResultsReceiver)GetWindow(typeof(NetworkResultsReceiver), false); - w.SetConfiguration(configuration); - if (!EditorApplication.isCompiling) - { - w.EnableServer(); - } - w.Show(true); - } - - private void SetConfiguration(PlatformRunnerConfiguration configuration) - { - m_Configuration = configuration; - } - - public static void StopReceiver() - { - if (Instance == null) return; - try{ - Instance.Close(); - }catch(Exception e){ - Debug.LogException(e); - DestroyImmediate(Instance); - } - } - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/NetworkResultsReceiver.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/NetworkResultsReceiver.cs.meta deleted file mode 100644 index cfc201e59..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/NetworkResultsReceiver.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ade4197221f35dc44adb7649f99af2e7 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunner.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunner.cs deleted file mode 100644 index 2f649b089..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunner.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Net; -using System.Net.Sockets; -using UnityEditor; -using UnityEditorInternal; -using UnityEngine; -using System.Linq; - -namespace UnityTest.IntegrationTests -{ - public class PlatformRunner - { - public static BuildTarget defaultBuildTarget - { - get - { - var target = EditorPrefs.GetString("ITR-platformRunnerBuildTarget"); - BuildTarget buildTarget; - try - { - buildTarget = (BuildTarget)Enum.Parse(typeof(BuildTarget), target); - } - catch - { - return GetDefaultBuildTarget(); - } - return buildTarget; - } - set { EditorPrefs.SetString("ITR-platformRunnerBuildTarget", value.ToString()); } - } - - [MenuItem("Unity Test Tools/Platform Runner/Run current scene %#&r")] - public static void BuildAndRunCurrentScene() - { - Debug.Log("Building and running current test for " + defaultBuildTarget); - BuildAndRunInPlayer(new PlatformRunnerConfiguration(defaultBuildTarget)); - } - - [MenuItem("Unity Test Tools/Platform Runner/Run on platform %#r")] - public static void RunInPlayer() - { - var w = EditorWindow.GetWindow(typeof(PlatformRunnerSettingsWindow)); - w.Show(); - } - - public static void BuildAndRunInPlayer(PlatformRunnerConfiguration configuration) - { - NetworkResultsReceiver.StopReceiver(); - - var settings = new PlayerSettingConfigurator(false); - - if (configuration.sendResultsOverNetwork) - { - try - { - var l = new TcpListener(IPAddress.Any, configuration.port); - l.Start(); - configuration.port = ((IPEndPoint)l.Server.LocalEndPoint).Port; - l.Stop(); - } - catch (SocketException e) - { - Debug.LogException(e); - if (InternalEditorUtility.inBatchMode) - EditorApplication.Exit(Batch.returnCodeRunError); - } - } - - if (InternalEditorUtility.inBatchMode) - settings.AddConfigurationFile(TestRunnerConfigurator.batchRunFileMarker, ""); - - if (configuration.sendResultsOverNetwork) - settings.AddConfigurationFile(TestRunnerConfigurator.integrationTestsNetwork, - string.Join("\n", configuration.GetConnectionIPs())); - - settings.AddConfigurationFile (TestRunnerConfigurator.testScenesToRun, string.Join ("\n", configuration.testScenes.ToArray())); - - settings.ChangeSettingsForIntegrationTests(); - - AssetDatabase.Refresh(); - - var result = BuildPipeline.BuildPlayer(configuration.testScenes.Concat(configuration.buildScenes).ToArray(), - configuration.GetTempPath(), - configuration.buildTarget, - BuildOptions.AutoRunPlayer | BuildOptions.Development); - - settings.RevertSettingsChanges(); - settings.RemoveAllConfigurationFiles(); - - AssetDatabase.Refresh(); - - if (!string.IsNullOrEmpty(result)) - { - if (InternalEditorUtility.inBatchMode) - EditorApplication.Exit(Batch.returnCodeRunError); - return; - } - - if (configuration.sendResultsOverNetwork) - NetworkResultsReceiver.StartReceiver(configuration); - else if (InternalEditorUtility.inBatchMode) - EditorApplication.Exit(Batch.returnCodeTestsOk); - } - - private static BuildTarget GetDefaultBuildTarget() - { - switch (EditorUserBuildSettings.selectedBuildTargetGroup) - { - case BuildTargetGroup.Android: - return BuildTarget.Android; - case BuildTargetGroup.WebPlayer: - return BuildTarget.WebPlayer; - default: - { - switch (Application.platform) - { - case RuntimePlatform.WindowsPlayer: - return BuildTarget.StandaloneWindows; - case RuntimePlatform.OSXPlayer: - return BuildTarget.StandaloneOSXIntel; - case RuntimePlatform.LinuxPlayer: - return BuildTarget.StandaloneLinux; - } - return BuildTarget.WebPlayer; - } - } - } - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunner.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunner.cs.meta deleted file mode 100644 index 5ecced0bb..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunner.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a3581fa3f207a8a4c9988b9f59a510d3 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerConfiguration.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerConfiguration.cs deleted file mode 100644 index 0d67e854a..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerConfiguration.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Net.Sockets; -using UnityEditor; -using UnityEngine; - -[Serializable] -public class PlatformRunnerConfiguration -{ - public List buildScenes; - public List testScenes; - public BuildTarget buildTarget; - public bool runInEditor; - public string projectName = EditorApplication.currentScene; - - public string resultsDir = null; - public bool sendResultsOverNetwork; - public List ipList; - public int port; - - public PlatformRunnerConfiguration(BuildTarget buildTarget) - { - this.buildTarget = buildTarget; - projectName = EditorApplication.currentScene; - } - - public PlatformRunnerConfiguration() - : this(BuildTarget.StandaloneWindows) - { - } - - public string GetTempPath() - { - if (string.IsNullOrEmpty(projectName)) - projectName = Path.GetTempFileName(); - - var path = Path.Combine("Temp", projectName); - switch (buildTarget) - { - case BuildTarget.StandaloneWindows: - case BuildTarget.StandaloneWindows64: - return path + ".exe"; - case BuildTarget.StandaloneOSXIntel: - return path + ".app"; - case BuildTarget.Android: - return path + ".apk"; - default: - if (buildTarget.ToString() == "BlackBerry" || buildTarget.ToString() == "BB10") - return path + ".bar"; - return path; - } - } - - public string[] GetConnectionIPs() - { - return ipList.Select(ip => ip + ":" + port).ToArray(); - } - - public static int TryToGetFreePort() - { - var port = -1; - try - { - var l = new TcpListener(IPAddress.Any, 0); - l.Start(); - port = ((IPEndPoint)l.Server.LocalEndPoint).Port; - l.Stop(); - } - catch (SocketException e) - { - Debug.LogException(e); - } - return port; - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerConfiguration.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerConfiguration.cs.meta deleted file mode 100644 index f747c6e56..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerConfiguration.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b98fe8c3761da2d4b8cfd8bd6df7050f -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettings.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettings.cs deleted file mode 100644 index 8b54c3a88..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettings.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using UnityEngine; - -namespace UnityTest -{ - public class PlatformRunnerSettings : ProjectSettingsBase - { - public string resultsPath; - public bool sendResultsOverNetwork = true; - public int port = 0; - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettings.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettings.cs.meta deleted file mode 100644 index 1cc9a2830..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettings.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 964f5f0db2c95bb41aa3dc3beba1f06b -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettingsWindow.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettingsWindow.cs deleted file mode 100644 index 757968abf..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettingsWindow.cs +++ /dev/null @@ -1,315 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using UnityEditor; -using UnityEngine; -using Object = UnityEngine.Object; - -namespace UnityTest.IntegrationTests -{ - [Serializable] - public class PlatformRunnerSettingsWindow : EditorWindow - { - private BuildTarget m_BuildTarget; - - private List m_IntegrationTestScenes; - private List m_OtherScenesToBuild; - private List m_AllScenesInProject; - - private Vector2 m_ScrollPosition; - private readonly List m_Interfaces = new List(); - private readonly List m_SelectedScenes = new List(); - - private int m_SelectedInterface; - [SerializeField] - private bool m_AdvancedNetworkingSettings; - - private PlatformRunnerSettings m_Settings; - - private string m_SelectedSceneInAll; - private string m_SelectedSceneInTest; - private string m_SelectedSceneInBuild; - - readonly GUIContent m_Label = new GUIContent("Results target directory", "Directory where the results will be saved. If no value is specified, the results will be generated in project's data folder."); - - public PlatformRunnerSettingsWindow() - { - if (m_OtherScenesToBuild == null) - m_OtherScenesToBuild = new List (); - - if (m_IntegrationTestScenes == null) - m_IntegrationTestScenes = new List (); - - titleContent = new GUIContent("Platform runner"); - m_BuildTarget = PlatformRunner.defaultBuildTarget; - position.Set(position.xMin, position.yMin, 200, position.height); - m_AllScenesInProject = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.unity", SearchOption.AllDirectories).ToList(); - m_AllScenesInProject.Sort(); - var currentScene = (Directory.GetCurrentDirectory() + EditorApplication.currentScene).Replace("\\", "").Replace("/", ""); - var currentScenePath = m_AllScenesInProject.Where(s => s.Replace("\\", "").Replace("/", "") == currentScene); - m_SelectedScenes.AddRange(currentScenePath); - - m_Interfaces.Add("(Any)"); - m_Interfaces.AddRange(TestRunnerConfigurator.GetAvailableNetworkIPs()); - m_Interfaces.Add("127.0.0.1"); - - LoadFromPrefereneces (); - } - - public void OnEnable() - { - m_Settings = ProjectSettingsBase.Load(); - - // If not configured pre populate with all scenes that have test components on game objects - // This needs to be done outsie of constructor - if (m_IntegrationTestScenes.Count == 0) - m_IntegrationTestScenes = GetScenesWithTestComponents (m_AllScenesInProject); - } - - public void OnGUI() - { - EditorGUILayout.BeginVertical(); - GUIContent label; - - /* We have three lists here, The tests to run, supporting scenes to include in the build and the list of all scenes so users can - * pick the scenes they want to include. The motiviation here is that test scenes may require to additively load other scenes as part of the tests - */ - EditorGUILayout.BeginHorizontal (); - - // Integration Tests To Run - EditorGUILayout.BeginVertical (); - - label = new GUIContent("Tests:", "All Integration Test scenes that you wish to run on the platform"); - EditorGUILayout.LabelField(label, EditorStyles.boldLabel, GUILayout.Height(20f)); - - EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(m_SelectedSceneInTest)); - if (GUILayout.Button("Remove Integration Test")) { - m_IntegrationTestScenes.Remove(m_SelectedSceneInTest); - m_SelectedSceneInTest = ""; - } - EditorGUI.EndDisabledGroup(); - - DrawVerticalSceneList (ref m_IntegrationTestScenes, ref m_SelectedSceneInTest); - EditorGUILayout.EndVertical (); - - // Extra scenes to include in build - EditorGUILayout.BeginVertical (); - label = new GUIContent("Other Scenes in Build:", "If your Integration Tests additivly load any other scenes then you want to include them here so they are part of the build"); - EditorGUILayout.LabelField(label, EditorStyles.boldLabel, GUILayout.Height(20f)); - - - EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(m_SelectedSceneInBuild)); - if (GUILayout.Button("Remove From Build")) { - m_OtherScenesToBuild.Remove(m_SelectedSceneInBuild); - m_SelectedSceneInBuild = ""; - } - EditorGUI.EndDisabledGroup(); - - DrawVerticalSceneList (ref m_OtherScenesToBuild, ref m_SelectedSceneInBuild); - EditorGUILayout.EndVertical (); - - EditorGUILayout.Separator (); - - // All Scenes - EditorGUILayout.BeginVertical (); - label = new GUIContent("Availble Scenes", "These are all the scenes within your project, please select some to run tests"); - EditorGUILayout.LabelField(label, EditorStyles.boldLabel, GUILayout.Height(20f)); - - - EditorGUILayout.BeginHorizontal (); - EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(m_SelectedSceneInAll)); - if (GUILayout.Button("Add As Test")) { - if (!m_IntegrationTestScenes.Contains (m_SelectedSceneInAll) && !m_OtherScenesToBuild.Contains (m_SelectedSceneInAll)) { - m_IntegrationTestScenes.Add(m_SelectedSceneInAll); - } - } - - if (GUILayout.Button("Add to Build")) { - if (!m_IntegrationTestScenes.Contains (m_SelectedSceneInAll) && !m_OtherScenesToBuild.Contains (m_SelectedSceneInAll)) { - m_OtherScenesToBuild.Add(m_SelectedSceneInAll); - } - } - EditorGUI.EndDisabledGroup(); - - EditorGUILayout.EndHorizontal (); - - DrawVerticalSceneList (ref m_AllScenesInProject, ref m_SelectedSceneInAll); - EditorGUILayout.EndVertical (); - - // ButtoNetworkResultsReceiverns to edit scenes in lists - - - EditorGUILayout.EndHorizontal (); - - GUILayout.Space(3); - - // Select target platform - m_BuildTarget = (BuildTarget)EditorGUILayout.EnumPopup("Build tests for", m_BuildTarget); - - if (PlatformRunner.defaultBuildTarget != m_BuildTarget) - { - if (GUILayout.Button("Make default target platform")) - { - PlatformRunner.defaultBuildTarget = m_BuildTarget; - } - } - GUI.enabled = true; - - // Select various Network settings - DrawSetting(); - var build = GUILayout.Button("Build and run tests"); - EditorGUILayout.EndVertical(); - - if (build) - { - BuildAndRun (); - } - } - - private void DrawVerticalSceneList(ref List sourceList, ref string selectString) - { - m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition, Styles.testList); - EditorGUI.indentLevel++; - foreach (var scenePath in sourceList) - { - var path = Path.GetFileNameWithoutExtension(scenePath); - var guiContent = new GUIContent(path, scenePath); - var rect = GUILayoutUtility.GetRect(guiContent, EditorStyles.label); - if (rect.Contains(Event.current.mousePosition)) - { - if (Event.current.type == EventType.mouseDown && Event.current.button == 0) - { - selectString = scenePath; - Event.current.Use(); - } - } - var style = new GUIStyle(EditorStyles.label); - - if (selectString == scenePath) - style.normal.textColor = new Color(0.3f, 0.5f, 0.85f); - EditorGUI.LabelField(rect, guiContent, style); - } - EditorGUI.indentLevel--; - EditorGUILayout.EndScrollView(); - } - - public static List GetScenesWithTestComponents(List allScenes) - { - List results = EditorReferencesUtil.FindScenesWhichContainAsset("TestComponent.cs"); - List integrationTestScenes = new List(); - - foreach (Object obj in results) { - string result = allScenes.FirstOrDefault(s => s.Contains(obj.name)); - if (!string.IsNullOrEmpty(result)) - integrationTestScenes.Add(result); - } - - return integrationTestScenes; - } - - private void DrawSetting() - { - EditorGUI.BeginChangeCheck(); - - EditorGUILayout.BeginHorizontal(); - m_Settings.resultsPath = EditorGUILayout.TextField(m_Label, m_Settings.resultsPath); - if (GUILayout.Button("Search", EditorStyles.miniButton, GUILayout.Width(50))) - { - var selectedPath = EditorUtility.SaveFolderPanel("Result files destination", m_Settings.resultsPath, ""); - if (!string.IsNullOrEmpty(selectedPath)) - m_Settings.resultsPath = Path.GetFullPath(selectedPath); - } - EditorGUILayout.EndHorizontal(); - - if (!string.IsNullOrEmpty(m_Settings.resultsPath)) - { - Uri uri; - if (!Uri.TryCreate(m_Settings.resultsPath, UriKind.Absolute, out uri) || !uri.IsFile || uri.IsWellFormedOriginalString()) - { - EditorGUILayout.HelpBox("Invalid URI path", MessageType.Warning); - } - } - - m_Settings.sendResultsOverNetwork = EditorGUILayout.Toggle("Send results to editor", m_Settings.sendResultsOverNetwork); - EditorGUI.BeginDisabledGroup(!m_Settings.sendResultsOverNetwork); - m_AdvancedNetworkingSettings = EditorGUILayout.Foldout(m_AdvancedNetworkingSettings, "Advanced network settings"); - if (m_AdvancedNetworkingSettings) - { - m_SelectedInterface = EditorGUILayout.Popup("Network interface", m_SelectedInterface, m_Interfaces.ToArray()); - EditorGUI.BeginChangeCheck(); - m_Settings.port = EditorGUILayout.IntField("Network port", m_Settings.port); - if (EditorGUI.EndChangeCheck()) - { - if (m_Settings.port > IPEndPoint.MaxPort) - m_Settings.port = IPEndPoint.MaxPort; - else if (m_Settings.port < IPEndPoint.MinPort) - m_Settings.port = IPEndPoint.MinPort; - } - EditorGUI.EndDisabledGroup(); - } - if (EditorGUI.EndChangeCheck()) - { - m_Settings.Save(); - } - } - - private void BuildAndRun() - { - SaveToPreferences (); - - var config = new PlatformRunnerConfiguration - { - buildTarget = m_BuildTarget, - buildScenes = m_OtherScenesToBuild, - testScenes = m_IntegrationTestScenes, - projectName = m_IntegrationTestScenes.Count > 1 ? "IntegrationTests" : Path.GetFileNameWithoutExtension(EditorApplication.currentScene), - resultsDir = m_Settings.resultsPath, - sendResultsOverNetwork = m_Settings.sendResultsOverNetwork, - ipList = m_Interfaces.Skip(1).ToList(), - port = m_Settings.port - }; - - if (m_SelectedInterface > 0) - config.ipList = new List {m_Interfaces.ElementAt(m_SelectedInterface)}; - - PlatformRunner.BuildAndRunInPlayer(config); - Close (); - } - - public void OnLostFocus() { - SaveToPreferences (); - } - - public void OnDestroy() { - SaveToPreferences (); - } - - private void SaveToPreferences() - { - EditorPrefs.SetString (Animator.StringToHash (Application.dataPath + "uttTestScenes").ToString (), String.Join (",",m_IntegrationTestScenes.ToArray())); - EditorPrefs.SetString (Animator.StringToHash (Application.dataPath + "uttBuildScenes").ToString (), String.Join (",",m_OtherScenesToBuild.ToArray())); - } - - private void LoadFromPrefereneces() - { - string storedTestScenes = EditorPrefs.GetString (Animator.StringToHash (Application.dataPath + "uttTestScenes").ToString ()); - string storedBuildScenes = EditorPrefs.GetString (Animator.StringToHash (Application.dataPath + "uttBuildScenes").ToString ()); - - List parsedTestScenes = storedTestScenes.Split (',').ToList (); - List parsedBuildScenes = storedBuildScenes.Split (',').ToList (); - - // Sanity check scenes actually exist - foreach (string str in parsedTestScenes) { - if (m_AllScenesInProject.Contains(str)) - m_IntegrationTestScenes.Add(str); - } - - foreach (string str in parsedBuildScenes) { - if (m_AllScenesInProject.Contains(str)) - m_OtherScenesToBuild.Add(str); - } - } - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettingsWindow.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettingsWindow.cs.meta deleted file mode 100644 index 8fed609f2..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettingsWindow.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3819282b0887bc742911b89745080acb -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlayerSettingConfigurator.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlayerSettingConfigurator.cs deleted file mode 100644 index 77aea8147..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlayerSettingConfigurator.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using UnityEditor; -using UnityEngine; - -namespace UnityTest -{ - class PlayerSettingConfigurator - { - private string resourcesPath { - get { return m_Temp ? k_TempPath : m_ProjectResourcesPath; } - } - - private readonly string m_ProjectResourcesPath = Path.Combine("Assets", "Resources"); - const string k_TempPath = "Temp"; - private readonly bool m_Temp; - - private ResolutionDialogSetting m_DisplayResolutionDialog; - private bool m_RunInBackground; - private bool m_FullScreen; - private bool m_ResizableWindow; - private readonly List m_TempFileList = new List(); - - public PlayerSettingConfigurator(bool saveInTempFolder) - { - m_Temp = saveInTempFolder; - } - - public void ChangeSettingsForIntegrationTests() - { - m_DisplayResolutionDialog = PlayerSettings.displayResolutionDialog; - PlayerSettings.displayResolutionDialog = ResolutionDialogSetting.Disabled; - - m_RunInBackground = PlayerSettings.runInBackground; - PlayerSettings.runInBackground = true; - - m_FullScreen = PlayerSettings.defaultIsFullScreen; - PlayerSettings.defaultIsFullScreen = false; - - m_ResizableWindow = PlayerSettings.resizableWindow; - PlayerSettings.resizableWindow = true; - } - - public void RevertSettingsChanges() - { - PlayerSettings.defaultIsFullScreen = m_FullScreen; - PlayerSettings.runInBackground = m_RunInBackground; - PlayerSettings.displayResolutionDialog = m_DisplayResolutionDialog; - PlayerSettings.resizableWindow = m_ResizableWindow; - } - - public void AddConfigurationFile(string fileName, string content) - { - var resourcesPathExists = Directory.Exists(resourcesPath); - if (!resourcesPathExists) AssetDatabase.CreateFolder("Assets", "Resources"); - - var filePath = Path.Combine(resourcesPath, fileName); - File.WriteAllText(filePath, content); - - m_TempFileList.Add(filePath); - } - - public void RemoveAllConfigurationFiles() - { - foreach (var filePath in m_TempFileList) - AssetDatabase.DeleteAsset(filePath); - if (Directory.Exists(resourcesPath) - && Directory.GetFiles(resourcesPath).Length == 0) - AssetDatabase.DeleteAsset(resourcesPath); - } - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlayerSettingConfigurator.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlayerSettingConfigurator.cs.meta deleted file mode 100644 index 732b8be94..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlayerSettingConfigurator.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c7adbe43058d54047b6109b2e66894fd -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer.meta deleted file mode 100644 index ccb3c1438..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 5944b82e46f1682439d20b4c3a4f029c -DefaultImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestGroupLine.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestGroupLine.cs deleted file mode 100644 index a7d86194d..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestGroupLine.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEditor; -using UnityEngine; - -namespace UnityTest -{ - class IntegrationTestGroupLine : IntegrationTestRendererBase - { - public static List FoldMarkers; - private IntegrationTestRendererBase[] m_Children; - - public IntegrationTestGroupLine(GameObject gameObject) : base(gameObject) - { - } - - protected internal override void DrawLine(Rect rect, GUIContent label, bool isSelected, RenderingOptions options) - { - EditorGUI.BeginChangeCheck(); - var isClassFolded = !EditorGUI.Foldout(rect, !Folded, label, isSelected ? Styles.selectedFoldout : Styles.foldout); - if (EditorGUI.EndChangeCheck()) Folded = isClassFolded; - } - - private bool Folded - { - get { return FoldMarkers.Contains(m_GameObject); } - - set - { - if (value) FoldMarkers.Add(m_GameObject); - else FoldMarkers.RemoveAll(s => s == m_GameObject); - } - } - - protected internal override void Render(int indend, RenderingOptions options) - { - base.Render(indend, options); - if (!Folded) - foreach (var child in m_Children) - child.Render(indend + 1, options); - } - - protected internal override TestResult.ResultType GetResult() - { - bool ignored = false; - bool success = false; - foreach (var child in m_Children) - { - var result = child.GetResult(); - - if (result == TestResult.ResultType.Failed || result == TestResult.ResultType.FailedException || result == TestResult.ResultType.Timeout) - return TestResult.ResultType.Failed; - if (result == TestResult.ResultType.Success) - success = true; - else if (result == TestResult.ResultType.Ignored) - ignored = true; - else - ignored = false; - } - if (success) return TestResult.ResultType.Success; - if (ignored) return TestResult.ResultType.Ignored; - return TestResult.ResultType.NotRun; - } - - protected internal override bool IsVisible(RenderingOptions options) - { - return m_Children.Any(c => c.IsVisible(options)); - } - - public override bool SetCurrentTest(TestComponent tc) - { - m_IsRunning = false; - foreach (var child in m_Children) - m_IsRunning |= child.SetCurrentTest(tc); - return m_IsRunning; - } - - public void AddChildren(IntegrationTestRendererBase[] parseTestList) - { - m_Children = parseTestList; - } - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestGroupLine.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestGroupLine.cs.meta deleted file mode 100644 index 00510641e..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestGroupLine.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f6dc74195aa98ef4da8901199cda4a63 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestLine.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestLine.cs deleted file mode 100644 index e0b5d1ac6..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestLine.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEditor; -using UnityEngine; - -namespace UnityTest -{ - class IntegrationTestLine : IntegrationTestRendererBase - { - public static List Results; - protected TestResult m_Result; - - public IntegrationTestLine(GameObject gameObject, TestResult testResult) : base(gameObject) - { - m_Result = testResult; - } - - protected internal override void DrawLine(Rect rect, GUIContent label, bool isSelected, RenderingOptions options) - { - if(Event.current.type != EventType.repaint) - return; - - Styles.testName.Draw (rect, label, false, false, false, isSelected); - - if (m_Result.IsTimeout) - { - float min, max; - Styles.testName.CalcMinMaxWidth(label, out min, out max); - var timeoutRect = new Rect(rect); - timeoutRect.x += min - 12; - Styles.testName.Draw(timeoutRect, s_GUITimeoutIcon, false, false, false, isSelected); - } - } - - protected internal override TestResult.ResultType GetResult() - { - if (!m_Result.Executed && test.ignored) return TestResult.ResultType.Ignored; - return m_Result.resultType; - } - - protected internal override bool IsVisible(RenderingOptions options) - { - if (!string.IsNullOrEmpty(options.nameFilter) && !m_GameObject.name.ToLower().Contains(options.nameFilter.ToLower())) return false; - if (!options.showSucceeded && m_Result.IsSuccess) return false; - if (!options.showFailed && m_Result.IsFailure) return false; - if (!options.showNotRunned && !m_Result.Executed) return false; - if (!options.showIgnored && test.ignored) return false; - return true; - } - - public override bool SetCurrentTest(TestComponent tc) - { - m_IsRunning = test == tc; - return m_IsRunning; - } - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestLine.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestLine.cs.meta deleted file mode 100644 index 25c9f1126..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestLine.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 212be02e4a7da194688b08ab0c946fbd -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestRendererBase.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestRendererBase.cs deleted file mode 100644 index 5b0269874..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestRendererBase.cs +++ /dev/null @@ -1,161 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEditor; -using UnityEngine; -using Object = UnityEngine.Object; - -namespace UnityTest -{ - public abstract class IntegrationTestRendererBase : IComparable - { - public static Action> RunTest; - - protected static bool s_Refresh; - - private static readonly GUIContent k_GUIRunSelected = new GUIContent("Run Selected"); - private static readonly GUIContent k_GUIRun = new GUIContent("Run"); - private static readonly GUIContent k_GUIDelete = new GUIContent("Delete"); - private static readonly GUIContent k_GUIDeleteSelected = new GUIContent("Delete selected"); - - protected static GUIContent s_GUITimeoutIcon = new GUIContent(Icons.StopwatchImg, "Timeout"); - - protected GameObject m_GameObject; - public TestComponent test; - private readonly string m_Name; - - protected IntegrationTestRendererBase(GameObject gameObject) - { - test = gameObject.GetComponent(typeof(TestComponent)) as TestComponent; - if (test == null) throw new ArgumentException("Provided GameObject is not a test object"); - m_GameObject = gameObject; - m_Name = test.Name; - } - - public int CompareTo(IntegrationTestRendererBase other) - { - return test.CompareTo(other.test); - } - - public bool Render(RenderingOptions options) - { - s_Refresh = false; - EditorGUIUtility.SetIconSize(new Vector2(15, 15)); - Render(0, options); - EditorGUIUtility.SetIconSize(Vector2.zero); - return s_Refresh; - } - - protected internal virtual void Render(int indend, RenderingOptions options) - { - if (!IsVisible(options)) return; - EditorGUILayout.BeginHorizontal(); - GUILayout.Space(indend * 10); - - var tempColor = GUI.color; - if (m_IsRunning) - { - var frame = Mathf.Abs(Mathf.Cos(Time.realtimeSinceStartup * 4)) * 0.6f + 0.4f; - GUI.color = new Color(1, 1, 1, frame); - } - - var isSelected = Selection.gameObjects.Contains(m_GameObject); - - var value = GetResult(); - var icon = GetIconForResult(value); - - var label = new GUIContent(m_Name, icon); - var labelRect = GUILayoutUtility.GetRect(label, EditorStyles.label, GUILayout.ExpandWidth(true), GUILayout.Height(18)); - - OnLeftMouseButtonClick(labelRect); - OnContextClick(labelRect); - DrawLine(labelRect, label, isSelected, options); - - if (m_IsRunning) GUI.color = tempColor; - EditorGUILayout.EndHorizontal(); - } - - protected void OnSelect() - { - if (!Event.current.control && !Event.current.command) - { - Selection.objects = new Object[0]; - GUIUtility.keyboardControl = 0; - } - - if ((Event.current.control || Event.current.command) && Selection.gameObjects.Contains(test.gameObject)) - Selection.objects = Selection.gameObjects.Where(o => o != test.gameObject).ToArray(); - else - Selection.objects = Selection.gameObjects.Concat(new[] { test.gameObject }).ToArray(); - } - - protected void OnLeftMouseButtonClick(Rect rect) - { - if (rect.Contains(Event.current.mousePosition) && Event.current.type == EventType.mouseDown && Event.current.button == 0) - { - rect.width = 20; - if (rect.Contains(Event.current.mousePosition)) return; - Event.current.Use(); - OnSelect(); - } - } - - protected void OnContextClick(Rect rect) - { - if (rect.Contains(Event.current.mousePosition) && Event.current.type == EventType.ContextClick) - { - DrawContextMenu(test); - } - } - - public static void DrawContextMenu(TestComponent testComponent) - { - if (EditorApplication.isPlayingOrWillChangePlaymode) return; - - var selectedTests = Selection.gameObjects.Where(go => go.GetComponent(typeof(TestComponent))); - var manySelected = selectedTests.Count() > 1; - - var m = new GenericMenu(); - if (manySelected) - { - // var testsToRun - m.AddItem(k_GUIRunSelected, false, data => RunTest(selectedTests.Select(o => o.GetComponent(typeof(TestComponent))).Cast().ToList()), null); - } - m.AddItem(k_GUIRun, false, data => RunTest(new[] { testComponent }), null); - m.AddSeparator(""); - m.AddItem(manySelected ? k_GUIDeleteSelected : k_GUIDelete, false, data => RemoveTests(selectedTests.ToArray()), null); - m.ShowAsContext(); - } - - private static void RemoveTests(GameObject[] testsToDelete) - { - foreach (var t in testsToDelete) - { - Undo.DestroyObjectImmediate(t); - } - } - - public static Texture GetIconForResult(TestResult.ResultType resultState) - { - switch (resultState) - { - case TestResult.ResultType.Success: - return Icons.SuccessImg; - case TestResult.ResultType.Timeout: - case TestResult.ResultType.Failed: - case TestResult.ResultType.FailedException: - return Icons.FailImg; - case TestResult.ResultType.Ignored: - return Icons.IgnoreImg; - default: - return Icons.UnknownImg; - } - } - - protected internal bool m_IsRunning; - protected internal abstract void DrawLine(Rect rect, GUIContent label, bool isSelected, RenderingOptions options); - protected internal abstract TestResult.ResultType GetResult(); - protected internal abstract bool IsVisible(RenderingOptions options); - public abstract bool SetCurrentTest(TestComponent tc); - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestRendererBase.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestRendererBase.cs.meta deleted file mode 100644 index 1fb186ec8..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestRendererBase.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 604645a3b57179a4d873906b625ef8ec -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/RenderingOptions.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/RenderingOptions.cs deleted file mode 100644 index 5d16efc3b..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/RenderingOptions.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - public class RenderingOptions - { - public string nameFilter; - public bool showSucceeded; - public bool showFailed; - public bool showIgnored; - public bool showNotRunned; - public string[] categories; - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/RenderingOptions.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/RenderingOptions.cs.meta deleted file mode 100644 index 6ecfc38cd..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/RenderingOptions.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5c0aec4b4a6d1b047a98e8cc213e1a36 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/TestComponentEditor.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/TestComponentEditor.cs deleted file mode 100644 index 8502eca4f..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/TestComponentEditor.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEditor; -using UnityEngine; -using Object = UnityEngine.Object; - -namespace UnityTest -{ - [CanEditMultipleObjects] - [CustomEditor(typeof(TestComponent))] - public class TestComponentEditor : Editor - { - private SerializedProperty m_ExpectException; - private SerializedProperty m_ExpectedExceptionList; - private SerializedProperty m_Ignored; - private SerializedProperty m_SucceedAssertions; - private SerializedProperty m_SucceedWhenExceptionIsThrown; - private SerializedProperty m_Timeout; - - #region GUI Contens - - private readonly GUIContent m_GUIExpectException = new GUIContent("Expect exception", "Should the test expect an exception"); - private readonly GUIContent m_GUIExpectExceptionList = new GUIContent("Expected exception list", "A comma separated list of exception types which will not fail the test when thrown"); - private readonly GUIContent m_GUIIgnore = new GUIContent("Ignore", "Ignore the tests in runs"); - private readonly GUIContent m_GUIIncludePlatforms = new GUIContent("Included platforms", "Platform on which the test should run"); - private readonly GUIContent m_GUISuccedOnAssertions = new GUIContent("Succeed on assertions", "Succeed after all assertions are executed"); - private readonly GUIContent m_GUISucceedWhenExceptionIsThrown = new GUIContent("Succeed when exception is thrown", "Should the test succeed when an expected exception is thrown"); - private readonly GUIContent m_GUITestName = new GUIContent("Test name", "Name of the test (is equal to the GameObject name)"); - private readonly GUIContent m_GUITimeout = new GUIContent("Timeout", "Number of seconds after which the test will timeout"); - - #endregion - - public void OnEnable() - { - m_Timeout = serializedObject.FindProperty("timeout"); - m_Ignored = serializedObject.FindProperty("ignored"); - m_SucceedAssertions = serializedObject.FindProperty("succeedAfterAllAssertionsAreExecuted"); - m_ExpectException = serializedObject.FindProperty("expectException"); - m_ExpectedExceptionList = serializedObject.FindProperty("expectedExceptionList"); - m_SucceedWhenExceptionIsThrown = serializedObject.FindProperty("succeedWhenExceptionIsThrown"); - } - - public override void OnInspectorGUI() - { - var component = (TestComponent)target; - - if (component.dynamic) - { - if(GUILayout.Button("Reload dynamic tests")) - { - TestComponent.DestroyAllDynamicTests(); - Selection.objects = new Object[0]; - IntegrationTestsRunnerWindow.selectedInHierarchy = false; - GUIUtility.ExitGUI(); - return; - } - EditorGUILayout.HelpBox("This is a test generated from code. No changes in the component will be persisted.", MessageType.Info); - } - - if (component.IsTestGroup()) - { - EditorGUI.BeginChangeCheck(); - var newGroupName = EditorGUILayout.TextField(m_GUITestName, component.name); - if (EditorGUI.EndChangeCheck()) component.name = newGroupName; - - serializedObject.ApplyModifiedProperties(); - return; - } - - serializedObject.Update(); - - EditorGUI.BeginDisabledGroup(serializedObject.isEditingMultipleObjects); - - EditorGUI.BeginChangeCheck(); - var newName = EditorGUILayout.TextField(m_GUITestName, component.name); - if (EditorGUI.EndChangeCheck()) component.name = newName; - - if (component.platformsToIgnore == null) - { - component.platformsToIgnore = GetListOfIgnoredPlatforms(Enum.GetNames(typeof(TestComponent.IncludedPlatforms)), (int)component.includedPlatforms); - } - - var enumList = Enum.GetNames(typeof(RuntimePlatform)); - var flags = GetFlagList(enumList, component.platformsToIgnore); - flags = EditorGUILayout.MaskField(m_GUIIncludePlatforms, flags, enumList, EditorStyles.popup); - var newList = GetListOfIgnoredPlatforms(enumList, flags); - if (!component.dynamic) - component.platformsToIgnore = newList; - EditorGUI.EndDisabledGroup(); - - EditorGUILayout.PropertyField(m_Timeout, m_GUITimeout); - EditorGUILayout.PropertyField(m_Ignored, m_GUIIgnore); - EditorGUILayout.PropertyField(m_SucceedAssertions, m_GUISuccedOnAssertions); - EditorGUILayout.PropertyField(m_ExpectException, m_GUIExpectException); - - EditorGUI.BeginDisabledGroup(!m_ExpectException.boolValue); - EditorGUILayout.PropertyField(m_ExpectedExceptionList, m_GUIExpectExceptionList); - EditorGUILayout.PropertyField(m_SucceedWhenExceptionIsThrown, m_GUISucceedWhenExceptionIsThrown); - EditorGUI.EndDisabledGroup(); - - if (!component.dynamic) - serializedObject.ApplyModifiedProperties(); - if(GUI.changed) - EditorApplication.MarkSceneDirty(); - } - - private string[] GetListOfIgnoredPlatforms(string[] enumList, int flags) - { - var notSelectedPlatforms = new List(); - for (int i = 0; i < enumList.Length; i++) - { - var sel = (flags & (1 << i)) != 0; - if (!sel) notSelectedPlatforms.Add(enumList[i]); - } - return notSelectedPlatforms.ToArray(); - } - - private int GetFlagList(string[] enumList, string[] platformsToIgnore) - { - int flags = ~0; - for (int i = 0; i < enumList.Length; i++) - if (platformsToIgnore != null && platformsToIgnore.Any(s => s == enumList[i])) - flags &= ~(1 << i); - return flags; - } - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/TestComponentEditor.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/TestComponentEditor.cs.meta deleted file mode 100644 index e3a1348aa..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/TestComponentEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 160889f21f4d5944b9f6fcaf9c33f684 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/ITestRunnerCallback.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/ITestRunnerCallback.cs deleted file mode 100644 index c74dab9db..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/ITestRunnerCallback.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest.IntegrationTestRunner -{ - public interface ITestRunnerCallback - { - void RunStarted(string platform, List testsToRun); - void RunFinished(List testResults); - void AllScenesFinished(); - void TestStarted(TestResult test); - void TestFinished(TestResult test); - void TestRunInterrupted(List testsNotRun); - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/ITestRunnerCallback.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/ITestRunnerCallback.cs.meta deleted file mode 100644 index 3a1c54bd5..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/ITestRunnerCallback.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 35af7d395e501a348ae1a0aa3c91dee4 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTest.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTest.cs deleted file mode 100644 index de0e6d18c..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTest.cs +++ /dev/null @@ -1,176 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using UnityEngine; - -public static class IntegrationTest -{ - public const string passMessage = "IntegrationTest Pass"; - public const string failMessage = "IntegrationTest Fail"; - - public static void Pass() - { - LogResult(passMessage); - } - - public static void Pass(GameObject go) - { - LogResult(go, passMessage); - } - - public static void Fail(string reason) - { - Fail(); - if (!string.IsNullOrEmpty(reason)) Debug.Log(reason); - } - - public static void Fail(GameObject go, string reason) - { - Fail(go); - if (!string.IsNullOrEmpty(reason)) Debug.Log(reason); - } - - public static void Fail() - { - LogResult(failMessage); - } - - public static void Fail(GameObject go) - { - LogResult(go, failMessage); - } - - public static void Assert(bool condition) - { - Assert(condition, ""); - } - - public static void Assert(GameObject go, bool condition) - { - Assert(go, condition, ""); - } - - public static void Assert(bool condition, string message) - { - if (!condition) - Fail(message); - } - - public static void Assert(GameObject go, bool condition, string message) - { - if (!condition) - Fail(go, message); - } - - private static void LogResult(string message) - { - Debug.Log(message); - } - - private static void LogResult(GameObject go, string message) - { - Debug.Log(message + " (" + FindTestObject(go).name + ")", go); - } - - private static GameObject FindTestObject(GameObject go) - { - var temp = go; - while (temp.transform.parent != null) - { - if (temp.GetComponent("TestComponent") != null) - return temp; - temp = temp.transform.parent.gameObject; - } - return go; - } - - #region Dynamic test attributes - - [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] - public class ExcludePlatformAttribute : Attribute - { - public string[] platformsToExclude; - - public ExcludePlatformAttribute(params RuntimePlatform[] platformsToExclude) - { - this.platformsToExclude = platformsToExclude.Select(platform => platform.ToString()).ToArray(); - } - } - - [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] - public class ExpectExceptions : Attribute - { - public string[] exceptionTypeNames; - public bool succeedOnException; - - public ExpectExceptions() : this(false) - { - } - - public ExpectExceptions(bool succeedOnException) : this(succeedOnException, new string[0]) - { - } - - public ExpectExceptions(bool succeedOnException, params string[] exceptionTypeNames) - { - this.succeedOnException = succeedOnException; - this.exceptionTypeNames = exceptionTypeNames; - } - - public ExpectExceptions(bool succeedOnException, params Type[] exceptionTypes) - : this(succeedOnException, exceptionTypes.Select(type => type.FullName).ToArray()) - { - } - - public ExpectExceptions(params string[] exceptionTypeNames) : this(false, exceptionTypeNames) - { - } - - public ExpectExceptions(params Type[] exceptionTypes) : this(false, exceptionTypes) - { - } - } - - [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] - public class IgnoreAttribute : Attribute - { - } - - [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] - public class DynamicTestAttribute : Attribute - { - private readonly string m_SceneName; - - public DynamicTestAttribute(string sceneName) - { - if (sceneName.EndsWith(".unity")) - sceneName = sceneName.Substring(0, sceneName.Length - ".unity".Length); - m_SceneName = sceneName; - } - - public bool IncludeOnScene(string sceneName) - { - var fileName = Path.GetFileNameWithoutExtension(sceneName); - return fileName == m_SceneName; - } - } - - [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] - public class SucceedWithAssertions : Attribute - { - } - - [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] - public class TimeoutAttribute : Attribute - { - public float timeout; - - public TimeoutAttribute(float seconds) - { - timeout = seconds; - } - } - - #endregion -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTest.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTest.cs.meta deleted file mode 100644 index b6974b87f..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTest.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: eb367bbc76e489443a4ebc8b0a8642f4 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTestAttribute.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTestAttribute.cs deleted file mode 100644 index 9ca4e45f2..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTestAttribute.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using UnityEngine; - -[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] -public class IntegrationTestAttribute : Attribute -{ - private readonly string m_Path; - - public IntegrationTestAttribute(string path) - { - if (path.EndsWith(".unity")) - path = path.Substring(0, path.Length - ".unity".Length); - m_Path = path; - } - - public bool IncludeOnScene(string scenePath) - { - if (scenePath == m_Path) return true; - var fileName = Path.GetFileNameWithoutExtension(scenePath); - return fileName == m_Path; - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTestAttribute.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTestAttribute.cs.meta deleted file mode 100644 index 1c80721e8..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTestAttribute.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f1a5c61a06ed66e41a6ee1b5f88b5afd -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTestsProvider.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTestsProvider.cs deleted file mode 100644 index c38d3c46f..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTestsProvider.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace UnityTest.IntegrationTestRunner -{ - class IntegrationTestsProvider - { - internal Dictionary> testCollection = new Dictionary>(); - internal ITestComponent currentTestGroup; - internal IEnumerable testToRun; - - public IntegrationTestsProvider(IEnumerable tests) - { - testToRun = tests; - foreach (var test in tests.OrderBy(component => component)) - { - if (test.IsTestGroup()) - { - throw new Exception(test.Name + " is test a group"); - } - AddTestToList(test); - } - if (currentTestGroup == null) - { - currentTestGroup = FindInnerTestGroup(TestComponent.NullTestComponent); - } - } - - private void AddTestToList(ITestComponent test) - { - var group = test.GetTestGroup(); - if (!testCollection.ContainsKey(group)) - testCollection.Add(group, new HashSet()); - testCollection[group].Add(test); - if (group == TestComponent.NullTestComponent) return; - AddTestToList(group); - } - - public ITestComponent GetNextTest() - { - var test = testCollection[currentTestGroup].First(); - testCollection[currentTestGroup].Remove(test); - test.EnableTest(true); - return test; - } - - public void FinishTest(ITestComponent test) - { - try - { - test.EnableTest(false); - currentTestGroup = FindNextTestGroup(currentTestGroup); - } - catch (MissingReferenceException e) - { - Debug.LogException(e); - } - } - - private ITestComponent FindNextTestGroup(ITestComponent testGroup) - { - if (testGroup == null) - throw new Exception ("No test left"); - - if (testCollection[testGroup].Any()) - { - testGroup.EnableTest(true); - return FindInnerTestGroup(testGroup); - } - testCollection.Remove(testGroup); - testGroup.EnableTest(false); - - var parentTestGroup = testGroup.GetTestGroup(); - if (parentTestGroup == null) return null; - - testCollection[parentTestGroup].Remove(testGroup); - return FindNextTestGroup(parentTestGroup); - } - - private ITestComponent FindInnerTestGroup(ITestComponent group) - { - var innerGroups = testCollection[group]; - foreach (var innerGroup in innerGroups) - { - if (!innerGroup.IsTestGroup()) continue; - innerGroup.EnableTest(true); - return FindInnerTestGroup(innerGroup); - } - return group; - } - - public bool AnyTestsLeft() - { - return testCollection.Count != 0; - } - - public List GetRemainingTests() - { - var remainingTests = new List(); - foreach (var test in testCollection) - { - remainingTests.AddRange(test.Value); - } - return remainingTests; - } - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTestsProvider.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTestsProvider.cs.meta deleted file mode 100644 index d444629a5..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTestsProvider.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 21d32637b19ee51489062a66ad922193 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/NetworkResultSender.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/NetworkResultSender.cs deleted file mode 100644 index 16145c095..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/NetworkResultSender.cs +++ /dev/null @@ -1,112 +0,0 @@ -#if !UNITY_METRO && (UNITY_PRO_LICENSE || !(UNITY_ANDROID || UNITY_IPHONE)) -#define UTT_SOCKETS_SUPPORTED -#endif -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityTest.IntegrationTestRunner; - -#if UTT_SOCKETS_SUPPORTED -using System.Net.Sockets; -using System.Runtime.Serialization.Formatters.Binary; -#endif - -namespace UnityTest -{ - public class NetworkResultSender : ITestRunnerCallback - { -#if UTT_SOCKETS_SUPPORTED - private readonly TimeSpan m_ConnectionTimeout = TimeSpan.FromSeconds(5); - - private readonly string m_Ip; - private readonly int m_Port; -#endif - private bool m_LostConnection; - - public NetworkResultSender(string ip, int port) - { -#if UTT_SOCKETS_SUPPORTED - m_Ip = ip; - m_Port = port; -#endif - } - - private bool SendDTO(ResultDTO dto) - { - if (m_LostConnection) return false; -#if UTT_SOCKETS_SUPPORTED - try - { - using (var tcpClient = new TcpClient()) - { - var result = tcpClient.BeginConnect(m_Ip, m_Port, null, null); - var success = result.AsyncWaitHandle.WaitOne(m_ConnectionTimeout); - if (!success) - { - return false; - } - try - { - tcpClient.EndConnect(result); - } - catch (SocketException) - { - m_LostConnection = true; - return false; - } - - var bf = new DTOFormatter(); - bf.Serialize(tcpClient.GetStream(), dto); - tcpClient.GetStream().Close(); - tcpClient.Close(); - Debug.Log("Sent " + dto.messageType); - } - } - catch (SocketException e) - { - Debug.LogException(e); - m_LostConnection = true; - return false; - } -#endif // if UTT_SOCKETS_SUPPORTED - return true; - } - - public bool Ping() - { - var result = SendDTO(ResultDTO.CreatePing()); - m_LostConnection = false; - return result; - } - - public void RunStarted(string platform, List testsToRun) - { - SendDTO(ResultDTO.CreateRunStarted()); - } - - public void RunFinished(List testResults) - { - SendDTO(ResultDTO.CreateRunFinished(testResults)); - } - - public void TestStarted(TestResult test) - { - SendDTO(ResultDTO.CreateTestStarted(test)); - } - - public void TestFinished(TestResult test) - { - SendDTO(ResultDTO.CreateTestFinished(test)); - } - - public void AllScenesFinished() - { - SendDTO (ResultDTO.CreateAllScenesFinished ()); - } - - public void TestRunInterrupted(List testsNotRun) - { - RunFinished(new List()); - } - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/NetworkResultSender.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/NetworkResultSender.cs.meta deleted file mode 100644 index 2ed06e133..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/NetworkResultSender.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 80b91644bbbc487479429368d4e8d596 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/ResultDTO.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/ResultDTO.cs deleted file mode 100644 index 40224e4b8..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/ResultDTO.cs +++ /dev/null @@ -1,167 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - [Serializable] - public class ResultDTO - { - public MessageType messageType; - public int levelCount; - public int loadedLevel; - public string loadedLevelName; - public string testName; - public float testTimeout; - public ITestResult testResult; - - private ResultDTO(MessageType messageType) - { - this.messageType = messageType; - levelCount = Application.levelCount; - loadedLevel = Application.loadedLevel; - loadedLevelName = Application.loadedLevelName; - } - - public enum MessageType : byte - { - Ping, - RunStarted, - RunFinished, - TestStarted, - TestFinished, - RunInterrupted, - AllScenesFinished - } - - public static ResultDTO CreatePing() - { - var dto = new ResultDTO(MessageType.Ping); - return dto; - } - - public static ResultDTO CreateRunStarted() - { - var dto = new ResultDTO(MessageType.RunStarted); - return dto; - } - - public static ResultDTO CreateRunFinished(List testResults) - { - var dto = new ResultDTO(MessageType.RunFinished); - return dto; - } - - public static ResultDTO CreateTestStarted(TestResult test) - { - var dto = new ResultDTO(MessageType.TestStarted); - dto.testName = test.FullName; - dto.testTimeout = test.TestComponent.timeout; - return dto; - } - - public static ResultDTO CreateTestFinished(TestResult test) - { - var dto = new ResultDTO(MessageType.TestFinished); - dto.testName = test.FullName; - dto.testResult = GetSerializableTestResult(test); - return dto; - } - - public static ResultDTO CreateAllScenesFinished() - { - var dto = new ResultDTO(MessageType.AllScenesFinished); - return dto; - } - - private static ITestResult GetSerializableTestResult(TestResult test) - { - var str = new SerializableTestResult(); - - str.resultState = test.ResultState; - str.message = test.messages; - str.executed = test.Executed; - str.name = test.Name; - str.fullName = test.FullName; - str.id = test.id; - str.isSuccess = test.IsSuccess; - str.duration = test.duration; - str.stackTrace = test.stacktrace; - str.isIgnored = test.IsIgnored; - - return str; - } - } - - #region SerializableTestResult - [Serializable] - internal class SerializableTestResult : ITestResult - { - public TestResultState resultState; - public string message; - public bool executed; - public string name; - public string fullName; - public string id; - public bool isSuccess; - public double duration; - public string stackTrace; - public bool isIgnored; - - public TestResultState ResultState - { - get { return resultState; } - } - - public string Message - { - get { return message; } - } - - public string Logs - { - get { return null; } - } - - public bool Executed - { - get { return executed; } - } - - public string Name - { - get { return name; } - } - - public string FullName - { - get { return fullName; } - } - - public string Id - { - get { return id; } - } - - public bool IsSuccess - { - get { return isSuccess; } - } - - public double Duration - { - get { return duration; } - } - - public string StackTrace - { - get { return stackTrace; } - } - - public bool IsIgnored - { - get { return isIgnored; } - } - } - #endregion -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/ResultDTO.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/ResultDTO.cs.meta deleted file mode 100644 index e34e61ff4..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/ResultDTO.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 37c772b6d1ba4274aa96c83710cb27e8 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestComponent.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestComponent.cs deleted file mode 100644 index b083674e8..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestComponent.cs +++ /dev/null @@ -1,411 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using UnityEngine; - -#if UNITY_EDITOR -using UnityEditor; -#endif - -namespace UnityTest -{ - public interface ITestComponent : IComparable - { - void EnableTest(bool enable); - bool IsTestGroup(); - GameObject gameObject { get; } - string Name { get; } - ITestComponent GetTestGroup(); - bool IsExceptionExpected(string exceptionType); - bool ShouldSucceedOnException(); - double GetTimeout(); - bool IsIgnored(); - bool ShouldSucceedOnAssertions(); - bool IsExludedOnThisPlatform(); - } - - public class TestComponent : MonoBehaviour, ITestComponent - { - public static ITestComponent NullTestComponent = new NullTestComponentImpl(); - - public float timeout = 5; - public bool ignored = false; - public bool succeedAfterAllAssertionsAreExecuted = false; - public bool expectException = false; - public string expectedExceptionList = ""; - public bool succeedWhenExceptionIsThrown = false; - public IncludedPlatforms includedPlatforms = (IncludedPlatforms) ~0L; - public string[] platformsToIgnore = null; - - public bool dynamic; - public string dynamicTypeName; - - public bool IsExludedOnThisPlatform() - { - return platformsToIgnore != null && platformsToIgnore.Any(platform => platform == Application.platform.ToString()); - } - - static bool IsAssignableFrom(Type a, Type b) - { -#if !UNITY_METRO - return a.IsAssignableFrom(b); -#else - return false; -#endif - } - - public bool IsExceptionExpected(string exception) - { - exception = exception.Trim(); - if (!expectException) - return false; - if(string.IsNullOrEmpty(expectedExceptionList.Trim())) - return true; - foreach (var expectedException in expectedExceptionList.Split(',').Select(e => e.Trim())) - { - if (exception == expectedException) - return true; - var exceptionType = Type.GetType(exception) ?? GetTypeByName(exception); - var expectedExceptionType = Type.GetType(expectedException) ?? GetTypeByName(expectedException); - if (exceptionType != null && expectedExceptionType != null && IsAssignableFrom(expectedExceptionType, exceptionType)) - return true; - } - return false; - } - - public bool ShouldSucceedOnException() - { - return succeedWhenExceptionIsThrown; - } - - public double GetTimeout() - { - return timeout; - } - - public bool IsIgnored() - { - return ignored; - } - - public bool ShouldSucceedOnAssertions() - { - return succeedAfterAllAssertionsAreExecuted; - } - - private static Type GetTypeByName(string className) - { -#if !UNITY_METRO - return AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes()).FirstOrDefault(type => type.Name == className); -#else - return null; -#endif - } - - public void OnValidate() - { - if (timeout < 0.01f) timeout = 0.01f; - } - - // Legacy - [Flags] - public enum IncludedPlatforms - { - WindowsEditor = 1 << 0, - OSXEditor = 1 << 1, - WindowsPlayer = 1 << 2, - OSXPlayer = 1 << 3, - LinuxPlayer = 1 << 4, - MetroPlayerX86 = 1 << 5, - MetroPlayerX64 = 1 << 6, - MetroPlayerARM = 1 << 7, - WindowsWebPlayer = 1 << 8, - OSXWebPlayer = 1 << 9, - Android = 1 << 10, -// ReSharper disable once InconsistentNaming - IPhonePlayer = 1 << 11, - TizenPlayer = 1 << 12, - WP8Player = 1 << 13, - BB10Player = 1 << 14, - NaCl = 1 << 15, - PS3 = 1 << 16, - XBOX360 = 1 << 17, - WiiPlayer = 1 << 18, - PSP2 = 1 << 19, - PS4 = 1 << 20, - PSMPlayer = 1 << 21, - XboxOne = 1 << 22, - } - - #region ITestComponent implementation - - public void EnableTest(bool enable) - { - if (enable && dynamic) - { - Type t = Type.GetType(dynamicTypeName); - var s = gameObject.GetComponent(t) as MonoBehaviour; - if (s != null) - DestroyImmediate(s); - - gameObject.AddComponent(t); - } - - if (gameObject.activeSelf != enable) gameObject.SetActive(enable); - } - - public int CompareTo(ITestComponent obj) - { - if (obj == NullTestComponent) - return 1; - var result = gameObject.name.CompareTo(obj.gameObject.name); - if (result == 0) - result = gameObject.GetInstanceID().CompareTo(obj.gameObject.GetInstanceID()); - return result; - } - - public bool IsTestGroup() - { - for (int i = 0; i < gameObject.transform.childCount; i++) - { - var childTc = gameObject.transform.GetChild(i).GetComponent(typeof(TestComponent)); - if (childTc != null) - return true; - } - return false; - } - - public string Name { get { return gameObject == null ? "" : gameObject.name; } } - - public ITestComponent GetTestGroup() - { - var parent = gameObject.transform.parent; - if (parent == null) - return NullTestComponent; - return parent.GetComponent(); - } - - public override bool Equals(object o) - { - if (o is TestComponent) - return this == (o as TestComponent); - return false; - } - - public override int GetHashCode() - { - return base.GetHashCode(); - } - - public static bool operator ==(TestComponent a, TestComponent b) - { - if (ReferenceEquals(a, b)) - return true; - if (((object)a == null) || ((object)b == null)) - return false; - if (a.dynamic && b.dynamic) - return a.dynamicTypeName == b.dynamicTypeName; - if (a.dynamic || b.dynamic) - return false; - return a.gameObject == b.gameObject; - } - - public static bool operator !=(TestComponent a, TestComponent b) - { - return !(a == b); - } - - #endregion - - #region Static helpers - - public static TestComponent CreateDynamicTest(Type type) - { - var go = CreateTest(type.Name); - go.hideFlags |= HideFlags.DontSave; - go.SetActive(false); - - var tc = go.GetComponent(); - tc.dynamic = true; - tc.dynamicTypeName = type.AssemblyQualifiedName; - -#if !UNITY_METRO - foreach (var typeAttribute in type.GetCustomAttributes(false)) - { - if (typeAttribute is IntegrationTest.TimeoutAttribute) - tc.timeout = (typeAttribute as IntegrationTest.TimeoutAttribute).timeout; - else if (typeAttribute is IntegrationTest.IgnoreAttribute) - tc.ignored = true; - else if (typeAttribute is IntegrationTest.SucceedWithAssertions) - tc.succeedAfterAllAssertionsAreExecuted = true; - else if (typeAttribute is IntegrationTest.ExcludePlatformAttribute) - tc.platformsToIgnore = (typeAttribute as IntegrationTest.ExcludePlatformAttribute).platformsToExclude; - else if (typeAttribute is IntegrationTest.ExpectExceptions) - { - var attribute = (typeAttribute as IntegrationTest.ExpectExceptions); - tc.expectException = true; - tc.expectedExceptionList = string.Join(",", attribute.exceptionTypeNames); - tc.succeedWhenExceptionIsThrown = attribute.succeedOnException; - } - } - go.AddComponent(type); -#endif // if !UNITY_METRO - return tc; - } - - public static GameObject CreateTest() - { - return CreateTest("New Test"); - } - - private static GameObject CreateTest(string name) - { - var go = new GameObject(name); - go.AddComponent(); -#if UNITY_EDITOR - Undo.RegisterCreatedObjectUndo(go, "Created test"); -#endif - return go; - } - - public static List FindAllTestsOnScene() - { - var tests = Resources.FindObjectsOfTypeAll (typeof(TestComponent)).Cast (); -#if UNITY_EDITOR - tests = tests.Where( t => {var p = PrefabUtility.GetPrefabType(t); return p != PrefabType.Prefab && p != PrefabType.ModelPrefab;} ); - -#endif - return tests.ToList (); - } - - public static List FindAllTopTestsOnScene() - { - return FindAllTestsOnScene().Where(component => component.gameObject.transform.parent == null).ToList(); - } - - public static List FindAllDynamicTestsOnScene() - { - return FindAllTestsOnScene().Where(t => t.dynamic).ToList(); - } - - public static void DestroyAllDynamicTests() - { - foreach (var dynamicTestComponent in FindAllDynamicTestsOnScene()) - DestroyImmediate(dynamicTestComponent.gameObject); - } - - public static void DisableAllTests() - { - foreach (var t in FindAllTestsOnScene()) t.EnableTest(false); - } - - public static bool AnyTestsOnScene() - { - return FindAllTestsOnScene().Any(); - } - - public static bool AnyDynamicTestForCurrentScene() - { -#if UNITY_EDITOR - return TestComponent.GetTypesWithHelpAttribute(EditorApplication.currentScene).Any(); -#else - return TestComponent.GetTypesWithHelpAttribute(Application.loadedLevelName).Any(); -#endif - } - - #endregion - - private sealed class NullTestComponentImpl : ITestComponent - { - public int CompareTo(ITestComponent other) - { - if (other == this) return 0; - return -1; - } - - public void EnableTest(bool enable) - { - } - - public bool IsTestGroup() - { - throw new NotImplementedException(); - } - - public GameObject gameObject { get; private set; } - public string Name { get { return ""; } } - - public ITestComponent GetTestGroup() - { - return null; - } - - public bool IsExceptionExpected(string exceptionType) - { - throw new NotImplementedException(); - } - - public bool ShouldSucceedOnException() - { - throw new NotImplementedException(); - } - - public double GetTimeout() - { - throw new NotImplementedException(); - } - - public bool IsIgnored() - { - throw new NotImplementedException(); - } - - public bool ShouldSucceedOnAssertions() - { - throw new NotImplementedException(); - } - - public bool IsExludedOnThisPlatform() - { - throw new NotImplementedException(); - } - } - - public static IEnumerable GetTypesWithHelpAttribute(string sceneName) - { -#if !UNITY_METRO - foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) - { - Type[] types = null; - - try - { - types = assembly.GetTypes(); - } - catch (ReflectionTypeLoadException ex) - { - Debug.LogError("Failed to load types from: " + assembly.FullName); - foreach (Exception loadEx in ex.LoaderExceptions) - Debug.LogException(loadEx); - } - - if (types == null) - continue; - - foreach (Type type in types) - { - var attributes = type.GetCustomAttributes(typeof(IntegrationTest.DynamicTestAttribute), true); - if (attributes.Length == 1) - { - var a = attributes.Single() as IntegrationTest.DynamicTestAttribute; - if (a.IncludeOnScene(sceneName)) yield return type; - } - } - } -#else // if !UNITY_METRO - yield break; -#endif // if !UNITY_METRO - } - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestComponent.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestComponent.cs.meta deleted file mode 100644 index fd67c93b5..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestComponent.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b1dba0b27b0864740a8720e920aa88c0 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestResult.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestResult.cs deleted file mode 100644 index df67f7145..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestResult.cs +++ /dev/null @@ -1,141 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - [Serializable] - public class TestResult : ITestResult, IComparable - { - private readonly GameObject m_Go; - private string m_Name; - public ResultType resultType = ResultType.NotRun; - public double duration; - public string messages; - public string stacktrace; - public string id; - public bool dynamicTest; - - public TestComponent TestComponent; - - public GameObject GameObject - { - get { return m_Go; } - } - - public TestResult(TestComponent testComponent) - { - TestComponent = testComponent; - m_Go = testComponent.gameObject; - id = testComponent.gameObject.GetInstanceID().ToString(); - dynamicTest = testComponent.dynamic; - - if (m_Go != null) m_Name = m_Go.name; - - if (dynamicTest) - id = testComponent.dynamicTypeName; - } - - public void Update(TestResult oldResult) - { - resultType = oldResult.resultType; - duration = oldResult.duration; - messages = oldResult.messages; - stacktrace = oldResult.stacktrace; - } - - public enum ResultType - { - Success, - Failed, - Timeout, - NotRun, - FailedException, - Ignored - } - - public void Reset() - { - resultType = ResultType.NotRun; - duration = 0f; - messages = ""; - stacktrace = ""; - } - - #region ITestResult implementation - public TestResultState ResultState { - get - { - switch (resultType) - { - case ResultType.Success: return TestResultState.Success; - case ResultType.Failed: return TestResultState.Failure; - case ResultType.FailedException: return TestResultState.Error; - case ResultType.Ignored: return TestResultState.Ignored; - case ResultType.NotRun: return TestResultState.Skipped; - case ResultType.Timeout: return TestResultState.Cancelled; - default: throw new Exception(); - } - } - } - public string Message { get { return messages; } } - public string Logs { get { return null; } } - public bool Executed { get { return resultType != ResultType.NotRun; } } - public string Name { get { if (m_Go != null) m_Name = m_Go.name; return m_Name; } } - public string Id { get { return id; } } - public bool IsSuccess { get { return resultType == ResultType.Success; } } - public bool IsTimeout { get { return resultType == ResultType.Timeout; } } - public double Duration { get { return duration; } } - public string StackTrace { get { return stacktrace; } } - public string FullName { - get - { - var fullName = Name; - if (m_Go != null) - { - var tempGo = m_Go.transform.parent; - while (tempGo != null) - { - fullName = tempGo.name + "." + fullName; - tempGo = tempGo.transform.parent; - } - } - return fullName; - } - } - - public bool IsIgnored { get { return resultType == ResultType.Ignored; } } - public bool IsFailure - { - get - { - return resultType == ResultType.Failed - || resultType == ResultType.FailedException - || resultType == ResultType.Timeout; - } - } - #endregion - - #region IComparable, GetHashCode and Equals implementation - public override int GetHashCode() - { - return id.GetHashCode(); - } - - public int CompareTo(TestResult other) - { - var result = Name.CompareTo(other.Name); - if (result == 0) - result = m_Go.GetInstanceID().CompareTo(other.m_Go.GetInstanceID()); - return result; - } - - public override bool Equals(object obj) - { - if (obj is TestResult) - return GetHashCode() == obj.GetHashCode(); - return base.Equals(obj); - } - #endregion - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestResult.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestResult.cs.meta deleted file mode 100644 index c604beaa6..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestResult.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 68740a702763aaa4594e8319a05ae0d3 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestResultRenderer.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestResultRenderer.cs deleted file mode 100644 index e838d7e27..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestResultRenderer.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -public class TestResultRenderer -{ - private static class Styles - { - public static readonly GUIStyle SucceedLabelStyle; - public static readonly GUIStyle FailedLabelStyle; - public static readonly GUIStyle FailedMessagesStyle; - - static Styles() - { - SucceedLabelStyle = new GUIStyle("label"); - SucceedLabelStyle.normal.textColor = Color.green; - SucceedLabelStyle.fontSize = 48; - - FailedLabelStyle = new GUIStyle("label"); - FailedLabelStyle.normal.textColor = Color.red; - FailedLabelStyle.fontSize = 32; - - FailedMessagesStyle = new GUIStyle("label"); - FailedMessagesStyle.wordWrap = false; - FailedMessagesStyle.richText = true; - } - } - private readonly Dictionary> m_TestCollection = new Dictionary>(); - - private bool m_ShowResults; - Vector2 m_ScrollPosition; - private int m_FailureCount; - - public void ShowResults() - { - m_ShowResults = true; - Cursor.visible = true; - } - - public void AddResults(string sceneName, ITestResult result) - { - if (!m_TestCollection.ContainsKey(sceneName)) - m_TestCollection.Add(sceneName, new List()); - m_TestCollection[sceneName].Add(result); - if (result.Executed && !result.IsSuccess) - m_FailureCount++; - } - - public void Draw() - { - if (!m_ShowResults) return; - if (m_TestCollection.Count == 0) - { - GUILayout.Label("All test succeeded", Styles.SucceedLabelStyle, GUILayout.Width(600)); - } - else - { - int count = m_TestCollection.Sum (testGroup => testGroup.Value.Count); - GUILayout.Label(count + " tests failed!", Styles.FailedLabelStyle); - - m_ScrollPosition = GUILayout.BeginScrollView(m_ScrollPosition, GUILayout.ExpandWidth(true)); - var text = ""; - foreach (var testGroup in m_TestCollection) - { - text += "" + testGroup.Key + "\n"; - text += string.Join("\n", testGroup.Value - .Where(result => !result.IsSuccess) - .Select(result => result.Name + " " + result.ResultState + "\n" + result.Message) - .ToArray()); - } - GUILayout.TextArea(text, Styles.FailedMessagesStyle); - GUILayout.EndScrollView(); - } - if (GUILayout.Button("Close")) - Application.Quit(); - } - - public int FailureCount() - { - return m_FailureCount; - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestResultRenderer.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestResultRenderer.cs.meta deleted file mode 100644 index 7d70150ad..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestResultRenderer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7ae9d3b4b57cae343b7ff360f9deb628 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunner.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunner.cs deleted file mode 100644 index aed12485d..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunner.cs +++ /dev/null @@ -1,422 +0,0 @@ -// #define IMITATE_BATCH_MODE //uncomment if you want to imitate batch mode behaviour in non-batch mode mode run - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using UnityEngine; -using UnityTest.IntegrationTestRunner; -using System.IO; - -namespace UnityTest -{ - [Serializable] - public class TestRunner : MonoBehaviour - { - static private int TestSceneNumber = 0; - static private readonly TestResultRenderer k_ResultRenderer = new TestResultRenderer(); - - public TestComponent currentTest; - private List m_ResultList = new List(); - private List m_TestComponents; - - public bool isInitializedByRunner - { - get - { -#if !IMITATE_BATCH_MODE - if (Application.isEditor && !IsBatchMode()) - return true; -#endif - return false; - } - } - - private double m_StartTime; - private bool m_ReadyToRun; - - private string m_TestMessages; - private string m_Stacktrace; - private TestState m_TestState = TestState.Running; - - private TestRunnerConfigurator m_Configurator; - - public TestRunnerCallbackList TestRunnerCallback = new TestRunnerCallbackList(); - private IntegrationTestsProvider m_TestsProvider; - - private const string k_Prefix = "IntegrationTest"; - private const string k_StartedMessage = k_Prefix + " Started"; - private const string k_FinishedMessage = k_Prefix + " Finished"; - private const string k_TimeoutMessage = k_Prefix + " Timeout"; - private const string k_FailedMessage = k_Prefix + " Failed"; - private const string k_FailedExceptionMessage = k_Prefix + " Failed with exception"; - private const string k_IgnoredMessage = k_Prefix + " Ignored"; - private const string k_InterruptedMessage = k_Prefix + " Run interrupted"; - - - public void Awake() - { - m_Configurator = new TestRunnerConfigurator(); - if (isInitializedByRunner) return; - TestComponent.DisableAllTests(); - } - - public void Start() - { - if (isInitializedByRunner) return; - - if (m_Configurator.sendResultsOverNetwork) - { - var nrs = m_Configurator.ResolveNetworkConnection(); - if (nrs != null) - TestRunnerCallback.Add(nrs); - } - - TestComponent.DestroyAllDynamicTests(); - var dynamicTestTypes = TestComponent.GetTypesWithHelpAttribute(Application.loadedLevelName); - foreach (var dynamicTestType in dynamicTestTypes) - TestComponent.CreateDynamicTest(dynamicTestType); - - var tests = TestComponent.FindAllTestsOnScene(); - - InitRunner(tests, dynamicTestTypes.Select(type => type.AssemblyQualifiedName).ToList()); - } - - public void InitRunner(List tests, List dynamicTestsToRun) - { - Application.logMessageReceived += LogHandler; - - // Init dynamic tests - foreach (var typeName in dynamicTestsToRun) - { - var t = Type.GetType(typeName); - if (t == null) continue; - var scriptComponents = Resources.FindObjectsOfTypeAll(t) as MonoBehaviour[]; - if (scriptComponents.Length == 0) - { - Debug.LogWarning(t + " not found. Skipping."); - continue; - } - if (scriptComponents.Length > 1) Debug.LogWarning("Multiple GameObjects refer to " + typeName); - tests.Add(scriptComponents.First().GetComponent()); - } - // create test structure - m_TestComponents = ParseListForGroups(tests).ToList(); - // create results for tests - m_ResultList = m_TestComponents.Select(component => new TestResult(component)).ToList(); - // init test provider - m_TestsProvider = new IntegrationTestsProvider(m_ResultList.Select(result => result.TestComponent as ITestComponent)); - m_ReadyToRun = true; - } - - private static IEnumerable ParseListForGroups(IEnumerable tests) - { - var results = new HashSet(); - foreach (var testResult in tests) - { - if (testResult.IsTestGroup()) - { - var childrenTestResult = testResult.gameObject.GetComponentsInChildren(typeof(TestComponent), true) - .Where(t => t != testResult) - .Cast() - .ToArray(); - foreach (var result in childrenTestResult) - { - if (!result.IsTestGroup()) - results.Add(result); - } - continue; - } - results.Add(testResult); - } - return results; - } - - public void Update() - { - if (m_ReadyToRun && Time.frameCount > 1) - { - m_ReadyToRun = false; - StartCoroutine("StateMachine"); - } - } - - public void OnDestroy() - { - if (currentTest != null) - { - var testResult = m_ResultList.Single(result => result.TestComponent == currentTest); - testResult.messages += "Test run interrupted (crash?)"; - LogMessage(k_InterruptedMessage); - FinishTest(TestResult.ResultType.Failed); - } - if (currentTest != null || (m_TestsProvider != null && m_TestsProvider.AnyTestsLeft())) - { - var remainingTests = m_TestsProvider.GetRemainingTests(); - TestRunnerCallback.TestRunInterrupted(remainingTests.ToList()); - } - Application.logMessageReceived -= LogHandler; - } - - private void LogHandler(string condition, string stacktrace, LogType type) - { - if (!condition.StartsWith(k_StartedMessage) && !condition.StartsWith(k_FinishedMessage)) - { - var msg = condition; - if (msg.StartsWith(k_Prefix)) msg = msg.Substring(k_Prefix.Length + 1); - if (currentTest != null && msg.EndsWith("(" + currentTest.name + ')')) msg = msg.Substring(0, msg.LastIndexOf('(')); - m_TestMessages += msg + "\n"; - } - switch (type) - { - case LogType.Exception: - { - var exceptionType = condition.Substring(0, condition.IndexOf(':')); - if (currentTest != null && currentTest.IsExceptionExpected(exceptionType)) - { - m_TestMessages += exceptionType + " was expected\n"; - if (currentTest.ShouldSucceedOnException()) - { - m_TestState = TestState.Success; - } - } - else - { - m_TestState = TestState.Exception; - m_Stacktrace = stacktrace; - } - } - break; - case LogType.Assert: - case LogType.Error: - m_TestState = TestState.Failure; - m_Stacktrace = stacktrace; - break; - case LogType.Log: - if (m_TestState == TestState.Running && condition.StartsWith(IntegrationTest.passMessage)) - { - m_TestState = TestState.Success; - } - if (condition.StartsWith(IntegrationTest.failMessage)) - { - m_TestState = TestState.Failure; - } - break; - } - } - - public IEnumerator StateMachine() - { - TestRunnerCallback.RunStarted(Application.platform.ToString(), m_TestComponents); - while (true) - { - if (!m_TestsProvider.AnyTestsLeft() && currentTest == null) - { - FinishTestRun(); - yield break; - } - if (currentTest == null) - { - StartNewTest(); - } - if (currentTest != null) - { - if (m_TestState == TestState.Running) - { - if(currentTest.ShouldSucceedOnAssertions()) - { - var assertionsToCheck = currentTest.gameObject.GetComponentsInChildren().Where(a => a.enabled).ToArray(); - if (assertionsToCheck.Any () && assertionsToCheck.All(a => a.checksPerformed > 0)) - { - IntegrationTest.Pass(currentTest.gameObject); - m_TestState = TestState.Success; - } - } - if (currentTest != null && Time.time > m_StartTime + currentTest.GetTimeout()) - { - m_TestState = TestState.Timeout; - } - } - - switch (m_TestState) - { - case TestState.Success: - LogMessage(k_FinishedMessage); - FinishTest(TestResult.ResultType.Success); - break; - case TestState.Failure: - LogMessage(k_FailedMessage); - FinishTest(TestResult.ResultType.Failed); - break; - case TestState.Exception: - LogMessage(k_FailedExceptionMessage); - FinishTest(TestResult.ResultType.FailedException); - break; - case TestState.Timeout: - LogMessage(k_TimeoutMessage); - FinishTest(TestResult.ResultType.Timeout); - break; - case TestState.Ignored: - LogMessage(k_IgnoredMessage); - FinishTest(TestResult.ResultType.Ignored); - break; - } - } - yield return null; - } - } - - private void LogMessage(string message) - { - if (currentTest != null) - Debug.Log(message + " (" + currentTest.Name + ")", currentTest.gameObject); - else - Debug.Log(message); - } - - private void FinishTestRun() - { - PrintResultToLog(); - TestRunnerCallback.RunFinished(m_ResultList); - LoadNextLevelOrQuit(); - } - - private void PrintResultToLog() - { - var resultString = ""; - resultString += "Passed: " + m_ResultList.Count(t => t.IsSuccess); - if (m_ResultList.Any(result => result.IsFailure)) - { - resultString += " Failed: " + m_ResultList.Count(t => t.IsFailure); - Debug.Log("Failed tests: " + string.Join(", ", m_ResultList.Where(t => t.IsFailure).Select(result => result.Name).ToArray())); - } - if (m_ResultList.Any(result => result.IsIgnored)) - { - resultString += " Ignored: " + m_ResultList.Count(t => t.IsIgnored); - Debug.Log("Ignored tests: " + string.Join(", ", - m_ResultList.Where(t => t.IsIgnored).Select(result => result.Name).ToArray())); - } - Debug.Log(resultString); - } - - private void LoadNextLevelOrQuit() - { - if (isInitializedByRunner) return; - - - TestSceneNumber += 1; - string testScene = m_Configurator.GetIntegrationTestScenes (TestSceneNumber); - - if (testScene != null) - Application.LoadLevel(Path.GetFileNameWithoutExtension(testScene)); - else - { - TestRunnerCallback.AllScenesFinished(); - k_ResultRenderer.ShowResults(); - if (m_Configurator.isBatchRun && m_Configurator.sendResultsOverNetwork) - Application.Quit(); - } - } - - public void OnGUI() - { - k_ResultRenderer.Draw(); - } - - private void StartNewTest() - { - m_TestMessages = ""; - m_Stacktrace = ""; - m_TestState = TestState.Running; - - m_StartTime = Time.time; - currentTest = m_TestsProvider.GetNextTest() as TestComponent; - - var testResult = m_ResultList.Single(result => result.TestComponent == currentTest); - - if (currentTest != null && currentTest.IsExludedOnThisPlatform()) - { - m_TestState = TestState.Ignored; - Debug.Log(currentTest.gameObject.name + " is excluded on this platform"); - } - - // don't ignore test if user initiated it from the runner and it's the only test that is being run - if (currentTest != null - && (currentTest.IsIgnored() - && !(isInitializedByRunner && m_ResultList.Count == 1))) - m_TestState = TestState.Ignored; - - LogMessage(k_StartedMessage); - TestRunnerCallback.TestStarted(testResult); - } - - private void FinishTest(TestResult.ResultType result) - { - m_TestsProvider.FinishTest(currentTest); - var testResult = m_ResultList.Single(t => t.GameObject == currentTest.gameObject); - testResult.resultType = result; - testResult.duration = Time.time - m_StartTime; - testResult.messages = m_TestMessages; - testResult.stacktrace = m_Stacktrace; - TestRunnerCallback.TestFinished(testResult); - currentTest = null; - if (!testResult.IsSuccess - && testResult.Executed - && !testResult.IsIgnored) k_ResultRenderer.AddResults(Application.loadedLevelName, testResult); - } - - #region Test Runner Helpers - - public static TestRunner GetTestRunner() - { - TestRunner testRunnerComponent = null; - var testRunnerComponents = Resources.FindObjectsOfTypeAll(typeof(TestRunner)); - - if (testRunnerComponents.Count() > 1) - foreach (var t in testRunnerComponents) DestroyImmediate(((TestRunner)t).gameObject); - else if (!testRunnerComponents.Any()) - testRunnerComponent = Create().GetComponent(); - else - testRunnerComponent = testRunnerComponents.Single() as TestRunner; - - return testRunnerComponent; - } - - private static GameObject Create() - { - var runner = new GameObject("TestRunner"); - runner.AddComponent(); - Debug.Log("Created Test Runner"); - return runner; - } - - private static bool IsBatchMode() - { -#if !UNITY_METRO - const string internalEditorUtilityClassName = "UnityEditorInternal.InternalEditorUtility, UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"; - - var t = Type.GetType(internalEditorUtilityClassName, false); - if (t == null) return false; - - const string inBatchModeProperty = "inBatchMode"; - var prop = t.GetProperty(inBatchModeProperty); - return (bool)prop.GetValue(null, null); -#else // if !UNITY_METRO - return false; -#endif // if !UNITY_METRO - } - - #endregion - - enum TestState - { - Running, - Success, - Failure, - Exception, - Timeout, - Ignored - } - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunner.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunner.cs.meta deleted file mode 100644 index 5ef068e2e..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunner.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5c3afc1c624179749bcdecf7b0224902 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunnerCallbackList.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunnerCallbackList.cs deleted file mode 100644 index 91830d2af..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunnerCallbackList.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest.IntegrationTestRunner -{ - public class TestRunnerCallbackList : ITestRunnerCallback - { - private readonly List m_CallbackList = new List(); - - public void Add(ITestRunnerCallback callback) - { - m_CallbackList.Add(callback); - } - - public void Remove(ITestRunnerCallback callback) - { - m_CallbackList.Remove(callback); - } - - public void RunStarted(string platform, List testsToRun) - { - foreach (var unitTestRunnerCallback in m_CallbackList) - { - unitTestRunnerCallback.RunStarted(platform, testsToRun); - } - } - - public void RunFinished(List testResults) - { - foreach (var unitTestRunnerCallback in m_CallbackList) - { - unitTestRunnerCallback.RunFinished(testResults); - } - } - - public void AllScenesFinished() - { - foreach (var unitTestRunnerCallback in m_CallbackList) - { - unitTestRunnerCallback.AllScenesFinished(); - } - } - - public void TestStarted(TestResult test) - { - foreach (var unitTestRunnerCallback in m_CallbackList) - { - unitTestRunnerCallback.TestStarted(test); - } - } - - public void TestFinished(TestResult test) - { - foreach (var unitTestRunnerCallback in m_CallbackList) - { - unitTestRunnerCallback.TestFinished(test); - } - } - - public void TestRunInterrupted(List testsNotRun) - { - foreach (var unitTestRunnerCallback in m_CallbackList) - { - unitTestRunnerCallback.TestRunInterrupted(testsNotRun); - } - } - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunnerCallbackList.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunnerCallbackList.cs.meta deleted file mode 100644 index c39656ab8..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunnerCallbackList.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7729da83f7c08d244b5788c870a93780 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunnerConfigurator.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunnerConfigurator.cs deleted file mode 100644 index 51462fa5c..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunnerConfigurator.cs +++ /dev/null @@ -1,197 +0,0 @@ -#if !UNITY_METRO && !UNITY_WEBPLAYER && (UNITY_PRO_LICENSE || !(UNITY_ANDROID || UNITY_IPHONE)) -#define UTT_SOCKETS_SUPPORTED -#endif -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading; -using UnityEngine; -using UnityTest.IntegrationTestRunner; -#if UTT_SOCKETS_SUPPORTED -using System.Net; -using System.Net.Sockets; -using System.Net.NetworkInformation; -#endif - -#if UNITY_EDITOR -using UnityEditorInternal; -#endif - -namespace UnityTest -{ - public class TestRunnerConfigurator - { - public static string integrationTestsNetwork = "networkconfig.txt"; - public static string batchRunFileMarker = "batchrun.txt"; - public static string testScenesToRun = "testscenes.txt"; - - public bool isBatchRun { get; private set; } - - public bool sendResultsOverNetwork { get; private set; } - -#if UTT_SOCKETS_SUPPORTED - private readonly List m_IPEndPointList = new List(); -#endif - - public TestRunnerConfigurator() - { - CheckForBatchMode(); - CheckForSendingResultsOverNetwork(); - } - - public string GetIntegrationTestScenes(int testSceneNum) - { - string text; - if (Application.isEditor) - text = GetTextFromTempFile(testScenesToRun); - else - text = GetTextFromTextAsset(testScenesToRun); - - List sceneList = new List(); - foreach (var line in text.Split(new[] {'\n'}, StringSplitOptions.RemoveEmptyEntries)) - { - sceneList.Add(line.ToString()); - } - - if (testSceneNum < sceneList.Count) - return sceneList.ElementAt(testSceneNum); - else - return null; - } - - private void CheckForSendingResultsOverNetwork() - { -#if UTT_SOCKETS_SUPPORTED - string text; - if (Application.isEditor) - text = GetTextFromTempFile(integrationTestsNetwork); - else - text = GetTextFromTextAsset(integrationTestsNetwork); - - if (text == null) return; - - sendResultsOverNetwork = true; - - m_IPEndPointList.Clear(); - - foreach (var line in text.Split(new[] {'\n'}, StringSplitOptions.RemoveEmptyEntries)) - { - var idx = line.IndexOf(':'); - if (idx == -1) throw new Exception(line); - var ip = line.Substring(0, idx); - var port = line.Substring(idx + 1); - m_IPEndPointList.Add(new IPEndPoint(IPAddress.Parse(ip), Int32.Parse(port))); - } -#endif // if UTT_SOCKETS_SUPPORTED - } - - private static string GetTextFromTextAsset(string fileName) - { - var nameWithoutExtension = fileName.Substring(0, fileName.LastIndexOf('.')); - var resultpathFile = Resources.Load(nameWithoutExtension) as TextAsset; - return resultpathFile != null ? resultpathFile.text : null; - } - - private static string GetTextFromTempFile(string fileName) - { - string text = null; - try - { -#if UNITY_EDITOR && !UNITY_WEBPLAYER - text = File.ReadAllText(Path.Combine("Temp", fileName)); -#endif - } - catch - { - return null; - } - return text; - } - - private void CheckForBatchMode() - { -#if IMITATE_BATCH_MODE - isBatchRun = true; -#elif UNITY_EDITOR - if (Application.isEditor && InternalEditorUtility.inBatchMode) - isBatchRun = true; -#else - if (GetTextFromTextAsset(batchRunFileMarker) != null) isBatchRun = true; -#endif - } - - public static List GetAvailableNetworkIPs() - { -#if UTT_SOCKETS_SUPPORTED - if (!NetworkInterface.GetIsNetworkAvailable()) - return new List{IPAddress.Loopback.ToString()}; - - var ipList = new List(); - var allIpsList = new List(); - - foreach (var netInterface in NetworkInterface.GetAllNetworkInterfaces()) - { - if (netInterface.NetworkInterfaceType != NetworkInterfaceType.Wireless80211 && - netInterface.NetworkInterfaceType != NetworkInterfaceType.Ethernet) - continue; - - var ipAdresses = netInterface.GetIPProperties().UnicastAddresses - .Where(a => a.Address.AddressFamily == AddressFamily.InterNetwork); - allIpsList.AddRange(ipAdresses); - - if (netInterface.OperationalStatus != OperationalStatus.Up) continue; - - ipList.AddRange(ipAdresses); - } - - //On Mac 10.10 all interfaces return OperationalStatus.Unknown, thus this workaround - if(!ipList.Any()) return allIpsList.Select(i => i.Address.ToString()).ToList(); - - // sort ip list by their masks to predict which ip belongs to lan network - ipList.Sort((ip1, ip2) => - { - var mask1 = BitConverter.ToInt32(ip1.IPv4Mask.GetAddressBytes().Reverse().ToArray(), 0); - var mask2 = BitConverter.ToInt32(ip2.IPv4Mask.GetAddressBytes().Reverse().ToArray(), 0); - return mask2.CompareTo(mask1); - }); - if (ipList.Count == 0) - return new List { IPAddress.Loopback.ToString() }; - return ipList.Select(i => i.Address.ToString()).ToList(); -#else - return new List(); -#endif // if UTT_SOCKETS_SUPPORTED - } - - public ITestRunnerCallback ResolveNetworkConnection() - { -#if UTT_SOCKETS_SUPPORTED - var nrsList = m_IPEndPointList.Select(ipEndPoint => new NetworkResultSender(ipEndPoint.Address.ToString(), ipEndPoint.Port)).ToList(); - - var timeout = TimeSpan.FromSeconds(30); - DateTime startTime = DateTime.Now; - while ((DateTime.Now - startTime) < timeout) - { - foreach (var networkResultSender in nrsList) - { - try - { - if (!networkResultSender.Ping()) continue; - } - catch (Exception e) - { - Debug.LogException(e); - sendResultsOverNetwork = false; - return null; - } - return networkResultSender; - } - Thread.Sleep(500); - } - Debug.LogError("Couldn't connect to the server: " + string.Join(", ", m_IPEndPointList.Select(ipep => ipep.Address + ":" + ipep.Port).ToArray())); - sendResultsOverNetwork = false; -#endif // if UTT_SOCKETS_SUPPORTED - return null; - } - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunnerConfigurator.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunnerConfigurator.cs.meta deleted file mode 100644 index 42f72639f..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/TestRunnerConfigurator.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 05aae864572254e478ed2f0489cdd335 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets.meta deleted file mode 100644 index 433c2954a..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: 1d1ccbd729921544dbd71f7e80c405b6 -folderAsset: yes -DefaultImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CallTesting.cs b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CallTesting.cs deleted file mode 100644 index 3badc58cc..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CallTesting.cs +++ /dev/null @@ -1,204 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace UnityTest -{ - public class CallTesting : MonoBehaviour - { - public enum Functions - { - CallAfterSeconds, - CallAfterFrames, - Start, - Update, - FixedUpdate, - LateUpdate, - OnDestroy, - OnEnable, - OnDisable, - OnControllerColliderHit, - OnParticleCollision, - OnJointBreak, - OnBecameInvisible, - OnBecameVisible, - OnTriggerEnter, - OnTriggerExit, - OnTriggerStay, - OnCollisionEnter, - OnCollisionExit, - OnCollisionStay, - OnTriggerEnter2D, - OnTriggerExit2D, - OnTriggerStay2D, - OnCollisionEnter2D, - OnCollisionExit2D, - OnCollisionStay2D, - } - - public enum Method - { - Pass, - Fail - } - - public int afterFrames = 0; - public float afterSeconds = 0.0f; - public Functions callOnMethod = Functions.Start; - - public Method methodToCall; - private int m_StartFrame; - private float m_StartTime; - - private void TryToCallTesting(Functions invokingMethod) - { - if (invokingMethod == callOnMethod) - { - if (methodToCall == Method.Pass) - IntegrationTest.Pass(gameObject); - else - IntegrationTest.Fail(gameObject); - - afterFrames = 0; - afterSeconds = 0.0f; - m_StartTime = float.PositiveInfinity; - m_StartFrame = int.MinValue; - } - } - - public void Start() - { - m_StartTime = Time.time; - m_StartFrame = afterFrames; - TryToCallTesting(Functions.Start); - } - - public void Update() - { - TryToCallTesting(Functions.Update); - CallAfterSeconds(); - CallAfterFrames(); - } - - private void CallAfterFrames() - { - if (afterFrames > 0 && (m_StartFrame + afterFrames) <= Time.frameCount) - TryToCallTesting(Functions.CallAfterFrames); - } - - private void CallAfterSeconds() - { - if ((m_StartTime + afterSeconds) <= Time.time) - TryToCallTesting(Functions.CallAfterSeconds); - } - - public void OnDisable() - { - TryToCallTesting(Functions.OnDisable); - } - - public void OnEnable() - { - TryToCallTesting(Functions.OnEnable); - } - - public void OnDestroy() - { - TryToCallTesting(Functions.OnDestroy); - } - - public void FixedUpdate() - { - TryToCallTesting(Functions.FixedUpdate); - } - - public void LateUpdate() - { - TryToCallTesting(Functions.LateUpdate); - } - - public void OnControllerColliderHit() - { - TryToCallTesting(Functions.OnControllerColliderHit); - } - - public void OnParticleCollision() - { - TryToCallTesting(Functions.OnParticleCollision); - } - - public void OnJointBreak() - { - TryToCallTesting(Functions.OnJointBreak); - } - - public void OnBecameInvisible() - { - TryToCallTesting(Functions.OnBecameInvisible); - } - - public void OnBecameVisible() - { - TryToCallTesting(Functions.OnBecameVisible); - } - - public void OnTriggerEnter() - { - TryToCallTesting(Functions.OnTriggerEnter); - } - - public void OnTriggerExit() - { - TryToCallTesting(Functions.OnTriggerExit); - } - - public void OnTriggerStay() - { - TryToCallTesting(Functions.OnTriggerStay); - } - public void OnCollisionEnter() - { - TryToCallTesting(Functions.OnCollisionEnter); - } - - public void OnCollisionExit() - { - TryToCallTesting(Functions.OnCollisionExit); - } - - public void OnCollisionStay() - { - TryToCallTesting(Functions.OnCollisionStay); - } - - public void OnTriggerEnter2D() - { - TryToCallTesting(Functions.OnTriggerEnter2D); - } - - public void OnTriggerExit2D() - { - TryToCallTesting(Functions.OnTriggerExit2D); - } - - public void OnTriggerStay2D() - { - TryToCallTesting(Functions.OnTriggerStay2D); - } - - public void OnCollisionEnter2D() - { - TryToCallTesting(Functions.OnCollisionEnter2D); - } - - public void OnCollisionExit2D() - { - TryToCallTesting(Functions.OnCollisionExit2D); - } - - public void OnCollisionStay2D() - { - TryToCallTesting(Functions.OnCollisionStay2D); - } - } -} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CallTesting.cs.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CallTesting.cs.meta deleted file mode 100644 index 91cbde1ce..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CallTesting.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0d545b1288d5fc74d8e6c961fb67ab18 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeCollisionFailure.prefab b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeCollisionFailure.prefab deleted file mode 100644 index c1a23a92b..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeCollisionFailure.prefab +++ /dev/null @@ -1,104 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &100000 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - serializedVersion: 4 - m_Component: - - 4: {fileID: 400000} - - 33: {fileID: 3300000} - - 65: {fileID: 6500000} - - 23: {fileID: 2300000} - - 114: {fileID: 11400000} - m_Layer: 0 - m_Name: CubeCollisionFailure - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &400000 -Transform: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -5.1736994, y: 3.9978147, z: -16.24892} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 0 ---- !u!23 &2300000 -MeshRenderer: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 0 - m_Materials: - - {fileID: 2100000, guid: 03f3b4747259a364b800508ac27e1c17, type: 2} - m_SubsetIndices: - m_StaticBatchRoot: {fileID: 0} - m_UseLightProbes: 0 - m_ReflectionProbeUsage: 1 - m_ProbeAnchor: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!33 &3300000 -MeshFilter: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!65 &6500000 -BoxCollider: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0d545b1288d5fc74d8e6c961fb67ab18, type: 3} - m_Name: - m_EditorClassIdentifier: - afterFrames: 0 - afterSeconds: 0 - callOnMethod: 17 - methodToCall: 1 ---- !u!1001 &100100000 -Prefab: - m_ObjectHideFlags: 1 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: [] - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 0} - m_RootGameObject: {fileID: 100000} - m_IsPrefabParent: 1 diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeCollisionFailure.prefab.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeCollisionFailure.prefab.meta deleted file mode 100644 index 777585e9d..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeCollisionFailure.prefab.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: d5fc3c3488db1e74689f1fc67c33944a -NativeFormatImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeCollisionSuccess.prefab b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeCollisionSuccess.prefab deleted file mode 100644 index 6fecda2b5..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeCollisionSuccess.prefab +++ /dev/null @@ -1,104 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &100000 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - serializedVersion: 4 - m_Component: - - 4: {fileID: 400000} - - 33: {fileID: 3300000} - - 65: {fileID: 6500000} - - 23: {fileID: 2300000} - - 114: {fileID: 11400000} - m_Layer: 0 - m_Name: CubeCollisionSuccess - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &400000 -Transform: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -5.1736994, y: 3.9978147, z: -16.24892} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 0 ---- !u!23 &2300000 -MeshRenderer: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 0 - m_Materials: - - {fileID: 2100000, guid: 43da3275cd08d41429f56675d70c58df, type: 2} - m_SubsetIndices: - m_StaticBatchRoot: {fileID: 0} - m_UseLightProbes: 0 - m_ReflectionProbeUsage: 1 - m_ProbeAnchor: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!33 &3300000 -MeshFilter: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!65 &6500000 -BoxCollider: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0d545b1288d5fc74d8e6c961fb67ab18, type: 3} - m_Name: - m_EditorClassIdentifier: - afterFrames: 0 - afterSeconds: 0 - callOnMethod: 17 - methodToCall: 0 ---- !u!1001 &100100000 -Prefab: - m_ObjectHideFlags: 1 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: [] - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 0} - m_RootGameObject: {fileID: 100000} - m_IsPrefabParent: 1 diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeCollisionSuccess.prefab.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeCollisionSuccess.prefab.meta deleted file mode 100644 index 73ed4742b..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeCollisionSuccess.prefab.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 1228dff762eab21488cfefd42792c37b -NativeFormatImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeTriggerFailure.prefab b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeTriggerFailure.prefab deleted file mode 100644 index a8289830e..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeTriggerFailure.prefab +++ /dev/null @@ -1,104 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &100000 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - serializedVersion: 4 - m_Component: - - 4: {fileID: 400000} - - 33: {fileID: 3300000} - - 65: {fileID: 6500000} - - 23: {fileID: 2300000} - - 114: {fileID: 11400000} - m_Layer: 0 - m_Name: CubeTriggerFailure - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &400000 -Transform: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 0 ---- !u!23 &2300000 -MeshRenderer: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 0 - m_Materials: - - {fileID: 2100000, guid: 03f3b4747259a364b800508ac27e1c17, type: 2} - m_SubsetIndices: - m_StaticBatchRoot: {fileID: 0} - m_UseLightProbes: 0 - m_ReflectionProbeUsage: 1 - m_ProbeAnchor: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!33 &3300000 -MeshFilter: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!65 &6500000 -BoxCollider: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_Material: {fileID: 0} - m_IsTrigger: 1 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0d545b1288d5fc74d8e6c961fb67ab18, type: 3} - m_Name: - m_EditorClassIdentifier: - afterFrames: 0 - afterSeconds: 0 - callOnMethod: 14 - methodToCall: 1 ---- !u!1001 &100100000 -Prefab: - m_ObjectHideFlags: 1 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: [] - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 0} - m_RootGameObject: {fileID: 100000} - m_IsPrefabParent: 1 diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeTriggerFailure.prefab.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeTriggerFailure.prefab.meta deleted file mode 100644 index e04b231ff..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeTriggerFailure.prefab.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 616ddafe39e02da4081e56f7f763af3c -NativeFormatImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeTriggerSuccess.prefab b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeTriggerSuccess.prefab deleted file mode 100644 index cc6f89657..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeTriggerSuccess.prefab +++ /dev/null @@ -1,104 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &100000 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - serializedVersion: 4 - m_Component: - - 4: {fileID: 400000} - - 33: {fileID: 3300000} - - 65: {fileID: 6500000} - - 23: {fileID: 2300000} - - 114: {fileID: 11400000} - m_Layer: 0 - m_Name: CubeTriggerSuccess - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &400000 -Transform: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 0 ---- !u!23 &2300000 -MeshRenderer: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 0 - m_Materials: - - {fileID: 2100000, guid: 43da3275cd08d41429f56675d70c58df, type: 2} - m_SubsetIndices: - m_StaticBatchRoot: {fileID: 0} - m_UseLightProbes: 0 - m_ReflectionProbeUsage: 1 - m_ProbeAnchor: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!33 &3300000 -MeshFilter: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!65 &6500000 -BoxCollider: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_Material: {fileID: 0} - m_IsTrigger: 1 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 100000} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0d545b1288d5fc74d8e6c961fb67ab18, type: 3} - m_Name: - m_EditorClassIdentifier: - afterFrames: 0 - afterSeconds: 0 - callOnMethod: 14 - methodToCall: 0 ---- !u!1001 &100100000 -Prefab: - m_ObjectHideFlags: 1 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: [] - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 0} - m_RootGameObject: {fileID: 100000} - m_IsPrefabParent: 1 diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeTriggerSuccess.prefab.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeTriggerSuccess.prefab.meta deleted file mode 100644 index d16c91a50..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/CubeTriggerSuccess.prefab.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: d940e636fd44be84e9b7e8da46f700ef -NativeFormatImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/Materials.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/Materials.meta deleted file mode 100644 index ea98c418f..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/Materials.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: 8d55f43641ba3c14eaa1156abc0edabd -folderAsset: yes -DefaultImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/Materials/green.mat b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/Materials/green.mat deleted file mode 100644 index 7a2022ebd..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/Materials/green.mat +++ /dev/null @@ -1,30 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!21 &2100000 -Material: - serializedVersion: 6 - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_Name: green - m_Shader: {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} - m_ShaderKeywords: - m_LightmapFlags: 5 - m_CustomRenderQueue: -1 - stringTagMap: {} - m_SavedProperties: - serializedVersion: 2 - m_TexEnvs: - data: - first: - name: _MainTex - second: - m_Texture: {fileID: 2800000, guid: 928be703400f4eb48af2f94d55bf3f74, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Floats: {} - m_Colors: - data: - first: - name: _Color - second: {r: 1, g: 1, b: 1, a: 1} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/Materials/green.mat.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/Materials/green.mat.meta deleted file mode 100644 index 2cabfad74..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/Materials/green.mat.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 43da3275cd08d41429f56675d70c58df -NativeFormatImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/Materials/red.mat b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/Materials/red.mat deleted file mode 100644 index 3f06b36a3..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/Materials/red.mat +++ /dev/null @@ -1,30 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!21 &2100000 -Material: - serializedVersion: 6 - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_Name: red - m_Shader: {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} - m_ShaderKeywords: - m_LightmapFlags: 5 - m_CustomRenderQueue: -1 - stringTagMap: {} - m_SavedProperties: - serializedVersion: 2 - m_TexEnvs: - data: - first: - name: _MainTex - second: - m_Texture: {fileID: 2800000, guid: 591632297e74ba34fa4c65d1265d370a, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Floats: {} - m_Colors: - data: - first: - name: _Color - second: {r: 1, g: 1, b: 1, a: 1} diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/Materials/red.mat.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/Materials/red.mat.meta deleted file mode 100644 index 90565c1e6..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/Materials/red.mat.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 03f3b4747259a364b800508ac27e1c17 -NativeFormatImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/green.png b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/green.png deleted file mode 100644 index f4dcca218..000000000 Binary files a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/green.png and /dev/null differ diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/green.png.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/green.png.meta deleted file mode 100644 index 2add26958..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/green.png.meta +++ /dev/null @@ -1,53 +0,0 @@ -fileFormatVersion: 2 -guid: 928be703400f4eb48af2f94d55bf3f74 -TextureImporter: - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - linearTexture: 0 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: .25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 1024 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - autoDetectMinSpriteSize: 4 - gridPadding: 0 - gridOffsetX: 0 - gridOffsetY: 0 - gridSizeX: 64 - gridSizeY: 64 - spriteExtrude: 1 - alignment: 0 - spritePivot: {x: .5, y: .5} - spriteAtlasHint: 0 - spritePixelsToUnits: 100 - generateSpritePolygon: 0 - spritePolygonAlphaCutoff: 254 - spritePolygonDetail: .5 - alphaIsTransparency: 0 - textureType: -1 - buildTargetSettings: [] - spriteSheet: - spriteFrames: [] - userData: diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/red.png b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/red.png deleted file mode 100644 index 8b29b4597..000000000 Binary files a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/red.png and /dev/null differ diff --git a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/red.png.meta b/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/red.png.meta deleted file mode 100644 index 9cda8d852..000000000 --- a/Unity/Assets/UnityTestTools/IntegrationTestsFramework/TestingAssets/red.png.meta +++ /dev/null @@ -1,53 +0,0 @@ -fileFormatVersion: 2 -guid: 591632297e74ba34fa4c65d1265d370a -TextureImporter: - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - linearTexture: 0 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: .25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 1024 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - autoDetectMinSpriteSize: 4 - gridPadding: 0 - gridOffsetX: 0 - gridOffsetY: 0 - gridSizeX: 64 - gridSizeY: 64 - spriteExtrude: 1 - alignment: 0 - spritePivot: {x: .5, y: .5} - spriteAtlasHint: 0 - spritePixelsToUnits: 100 - generateSpritePolygon: 0 - spritePolygonAlphaCutoff: 254 - spritePolygonDetail: .5 - alphaIsTransparency: 0 - textureType: -1 - buildTargetSettings: [] - spriteSheet: - spriteFrames: [] - userData: diff --git a/Unity/Assets/UnityTestTools/LICENSE.txt b/Unity/Assets/UnityTestTools/LICENSE.txt deleted file mode 100644 index 8da6126c3..000000000 --- a/Unity/Assets/UnityTestTools/LICENSE.txt +++ /dev/null @@ -1,83 +0,0 @@ -This software is provided 'as-is', without any express or implied warranty. - - -THE UNITY TEST TOOLS CONTAIN THE FOLLOWING THIRD PARTY LIBRARIES: -NSubstitute Copyright (c) 2009 Anthony Egerton (nsubstitute@delfish.com) and David Tchepak (dave@davesquared.net). All rights reserved. -NUnit Portions Copyright © 2002-2009 Charlie Poole or Copyright © 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov or Copyright © 2000-2002 Philip A. Craig -Cecil Copyright (c) 2008 - 2011, Jb Evain - - - -NSubstitute is open source software, licensed under the BSD License. The modifications made by Unity are available on github. - -Copyright (c) 2009 Anthony Egerton (nsubstitute@delfish.com) and David Tchepak (dave@davesquared.net) -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the names of the copyright holders nor the names of - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -[ http://www.opensource.org/licenses/bsd-license.php ] - - - -NUnit is provided 'as-is', without any express or implied warranty. The modifications made by Unity are available on github. - -Copyright © 2002-2013 Charlie Poole -Copyright © 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov -Copyright © 2000-2002 Philip A. Craig - -This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment (see the following) in the product documentation is required. - -Portions Copyright © 2002-2013 Charlie Poole or Copyright © 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov or Copyright © 2000-2002 Philip A. Craig - -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source distribution. - - - -Cecil is licensed under the MIT/X11. - -Copyright (c) 2008 - 2011, Jb Evain - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/Unity/Assets/UnityTestTools/LICENSE.txt.meta b/Unity/Assets/UnityTestTools/LICENSE.txt.meta deleted file mode 100644 index 6a87d6900..000000000 --- a/Unity/Assets/UnityTestTools/LICENSE.txt.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 0d5b4501bf773f349ad95ec34491dc61 -TextScriptImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/UnitTesting.meta b/Unity/Assets/UnityTestTools/UnitTesting.meta deleted file mode 100644 index 10d2dd53c..000000000 --- a/Unity/Assets/UnityTestTools/UnitTesting.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: 9a87f1db904f1e948a2385ab9961e3aa -folderAsset: yes -DefaultImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/UnitTesting/Editor.meta b/Unity/Assets/UnityTestTools/UnitTesting/Editor.meta deleted file mode 100644 index 802e986e7..000000000 --- a/Unity/Assets/UnityTestTools/UnitTesting/Editor.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 59b47eb3fc62eb44cb73a329a1e6b6cb -DefaultImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/UnitTesting/Editor/NSubstitute.meta b/Unity/Assets/UnityTestTools/UnitTesting/Editor/NSubstitute.meta deleted file mode 100644 index 9a7cadb69..000000000 --- a/Unity/Assets/UnityTestTools/UnitTesting/Editor/NSubstitute.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: 92b38897656771f409e9235955975754 -folderAsset: yes -DefaultImporter: - userData: diff --git a/Unity/Assets/UnityTestTools/UnitTesting/Editor/NSubstitute/NSubstitute.dll b/Unity/Assets/UnityTestTools/UnitTesting/Editor/NSubstitute/NSubstitute.dll deleted file mode 100644 index ee8b155d7..000000000 Binary files a/Unity/Assets/UnityTestTools/UnitTesting/Editor/NSubstitute/NSubstitute.dll and /dev/null differ diff --git a/Unity/Assets/UnityTestTools/UnitTesting/Editor/NSubstitute/NSubstitute.dll.meta b/Unity/Assets/UnityTestTools/UnitTesting/Editor/NSubstitute/NSubstitute.dll.meta deleted file mode 100644 index 1cb4f6b3c..000000000 --- a/Unity/Assets/UnityTestTools/UnitTesting/Editor/NSubstitute/NSubstitute.dll.meta +++ /dev/null @@ -1,22 +0,0 @@ -fileFormatVersion: 2 -guid: 3c5e1afc6e0d68849ae6639aff58cfc7 -PluginImporter: - serializedVersion: 1 - iconMap: {} - executionOrder: {} - isPreloaded: 0 - platformData: - Any: - enabled: 0 - settings: {} - Editor: - enabled: 1 - settings: - DefaultValueInitialized: true - WindowsStoreApps: - enabled: 0 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: diff --git a/Unity/Assets/UnityTestTools/changelog.txt b/Unity/Assets/UnityTestTools/changelog.txt deleted file mode 100644 index e80d3d617..000000000 --- a/Unity/Assets/UnityTestTools/changelog.txt +++ /dev/null @@ -1,212 +0,0 @@ -Version 1.5.7 - -- Updated tools for Unity 5.3 - -Version 1.5.6 - -- Updated Mono.Cecil.dll and Mono.Cecil.Mdb.dll libraries - -Version 1.5.5 - -- Unit Tests Runner rendering improvments -- Platform runner can include auxiliary scenes -- other improvments and bugfixes - -Version 1.5.4 - -- APIs updates - -Version 1.5.3 - -- Bug fixes - -Version 1.5.2 - -- Bug fixes -- Minor improvments - -Version 1.5.1 - -- removed redundant and not applicable options -- fixed 5.0 related bugs - -Version 1.5.0 - -- Unity 5 related compatibility changes - -Version 1.4.6 - -- Bug fixes -- Minor improvments - -Version 1.4.5 - -- Added "Pause on test failure" option for integration tests -- bugfixes and code refactorization -- fixed UI bug where test details were not refreshed is the label was focused - -Version 1.4.4 - -- Minimal supported Unity version is now 4.3 -- UI changes -- code refactoring - -Version 1.4.3 - -- Remove reference to Resources.LoadAssetAtPath from runtime code - -Version 1.4.2 - -(assertion component) -- fixed string comparer bug that prevented updating the value - -(unit tests) -- unit test runner will log to stdout now -- fixes issues with opening tests in IDEs - -(integration tests) -- transform component is now visible for integration tests components -- added better support for mac's keyboard -- fixed 'succeed on assertion' for code generated assertion - -(other) -- minor bugfixes -- general improvments - -Version 1.4.1 - -- Fixed platform compilation issues -- Fixed typos in labels -- Removed docs and left a link to online docs -- Added Unity version and target platform to result files -- Other bugfixes - -Version 1.4 - -(integration tests) -- Platform runner will send the results back to the editor via TCP now -- Added naming convention for running tests in batch mode -- It's possible to cancel the run in the editor in between the tests now -- Added message filtering for integration tests results -- Added check for RegisterLogCallback in case something else overrides it -- Error messages will now fail integration tests -- Fixed dynamic integration tests not being properly reset -- Fixed platform runner for BlackBerry platform - -(assertion component) -- fixed the component editor - -(common) -- Made settings to be saved per project -- Fixed resolving icons when there are more UnityTestTools folders in the project -- Fixed process return code when running in batch mode - -Version 1.3.2 - -- Fixed integration tests performance issues - -Version 1.3.1 - -- Updated Japanese docs - -Version 1.3 - -Fixes: -(unit tests) -- nUnit will no longer change the Environment.CurrentDirectory when running tests -- fixed issues with asserting GameObject == null -(integration tests) -- fix the issue with passing or failing test in first frame -- fixed bug where ignored tests were still run in ITF -(assertion component) -- fixed resolving properties to include derived types - -Improvements: -(unit tests) -- refactored result renderer -- reenabled Random attribute -- added Category filter -- NSubstitute updated to version 1.7.2 -- result now will be dimmed after recompilation -- running tests in background will now work without having the window focused -- all assemblies in the project referencing 'nunit.framework' will now be included in the test list -(integration tests) -- updated platform exclusion mechanism -- refactored result renderer -- the runner should work even if the runner window is not focused -- added possibility to create integration tests from code -- the runner will now always run in background (if the window is not focused) -(assertion component) -- added API for creating assertions from code -- added new example -(common) -- GUI improvements -- you no longer need to change the path to icons when moving the tools to another directory -- made test details/results resizeable and scrollable -- added character escape for generated result XML - -Version 1.2.1 -- Fixed Unit Test Batch runner - -Version 1.2 -Fixes: -- Windows Store related compilation issues -- other -Improvements: -(unit tests) -- unit test runner can run in background now without having the runner window open -- unit test batch runner can take a result file path as a parameter -- changed undo system for unit test runner and UnityUnitTest base class -- execution time in now visible in test details -- fixed a bug with tests that inherit from a base test class -(integration tests) -- added hierarchical structure for integration tests -- added Player runner to automate running integration tests on platforms -- Integration tests batch runner can take a result directory as a parameter -- Integration tests batch runner can run tests on platforms -- results are rendered in a player -(assertion component) -- changed default failure messages -- it's possible to override failure action on comparer failure -- added code stripper for assertions. -- vast performance improvement -- fixed bugs -Other: -- "Hide in hierarchy" option was removed from integration test runner -- "Focus on selection" option was removed from integration test runner -- "Hide test runner" option was removed from integration test runner -- result files for unit tests and integration tests are now not generated when running tests from the editor -- UI improvements -- removed UnityScript and Boo examples -- WP8 compatibility fixes - -Version 1.1.1 -Other: -- Documentation in Japanese was added - -Version 1.1 -Fixes: -- fixed display error that happened when unit test class inherited from another TestFixture class -- fixed false positive result when "Succeed on assertions" was checked and no assertions were present in the test -- fixed XmlResultWriter to be generate XML file compatible with XSD scheme -- XmlResultWriter result writer was rewritten to remove XML libraries dependency -- Fixed an issue with a check that should be executed once after a specified frame in OnUpdate. -- added missing file UnityUnitTest.cs -Improvements: -- Added Japanese translation of the documentation -- ErrorPause value will be reverted to previous state after test run finishes -- Assertion Component will not copy reference to a GameObject if the GameObject is the same as the component is attached to. Instead, it will set the reference to the new GameObject. -- Integration tests batch runner can now run multiple scenes -- Unit test runner will now include tests written in UnityScript and Boo -- Unit tests will not run automatically if the compilation failes -- Added scene auto-save option to the Unit Test Runner -Other: -- changed icons -- restructured project files -- moved XmlResultWriter to Common folder -- added UnityScript and Boo unit tests examples -- added more unit tests examples -- Test runners visual adjustments - -Version 1.0 -- Initial release \ No newline at end of file diff --git a/Unity/Assets/UnityTestTools/changelog.txt.meta b/Unity/Assets/UnityTestTools/changelog.txt.meta deleted file mode 100644 index 8c28fefa4..000000000 --- a/Unity/Assets/UnityTestTools/changelog.txt.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 29b770d9107643740b69cb98b00430aa -TextScriptImporter: - userData: diff --git a/Unity/ProjectSettings/PresetManager.asset b/Unity/ProjectSettings/PresetManager.asset new file mode 100644 index 000000000..76fd8095d Binary files /dev/null and b/Unity/ProjectSettings/PresetManager.asset differ diff --git a/Unity/ProjectSettings/ProjectVersion.txt b/Unity/ProjectSettings/ProjectVersion.txt index ca1aa057c..a5b749263 100644 --- a/Unity/ProjectSettings/ProjectVersion.txt +++ b/Unity/ProjectSettings/ProjectVersion.txt @@ -1 +1,2 @@ -m_EditorVersion: 2017.1.0f3 +m_EditorVersion: 2019.1.8f1 +m_EditorVersionWithRevision: 2019.1.8f1 (7938dd008a75) diff --git a/Unity/ProjectSettings/VFXManager.asset b/Unity/ProjectSettings/VFXManager.asset new file mode 100644 index 000000000..69bf78e96 Binary files /dev/null and b/Unity/ProjectSettings/VFXManager.asset differ diff --git a/Unity/ProjectSettings/XRSettings.asset b/Unity/ProjectSettings/XRSettings.asset new file mode 100644 index 000000000..482590c19 --- /dev/null +++ b/Unity/ProjectSettings/XRSettings.asset @@ -0,0 +1,10 @@ +{ + "m_SettingKeys": [ + "VR Device Disabled", + "VR Device User Alert" + ], + "m_SettingValues": [ + "False", + "False" + ] +} \ No newline at end of file