Initial
test
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using NUnit.Framework.Interfaces;
|
||||
|
||||
namespace UnityEngine.TestRunner.TestLaunchers
|
||||
{
|
||||
internal interface IRemoteTestResultDataFactory
|
||||
{
|
||||
RemoteTestResultDataWithTestData CreateFromTestResult(ITestResult result);
|
||||
RemoteTestResultDataWithTestData CreateFromTest(ITest test);
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 874c0713cdc44f549b0161750b48d2c2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace UnityEngine.TestRunner.TestLaunchers
|
||||
{
|
||||
internal static class PlayerConnectionMessageIds
|
||||
{
|
||||
public static Guid runStartedMessageId { get { return new Guid("6a7f53dd-4672-461d-a7b5-9467e9393fd3"); } }
|
||||
public static Guid runFinishedMessageId { get { return new Guid("ffb622fc-34ad-4901-8d7b-47fb04b0bdd4"); } }
|
||||
public static Guid testStartedMessageId { get { return new Guid("b54d241e-d88d-4dba-8c8f-ee415d11c030"); } }
|
||||
public static Guid testFinishedMessageId { get { return new Guid("72f7b7f4-6829-4cd1-afde-78872b9d5adc"); } }
|
||||
public static Guid quitPlayerMessageId { get { return new Guid("ab44bfe0-bb50-4ee6-9977-69d2ea6bb3a0"); } }
|
||||
public static Guid playerAliveHeartbeat { get { return new Guid("8c0c307b-f7fd-4216-8623-35b4b3f55fb6"); } }
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 41d60936b62cc6d4ca7fe628b22b0e40
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NUnit.Framework.Interfaces;
|
||||
using NUnit.Framework.Internal;
|
||||
using UnityEngine.TestRunner.NUnitExtensions;
|
||||
|
||||
namespace UnityEngine.TestRunner.TestLaunchers
|
||||
{
|
||||
[Serializable]
|
||||
internal class RemoteTestData
|
||||
{
|
||||
public string id;
|
||||
public string name;
|
||||
public string fullName;
|
||||
public int testCaseCount;
|
||||
public int ChildIndex;
|
||||
public bool hasChildren;
|
||||
public bool isSuite;
|
||||
public string[] childrenIds;
|
||||
public int testCaseTimeout;
|
||||
public string[] Categories;
|
||||
public bool IsTestAssembly;
|
||||
public RunState RunState;
|
||||
public string Description;
|
||||
public string SkipReason;
|
||||
public string ParentId;
|
||||
public string UniqueName;
|
||||
public string ParentUniqueName;
|
||||
public string ParentFullName;
|
||||
|
||||
internal RemoteTestData(ITest test)
|
||||
{
|
||||
id = test.Id;
|
||||
name = test.Name;
|
||||
fullName = test.FullName;
|
||||
testCaseCount = test.TestCaseCount;
|
||||
ChildIndex = -1;
|
||||
if (test.Properties["childIndex"].Count > 0)
|
||||
{
|
||||
ChildIndex = (int)test.Properties["childIndex"][0];
|
||||
}
|
||||
hasChildren = test.HasChildren;
|
||||
isSuite = test.IsSuite;
|
||||
childrenIds = test.Tests.Select(t => t.Id).ToArray();
|
||||
Categories = test.GetAllCategoriesFromTest().ToArray();
|
||||
IsTestAssembly = test is TestAssembly;
|
||||
RunState = (RunState)Enum.Parse(typeof(RunState), test.RunState.ToString());
|
||||
Description = (string)test.Properties.Get(PropertyNames.Description);
|
||||
SkipReason = test.GetSkipReason();
|
||||
ParentId = test.GetParentId();
|
||||
UniqueName = test.GetUniqueName();
|
||||
ParentUniqueName = test.GetParentUniqueName();
|
||||
ParentFullName = test.GetParentFullName();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b135ec222fdcd11468014c90d11d6821
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework.Interfaces;
|
||||
|
||||
namespace UnityEngine.TestRunner.TestLaunchers
|
||||
{
|
||||
[Serializable]
|
||||
internal class RemoteTestResultData
|
||||
{
|
||||
public string testId;
|
||||
public string name;
|
||||
public string fullName;
|
||||
public string resultState;
|
||||
public TestStatus testStatus;
|
||||
public double duration;
|
||||
public DateTime startTime;
|
||||
public DateTime endTime;
|
||||
public string message;
|
||||
public string stackTrace;
|
||||
public int assertCount;
|
||||
public int failCount;
|
||||
public int passCount;
|
||||
public int skipCount;
|
||||
public int inconclusiveCount;
|
||||
public bool hasChildren;
|
||||
public string output;
|
||||
public string xml;
|
||||
public string[] childrenIds;
|
||||
|
||||
internal RemoteTestResultData(ITestResult result)
|
||||
{
|
||||
testId = result.Test.Id;
|
||||
name = result.Name;
|
||||
fullName = result.FullName;
|
||||
resultState = result.ResultState.ToString();
|
||||
testStatus = result.ResultState.Status;
|
||||
duration = result.Duration;
|
||||
startTime = result.StartTime;
|
||||
endTime = result.EndTime;
|
||||
message = result.Message;
|
||||
stackTrace = result.StackTrace;
|
||||
assertCount = result.AssertCount;
|
||||
failCount = result.FailCount;
|
||||
passCount = result.PassCount;
|
||||
skipCount = result.SkipCount;
|
||||
inconclusiveCount = result.InconclusiveCount;
|
||||
hasChildren = result.HasChildren;
|
||||
output = result.Output;
|
||||
xml = result.ToXml(true).OuterXml;
|
||||
childrenIds = result.Children.Select(child => child.Test.Id).ToArray();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 03e4d63665d06f04c8a6cf68133c1592
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,51 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework.Interfaces;
|
||||
using UnityEngine.TestRunner.NUnitExtensions.Runner;
|
||||
|
||||
namespace UnityEngine.TestRunner.TestLaunchers
|
||||
{
|
||||
internal class RemoteTestResultDataFactory : IRemoteTestResultDataFactory
|
||||
{
|
||||
public RemoteTestResultDataWithTestData CreateFromTestResult(ITestResult result)
|
||||
{
|
||||
var tests = CreateTestDataList(result.Test);
|
||||
tests.First().testCaseTimeout = UnityTestExecutionContext.CurrentContext.TestCaseTimeout;
|
||||
return new RemoteTestResultDataWithTestData()
|
||||
{
|
||||
results = CreateTestResultDataList(result),
|
||||
tests = tests
|
||||
};
|
||||
}
|
||||
|
||||
public RemoteTestResultDataWithTestData CreateFromTest(ITest test)
|
||||
{
|
||||
var tests = CreateTestDataList(test);
|
||||
if (UnityTestExecutionContext.CurrentContext != null)
|
||||
{
|
||||
tests.First().testCaseTimeout = UnityTestExecutionContext.CurrentContext.TestCaseTimeout;
|
||||
}
|
||||
|
||||
return new RemoteTestResultDataWithTestData()
|
||||
{
|
||||
tests = tests
|
||||
};
|
||||
}
|
||||
|
||||
private RemoteTestData[] CreateTestDataList(ITest test)
|
||||
{
|
||||
var list = new List<RemoteTestData>();
|
||||
list.Add(new RemoteTestData(test));
|
||||
list.AddRange(test.Tests.SelectMany(CreateTestDataList));
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
private static RemoteTestResultData[] CreateTestResultDataList(ITestResult result)
|
||||
{
|
||||
var list = new List<RemoteTestResultData>();
|
||||
list.Add(new RemoteTestResultData(result));
|
||||
list.AddRange(result.Children.SelectMany(CreateTestResultDataList));
|
||||
return list.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 826b6becaef90fb458eedebe4c2f3664
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework.Interfaces;
|
||||
using UnityEngine.TestRunner.NUnitExtensions.Runner;
|
||||
|
||||
namespace UnityEngine.TestRunner.TestLaunchers
|
||||
{
|
||||
[Serializable]
|
||||
internal class RemoteTestResultDataWithTestData
|
||||
{
|
||||
public RemoteTestResultData[] results;
|
||||
public RemoteTestData[] tests;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 475e3699f219c854f8581a9838135002
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user