Commit af571a61 authored by BlackAngle233's avatar BlackAngle233
Browse files

212

parent 1d9b5391
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NUnit.Framework.Interfaces; using NUnit.Framework.Interfaces;
using NUnit.Framework.Internal; using NUnit.Framework.Internal;
using NUnit.Framework.Internal.Filters; using NUnit.Framework.Internal.Filters;
using UnityEngine; using UnityEngine;
using UnityEngine.TestRunner.NUnitExtensions.Filters; using UnityEngine.TestRunner.NUnitExtensions.Filters;
using UnityEngine.TestTools.TestRunner.GUI; using UnityEngine.TestTools.TestRunner.GUI;
namespace UnityEditor.TestTools.TestRunner.Api namespace UnityEditor.TestTools.TestRunner.Api
{ {
[Serializable] [Serializable]
public class Filter public class Filter
{ {
[SerializeField] [SerializeField]
public TestMode testMode; public TestMode testMode;
[SerializeField] [SerializeField]
public string[] testNames; public string[] testNames;
[SerializeField] [SerializeField]
public string[] groupNames; public string[] groupNames;
[SerializeField] [SerializeField]
public string[] categoryNames; public string[] categoryNames;
[SerializeField] [SerializeField]
public string[] assemblyNames; public string[] assemblyNames;
[SerializeField] [SerializeField]
public BuildTarget? targetPlatform; public BuildTarget? targetPlatform;
internal TestRunnerFilter ToTestRunnerFilter() internal TestRunnerFilter ToTestRunnerFilter()
{ {
return new TestRunnerFilter() return new TestRunnerFilter()
{ {
testNames = testNames, testNames = testNames,
categoryNames = categoryNames, categoryNames = categoryNames,
groupNames = groupNames, groupNames = groupNames,
assemblyNames = assemblyNames assemblyNames = assemblyNames
}; };
} }
internal ITestFilter BuildNUnitFilter(bool synchronousOnly) internal ITestFilter BuildNUnitFilter(bool synchronousOnly)
{ {
var filters = new List<ITestFilter>(); var filters = new List<ITestFilter>();
if (testNames != null && testNames.Length != 0) if (testNames != null && testNames.Length != 0)
{ {
var nameFilter = new OrFilter(testNames.Select(n => new FullNameFilter(n)).ToArray()); var nameFilter = new OrFilter(testNames.Select(n => new FullNameFilter(n)).ToArray());
filters.Add(nameFilter); filters.Add(nameFilter);
} }
if (groupNames != null && groupNames.Length != 0) if (groupNames != null && groupNames.Length != 0)
{ {
var exactNamesFilter = new OrFilter(groupNames.Select(n => var exactNamesFilter = new OrFilter(groupNames.Select(n =>
{ {
var f = new FullNameFilter(n); var f = new FullNameFilter(n);
f.IsRegex = true; f.IsRegex = true;
return f; return f;
}).ToArray()); }).ToArray());
filters.Add(exactNamesFilter); filters.Add(exactNamesFilter);
} }
if (assemblyNames != null && assemblyNames.Length != 0) if (assemblyNames != null && assemblyNames.Length != 0)
{ {
var assemblyFilter = new OrFilter(assemblyNames.Select(c => new AssemblyNameFilter(c)).ToArray()); var assemblyFilter = new OrFilter(assemblyNames.Select(c => new AssemblyNameFilter(c)).ToArray());
filters.Add(assemblyFilter); filters.Add(assemblyFilter);
} }
if (categoryNames != null && categoryNames.Length != 0) if (categoryNames != null && categoryNames.Length != 0)
{ {
var categoryFilter = new OrFilter(categoryNames.Select(c => new CategoryFilterExtended(c) {IsRegex = true}).ToArray()); var categoryFilter = new OrFilter(categoryNames.Select(c => new CategoryFilterExtended(c) {IsRegex = true}).ToArray());
filters.Add(categoryFilter); filters.Add(categoryFilter);
} }
if (synchronousOnly) if (synchronousOnly)
{ {
filters.Add(new SynchronousFilter()); filters.Add(new SynchronousFilter());
} }
return filters.Count == 0 ? TestFilter.Empty : new AndFilter(filters.ToArray()); return filters.Count == 0 ? TestFilter.Empty : new AndFilter(filters.ToArray());
} }
} }
} }
fileFormatVersion: 2 fileFormatVersion: 2
guid: 05f92e4a2414cb144a92157752dfa324 guid: 05f92e4a2414cb144a92157752dfa324
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
namespace UnityEditor.TestTools.TestRunner.Api namespace UnityEditor.TestTools.TestRunner.Api
{ {
public interface ICallbacks public interface ICallbacks
{ {
void RunStarted(ITestAdaptor testsToRun); void RunStarted(ITestAdaptor testsToRun);
void RunFinished(ITestResultAdaptor result); void RunFinished(ITestResultAdaptor result);
void TestStarted(ITestAdaptor test); void TestStarted(ITestAdaptor test);
void TestFinished(ITestResultAdaptor result); void TestFinished(ITestResultAdaptor result);
} }
} }
fileFormatVersion: 2 fileFormatVersion: 2
guid: 93eea84e53d0226479c9a584f19427b5 guid: 93eea84e53d0226479c9a584f19427b5
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
using NUnit.Framework.Interfaces; using NUnit.Framework.Interfaces;
namespace UnityEditor.TestTools.TestRunner.Api namespace UnityEditor.TestTools.TestRunner.Api
{ {
internal interface ICallbacksDelegator internal interface ICallbacksDelegator
{ {
void RunStarted(ITest testsToRun); void RunStarted(ITest testsToRun);
void RunStartedRemotely(byte[] testsToRunData); void RunStartedRemotely(byte[] testsToRunData);
void RunFinished(ITestResult testResults); void RunFinished(ITestResult testResults);
void RunFinishedRemotely(byte[] testResultsData); void RunFinishedRemotely(byte[] testResultsData);
void RunFailed(string failureMessage); void RunFailed(string failureMessage);
void TestStarted(ITest test); void TestStarted(ITest test);
void TestStartedRemotely(byte[] testStartedData); void TestStartedRemotely(byte[] testStartedData);
void TestFinished(ITestResult result); void TestFinished(ITestResult result);
void TestFinishedRemotely(byte[] testResultsData); void TestFinishedRemotely(byte[] testResultsData);
void TestTreeRebuild(ITest test); void TestTreeRebuild(ITest test);
} }
} }
\ No newline at end of file
fileFormatVersion: 2 fileFormatVersion: 2
guid: 8f8f74fe8e363da42875d9cab025d3b2 guid: 8f8f74fe8e363da42875d9cab025d3b2
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
namespace UnityEditor.TestTools.TestRunner.Api namespace UnityEditor.TestTools.TestRunner.Api
{ {
internal interface ICallbacksHolder internal interface ICallbacksHolder
{ {
void Add(ICallbacks callback, int priority); void Add(ICallbacks callback, int priority);
void Remove(ICallbacks callback); void Remove(ICallbacks callback);
ICallbacks[] GetAll(); ICallbacks[] GetAll();
void Clear(); void Clear();
} }
} }
\ No newline at end of file
fileFormatVersion: 2 fileFormatVersion: 2
guid: d742f2caefd9f934d9f19dad07a08e6f guid: d742f2caefd9f934d9f19dad07a08e6f
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
namespace UnityEditor.TestTools.TestRunner.Api namespace UnityEditor.TestTools.TestRunner.Api
{ {
public interface IErrorCallbacks : ICallbacks public interface IErrorCallbacks : ICallbacks
{ {
void OnError(string message); void OnError(string message);
} }
} }
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1a06c562b0c5eb046bcb876a29f93c98 guid: 1a06c562b0c5eb046bcb876a29f93c98
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
using System.Collections.Generic; using System.Collections.Generic;
using NUnit.Framework.Interfaces; using NUnit.Framework.Interfaces;
namespace UnityEditor.TestTools.TestRunner.Api namespace UnityEditor.TestTools.TestRunner.Api
{ {
public interface ITestAdaptor public interface ITestAdaptor
{ {
string Id { get; } string Id { get; }
string Name { get; } string Name { get; }
string FullName { get; } string FullName { get; }
int TestCaseCount { get; } int TestCaseCount { get; }
bool HasChildren { get; } bool HasChildren { get; }
bool IsSuite { get; } bool IsSuite { get; }
IEnumerable<ITestAdaptor> Children { get; } IEnumerable<ITestAdaptor> Children { get; }
ITestAdaptor Parent { get; } ITestAdaptor Parent { get; }
int TestCaseTimeout { get; } int TestCaseTimeout { get; }
ITypeInfo TypeInfo { get; } ITypeInfo TypeInfo { get; }
IMethodInfo Method { get; } IMethodInfo Method { get; }
string[] Categories { get; } string[] Categories { get; }
bool IsTestAssembly { get; } bool IsTestAssembly { get; }
RunState RunState { get; } RunState RunState { get; }
string Description { get; } string Description { get; }
string SkipReason { get; } string SkipReason { get; }
string ParentId { get; } string ParentId { get; }
string ParentFullName { get; } string ParentFullName { get; }
string UniqueName { get; } string UniqueName { get; }
string ParentUniqueName { get; } string ParentUniqueName { get; }
int ChildIndex { get; } int ChildIndex { get; }
TestMode TestMode { get; } TestMode TestMode { get; }
} }
} }
fileFormatVersion: 2 fileFormatVersion: 2
guid: 85dd7af03f02aea4aae13a3945e3b313 guid: 85dd7af03f02aea4aae13a3945e3b313
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
using System.Collections.Generic; using System.Collections.Generic;
using NUnit.Framework.Interfaces; using NUnit.Framework.Interfaces;
using UnityEngine.TestRunner.TestLaunchers; using UnityEngine.TestRunner.TestLaunchers;
namespace UnityEditor.TestTools.TestRunner.Api namespace UnityEditor.TestTools.TestRunner.Api
{ {
internal interface ITestAdaptorFactory internal interface ITestAdaptorFactory
{ {
ITestAdaptor Create(ITest test); ITestAdaptor Create(ITest test);
ITestAdaptor Create(RemoteTestData testData); ITestAdaptor Create(RemoteTestData testData);
ITestResultAdaptor Create(ITestResult testResult); ITestResultAdaptor Create(ITestResult testResult);
ITestResultAdaptor Create(RemoteTestResultData testResult, RemoteTestResultDataWithTestData allData); ITestResultAdaptor Create(RemoteTestResultData testResult, RemoteTestResultDataWithTestData allData);
ITestAdaptor BuildTree(RemoteTestResultDataWithTestData data); ITestAdaptor BuildTree(RemoteTestResultDataWithTestData data);
IEnumerator<ITestAdaptor> BuildTreeAsync(RemoteTestResultDataWithTestData data); IEnumerator<ITestAdaptor> BuildTreeAsync(RemoteTestResultDataWithTestData data);
void ClearResultsCache(); void ClearResultsCache();
void ClearTestsCache(); void ClearTestsCache();
} }
} }
fileFormatVersion: 2 fileFormatVersion: 2
guid: 803abab0f7e17044db56f8760186dbd1 guid: 803abab0f7e17044db56f8760186dbd1
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using NUnit.Framework.Interfaces; using NUnit.Framework.Interfaces;
namespace UnityEditor.TestTools.TestRunner.Api namespace UnityEditor.TestTools.TestRunner.Api
{ {
public interface ITestResultAdaptor public interface ITestResultAdaptor
{ {
ITestAdaptor Test { get; } ITestAdaptor Test { get; }
string Name { get; } string Name { get; }
/// <summary>Gets the full name of the test result</summary> /// <summary>Gets the full name of the test result</summary>
string FullName { get; } string FullName { get; }
string ResultState { get; } string ResultState { get; }
TestStatus TestStatus { get; } TestStatus TestStatus { get; }
/// <summary>Gets the elapsed time for running the test in seconds</summary> /// <summary>Gets the elapsed time for running the test in seconds</summary>
double Duration { get; } double Duration { get; }
/// <summary>Gets or sets the time the test started running.</summary> /// <summary>Gets or sets the time the test started running.</summary>
DateTime StartTime { get; } DateTime StartTime { get; }
/// <summary>Gets or sets the time the test finished running.</summary> /// <summary>Gets or sets the time the test finished running.</summary>
DateTime EndTime { get; } DateTime EndTime { get; }
/// <summary> /// <summary>
/// Gets the message associated with a test /// Gets the message associated with a test
/// failure or with not running the test /// failure or with not running the test
/// </summary> /// </summary>
string Message { get; } string Message { get; }
/// <summary> /// <summary>
/// Gets any stacktrace associated with an /// Gets any stacktrace associated with an
/// error or failure. Not available in /// error or failure. Not available in
/// the Compact Framework 1.0. /// the Compact Framework 1.0.
/// </summary> /// </summary>
string StackTrace { get; } string StackTrace { get; }
/// <summary> /// <summary>
/// Gets the number of asserts executed /// Gets the number of asserts executed
/// when running the test and all its children. /// when running the test and all its children.
/// </summary> /// </summary>
int AssertCount { get; } int AssertCount { get; }
/// <summary> /// <summary>
/// Gets the number of test cases that failed /// Gets the number of test cases that failed
/// when running the test and all its children. /// when running the test and all its children.
/// </summary> /// </summary>
int FailCount { get; } int FailCount { get; }
/// <summary> /// <summary>
/// Gets the number of test cases that passed /// Gets the number of test cases that passed
/// when running the test and all its children. /// when running the test and all its children.
/// </summary> /// </summary>
int PassCount { get; } int PassCount { get; }
/// <summary> /// <summary>
/// Gets the number of test cases that were skipped /// Gets the number of test cases that were skipped
/// when running the test and all its children. /// when running the test and all its children.
/// </summary> /// </summary>
int SkipCount { get; } int SkipCount { get; }
/// <summary> /// <summary>
/// Gets the number of test cases that were inconclusive /// Gets the number of test cases that were inconclusive
/// when running the test and all its children. /// when running the test and all its children.
/// </summary> /// </summary>
int InconclusiveCount { get; } int InconclusiveCount { get; }
/// <summary> /// <summary>
/// Indicates whether this result has any child results. /// Indicates whether this result has any child results.
/// Accessing HasChildren should not force creation of the /// Accessing HasChildren should not force creation of the
/// Children collection in classes implementing this interface. /// Children collection in classes implementing this interface.
/// </summary> /// </summary>
bool HasChildren { get; } bool HasChildren { get; }
/// <summary>Gets the the collection of child results.</summary> /// <summary>Gets the the collection of child results.</summary>
IEnumerable<ITestResultAdaptor> Children { get; } IEnumerable<ITestResultAdaptor> Children { get; }
/// <summary>Gets any text output written to this result.</summary> /// <summary>Gets any text output written to this result.</summary>
string Output { get; } string Output { get; }
TNode ToXml(); TNode ToXml();
} }
} }
fileFormatVersion: 2 fileFormatVersion: 2
guid: 4f90cfe4bf5cfb44f84a5b11387f2a42 guid: 4f90cfe4bf5cfb44f84a5b11387f2a42
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
using System; using System;
namespace UnityEditor.TestTools.TestRunner.Api namespace UnityEditor.TestTools.TestRunner.Api
{ {
public interface ITestRunSettings : IDisposable public interface ITestRunSettings : IDisposable
{ {
void Apply(); void Apply();
} }
} }
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2ae2ce6274819484fa8747a28cebdf3a guid: 2ae2ce6274819484fa8747a28cebdf3a
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
using System; using System;
namespace UnityEditor.TestTools.TestRunner.Api namespace UnityEditor.TestTools.TestRunner.Api
{ {
internal interface ITestRunnerApi internal interface ITestRunnerApi
{ {
string Execute(ExecutionSettings executionSettings); string Execute(ExecutionSettings executionSettings);
void RegisterCallbacks<T>(T testCallbacks, int priority = 0) where T : ICallbacks; void RegisterCallbacks<T>(T testCallbacks, int priority = 0) where T : ICallbacks;
void UnregisterCallbacks<T>(T testCallbacks) where T : ICallbacks; void UnregisterCallbacks<T>(T testCallbacks) where T : ICallbacks;
void RetrieveTestList(TestMode testMode, Action<ITestAdaptor> callback); void RetrieveTestList(TestMode testMode, Action<ITestAdaptor> callback);
} }
} }
fileFormatVersion: 2 fileFormatVersion: 2
guid: a7842a837a4b13e41ae16193db753418 guid: a7842a837a4b13e41ae16193db753418
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment