Search Unity

Unit Test and Integration Test

Discussion in 'Entity Component System' started by YuriyVotintsev, Mar 29, 2018.

  1. YuriyVotintsev

    YuriyVotintsev

    Joined:
    Jun 11, 2013
    Posts:
    93
    I have played a bit with ECS and really like it. Now I want to make something more serious and make my code more reliable by using unit and integration test of my systems. And I have some questions:
    0) How to create System in test? Should I use "new MySystem()", or some ecs api?
    1) How to [Inject] component groups to system in test?
    2) How to test interaction of systems? I don't want to create all systems for each test (when game become big enough it will be too slow). I want to create only systems required for this test.
    3) In multiple system setup - how to invoke update of all added systems taking in accound UpdateBefore and UpdateAfter attributes?
     
    Flurgle likes this.
  2. Lucas-Meijer

    Lucas-Meijer

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    175
    If you look in the packages folder for the ECS packages, you will not only find all the sourcecode for ECS, but also all our own unit tests, that you can use for inspiration on how to write tests for ECS related code.
     
    Corvwyn and FROS7 like this.