Work
http://grani.jp/
Unity
Private
http://neue.cc/
@neuecc
https://github.com/neuecc/UniRx
UnitTest
MSTest or xUnit.net
xUnit.net
NUnit
Visual Studio UI
More multi functional
Standard on NUnit basedtool
But...
I want to run on IL2CPP
RuntimeUnitTestToolkit
Demo…
// make unit test on plain C# class
public class SampleGroup
{
// all public methods are automatically registered in test group
public void SumTest()
{
var x = int.Parse("100");
var y = int.Parse("200");
// using RuntimeUnitTestToolkit;
// 'Is' is Assertion method, same as Assert(actual, expected)
(x + y).Is(300);
}
}
public class SampleGroup
{
// return type 'IEnumerator' is marked as async test method
public IEnumerator AsyncTest()
{
var testObject = new GameObject("Test");
// wait asynchronous coroutine(UniRx coroutine runnner)
yield return MainThreadDispatcher.StartCoroutine(MoveToRight(testObject));
// assrtion
testObject.transform.position.x.Is(60);
GameObject.Destroy(testObject);
}
IEnumerator MoveToRight(GameObject o)
{
for (int i = 0; i < 60; i++)
{
var p = o.transform.position;
p.x += 1;
o.transform.position = p;
yield return null;
}
}
public static class UnitTestLoader
{
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
public static void Register()
{
// setup created test class to RegisterAllMethods<T>
UnitTest.RegisterAllMethods<SampleGroup>();
// and add other classes
}
}
Conclusion
UniRx is supported by RuntimeUnitTestToolkit
Released in GitHub
https://github.com/neuecc/RuntimeUnitTestToolkit
Focus on play time test
Supports Asynchronous test
Actual machine test

RuntimeUnitTestToolkit for Unity(English)

  • 2.
  • 3.
  • 4.
  • 5.
    Visual Studio UI Moremulti functional
  • 6.
    Standard on NUnitbasedtool But...
  • 7.
    I want torun on IL2CPP
  • 8.
  • 9.
  • 11.
    // make unittest on plain C# class public class SampleGroup { // all public methods are automatically registered in test group public void SumTest() { var x = int.Parse("100"); var y = int.Parse("200"); // using RuntimeUnitTestToolkit; // 'Is' is Assertion method, same as Assert(actual, expected) (x + y).Is(300); } }
  • 12.
    public class SampleGroup { //return type 'IEnumerator' is marked as async test method public IEnumerator AsyncTest() { var testObject = new GameObject("Test"); // wait asynchronous coroutine(UniRx coroutine runnner) yield return MainThreadDispatcher.StartCoroutine(MoveToRight(testObject)); // assrtion testObject.transform.position.x.Is(60); GameObject.Destroy(testObject); } IEnumerator MoveToRight(GameObject o) { for (int i = 0; i < 60; i++) { var p = o.transform.position; p.x += 1; o.transform.position = p; yield return null; } }
  • 13.
    public static classUnitTestLoader { [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] public static void Register() { // setup created test class to RegisterAllMethods<T> UnitTest.RegisterAllMethods<SampleGroup>(); // and add other classes } }
  • 14.
  • 15.
    UniRx is supportedby RuntimeUnitTestToolkit Released in GitHub https://github.com/neuecc/RuntimeUnitTestToolkit
  • 16.
    Focus on playtime test Supports Asynchronous test Actual machine test