Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

RuntimeUnitTestToolkit for Unity(English)

9,771 views

Published on

https://github.com/neuecc/RuntimeUnitTestToolkit

Published in: Technology
  • Be the first to comment

RuntimeUnitTestToolkit for Unity(English)

  1. 1. Work http://grani.jp/ Unity Private http://neue.cc/ @neuecc https://github.com/neuecc/UniRx
  2. 2. UnitTest
  3. 3. MSTest or xUnit.net xUnit.net NUnit
  4. 4. Visual Studio UI More multi functional
  5. 5. Standard on NUnit basedtool But...
  6. 6. I want to run on IL2CPP
  7. 7. RuntimeUnitTestToolkit
  8. 8. Demo…
  9. 9. // 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); } }
  10. 10. 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; } }
  11. 11. 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 } }
  12. 12. Conclusion
  13. 13. UniRx is supported by RuntimeUnitTestToolkit Released in GitHub https://github.com/neuecc/RuntimeUnitTestToolkit
  14. 14. Focus on play time test Supports Asynchronous test Actual machine test

×