Search Unity

Feedback Testing Systems

Discussion in 'Entity Component System' started by WAYNGames, May 18, 2020.

  1. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    992
    Hello,

    Just trying to find a proper way to test my DOTS code.

    Fore each test I'm building a new world with just the systems that I want to test and the entity need for the test I want to make.

    Then I do an assert on either the entities or the data that was manipuated by the system.
    In such a case, I may need to assert the content of a native container that was altered by a job.

    The issue is that I can't do the assert just after calling update on the systems because the job is not finished yet.

    It would be grate to be able to call the CompleteDependancy() of a SystemBase when testing.

    For now I workd around it with reflection :

    Code (CSharp):
    1.             typeof(SystemBase).GetMethod("CompleteDependency",
    2.     BindingFlags.NonPublic | BindingFlags.Instance).Invoke(SYSTEM_I_AM_TESTING, null);
    So IMO the protected void CompleteDependency(); should be made public.

    If that goes against so design rule, please let me know what is the recommanded way to test DOTS code.
     
    brunocoimbra and florianhanke like this.