O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

RuntimeUnitTestToolkit for Unity

59.217 visualizações

Publicada em

https://github.com/neuecc/RuntimeUnitTestToolkit

Publicada em: Tecnologia
  • Seja o primeiro a comentar

RuntimeUnitTestToolkit for Unity

  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. UIはVisual Studioで より多機能
  5. 5. NUnitベースのが標準にのったね! が、しかし
  6. 6. 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. 既に大量に投下済み Released in GitHub https://github.com/neuecc/RuntimeUnitTestToolkit
  14. 14. 実行時テストにフォーカス 非同期テスト 実機転送テスト
  15. 15. 実行時テストにフォーカス 非同期テスト 実機転送テスト

×