Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question configure custom package with unit tests

Discussion in 'Package Manager' started by jmguillemette, Sep 29, 2021.

  1. jmguillemette

    jmguillemette

    Joined:
    Mar 4, 2015
    Posts:
    53
    I have a custom package with some reusable code in it.
    I want to move my unit tests into this package.
    I have been following the standards outlined on this page:

    https://docs.unity3d.com/2021.2/Documentation/Manual/cus-tests.html

    But no matter what i try. The unit tests are never recognized by the Test Runner when stored in the package. They work fine outside the package.. but when placed into the package they are not seen.

    Does anyone have a working example i can snoop through to figure out what I am missing?
    Is there a trick to this setup that is not obvious?

    Thanks
    J.
     
  2. jmguillemette

    jmguillemette

    Joined:
    Mar 4, 2015
    Posts:
    53
    I have done some more experiments to try and resolve my issue:

    I created a very simple package. It contains one runtime and one editor script. It contains one runtime and one editor unit test..

    When the package is manually dropped into the packages folder it works. The unit tests are visible:

    upload_2021-10-1_0-21-59.png

    but when the same package is loaded as a "local" package the unit test are no longer recognized.

    upload_2021-10-1_0-22-51.png


    Setting the
    "testables"
    property in the package.json file appears to have no effect on having the unit tests be shown/recognized.

    I can really use some help on this.
     
  3. jmguillemette

    jmguillemette

    Joined:
    Mar 4, 2015
    Posts:
    53
    SOLVED - i missed that the testables entry needs to be made in the MANIFEST file not the PACKAGE file.
     
  4. jmguillemette

    jmguillemette

    Joined:
    Mar 4, 2015
    Posts:
    53
    If anyone finds this thread.. and is encountering problems.. my experience inspired me to create a new package I may release on the asset store: