Seans/seperate tests into package (#5)

Separate tests into a separate package to avoid nunit compilation errors we sporadically see where this package is used. Also, setup nunit refs in a better way and include moq so we can add better unit tests
This commit is contained in:
Sean Stolberg 2022-08-17 08:59:53 -07:00 коммит произвёл GitHub Enterprise
Родитель 23c1f16426
Коммит a3fa39dc0b
8 изменённых файлов: 60 добавлений и 32 удалений

Просмотреть файл

@ -1,8 +1,9 @@
editors:
- version: trunk
- version: 2021.2
- version: 2020.1
- version: 2019.4
- version: 2022.2
- version: 2022.1
- version: 2021.3
- version: 2020.3
platforms:
- name: Windows64
os: windows

Просмотреть файл

@ -1,12 +1,14 @@
editors:
- version: trunk
cmd: -u trunk
- version: 2021.2
cmd: -u 2021.2/staging
- version: 2020.1
cmd: -u 2020.2/staging
- version: 2019.4
cmd: -u 2019.4/staging
- version: 2022.2
cmd: -u 2022.2/staging
- version: 2022.1
cmd: -u 2022.1/staging
- version: 2021.3
cmd: -u 2021.3/staging
- version: 2020.3
cmd: -u 2020.3/staging
platforms:
# Exhaustive list of operating systems and editor components used by all jobs so the preparation jobs
# can make sure all editors are cached on cheap vms before starting the heavy duty machines for running tests

Просмотреть файл

@ -4,6 +4,9 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [0.2.0-preview] - 2022-08-16
- Seperate tests into a seperate package to avoid nunit compilation errors we sporadically see where this package is used. Also, setup nunit refs in a better way and include moq so we can add better unit tests.
## [0.1.6-preview] - 2022-02-08
- Add args to handle custom input arguments used for XR tests
@ -28,5 +31,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [0.1.0-preview] - 2019-06-18
### This is the first release of *com.unity.xr.test.runtimesettings*.
- This is the first release of *com.unity.xr.test.runtimesettings*.

Просмотреть файл

@ -3,7 +3,9 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
#if NUNIT_AVAILABLE
using NUnit.Framework;
#endif
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
@ -51,7 +53,6 @@ namespace com.unity.test.metadatamanager
if (settings == null)
{
//Debug.Log("sean: settings is null after loading CurrentSettings from Resources");
#if UNITY_EDITOR
settings = ScriptableObject.CreateInstance<CurrentSettings>();
@ -76,7 +77,7 @@ namespace com.unity.test.metadatamanager
public string GetCustomMetadata()
{
var metaDatastring = string.Empty;
//Debug.Log(Instance != null ? "sean: Instance is not null" : "sean: Instance is null");
if (Instance != null)
{
var customMetaData = new List<KeyValuePair<string, string>>
@ -193,7 +194,7 @@ namespace com.unity.test.metadatamanager
metaDatastring = metadata.Remove(0, 1).ToString();
}
//Debug.Log(string.Format("sean: metadata string is {0}", metaDatastring));
return metaDatastring;
}
@ -204,12 +205,14 @@ namespace com.unity.test.metadatamanager
foreach (var metadata in tempMetaDataList)
{
#if NUNIT_AVAILABLE
if (TestContext.CurrentContext.Test.Properties.Keys.Any(k => k.Contains(metadata.Key)))
{
var metadataFromPropertyBag = (string) TestContext.CurrentContext.Test.Properties.Get(metadata.Key);
customMetaData.Remove(metadata);
customMetaData.Add(new KeyValuePair<string, string>(metadata.Key, metadataFromPropertyBag));
}
#endif
}
}

Просмотреть файл

@ -1,16 +1,22 @@
{
"name": "com.unity.test.metadata-manager",
"rootNamespace": "",
"references": [
"com.unity.ext.nunit"
],
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [],
"versionDefines": [],
"versionDefines": [
{
"name": "com.unity.ext.nunit",
"expression": "1.0.0",
"define": "NUNIT_AVAILABLE"
}
],
"noEngineReferences": false
}

6
Tests/.tests.json Normal file
Просмотреть файл

@ -0,0 +1,6 @@
{
"createSeparatePackage": true,
"dependencies": {
"nuget.moq": "1.0.0"
}
}

Просмотреть файл

@ -1,21 +1,29 @@
{
"name": "MetaDataManagerTests",
"name": "com.unity.test.metadata-manager.tests",
"rootNamespace": "",
"references": [
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"com.unity.tests.performance.runtimesettings",
"com.unity.ext.nunit"
"com.unity.test.metadata-manager"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll",
"Moq.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [],
"versionDefines": [
{
"name": "nuget.moq",
"expression": "1.0.0",
"define": "NUGET_MOQ_AVAILABLE"
}
],
"noEngineReferences": false
}

Просмотреть файл

@ -1,12 +1,11 @@
{
"name": "com.unity.test.metadata-manager",
"displayName": "Unity Tests Metadata Manager",
"version": "0.1.6-preview",
"unity": "2019.4",
"version": "0.2.0-preview",
"unity": "2020.3",
"description": "Used to manage custom metadata for Unity performance tests.",
"dependencies": {
"com.unity.ext.nunit": "2.0.0",
"com.unity.test-framework": "1.1.0",
"com.unity.nuget.newtonsoft-json": "2.0.0-preview"
}
"com.unity.nuget.newtonsoft-json": "2.0.0-preview",
"com.unity.ext.nunit": "1.0.0"
}
}