Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Test Runner not showing any of my tests

Discussion in 'Package Manager' started by rmenapace, Jan 25, 2019.

  1. rmenapace

    rmenapace

    Joined:
    Jul 12, 2018
    Posts:
    6
    I am trying to create a package with some tests in it, that I would like the projects that use the package to be able to run. I set the folders and assemblies up as described in the docs:

    ... but the tests do not show up in the test runner. Is there something else I need to do to make this work?
     
  2. okcompute_unity

    okcompute_unity

    Joined:
    Jan 16, 2017
    Posts:
    756
    Hi @menaspace,

    How is your package referred to by the project? If the package is *embedded* or a *local* package, it should show up in the test runner automatically.

    Also, where did you get this doc? It looks to be missing some information.

    Regards,

    Pascal
     
  3. rmenapace

    rmenapace

    Joined:
    Jul 12, 2018
    Posts:
    6
  4. okcompute_unity

    okcompute_unity

    Joined:
    Jan 16, 2017
    Posts:
    756
    Thanks for sharing. This document is indeed lacking for testing packages. The intention was to give an idea of how a package is structured if you ever looked inside one provided by Unity. We are working on more complete documentation for 2019.1 release in the Unity user manual. The goal of this documentation will be to assist you in creating your custom package.

    Back to helping you. Have you *embedded* the package?

    Pascal
     
  5. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447
    • and by *embedded* you mean being put inside ProjectFolder/packages?
    • and by *local* ― inside ProjectFolder/Assets?
    • or vice versa?
    • or by *local* means referenced via "Add package from disk"?
    There are too many ways to consume a package. :D
     
  6. okcompute_unity

    okcompute_unity

    Joined:
    Jan 16, 2017
    Posts:
    756
    Hahaha. Indeed :p

    By *embedded*, I mean the package is physically located under the */Packages* folder
    By *local*, I mean referenced via "Add a package from disk". In the project manifest, the package version value set to a file path like "file:/some/path/"

    In both of these cases, your package tests should automatically show up in the test runner. If they don't, the issue is probably in the test configuration or assembly definition file settings.
     
    kamran-bigdely likes this.
  7. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447
    If a custom package is *embedded*, its tests are available in the test runner. If it's *added from disk*, they are not. Can it be a configuration problem? I thought it's a feature.
     
  8. okcompute_unity

    okcompute_unity

    Joined:
    Jan 16, 2017
    Posts:
    756
  9. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447
    I don't see it as a bug. Packages *added from disk* behave the same way packages referenced from the registry do.

    If I want to customize a package and test the changes and/or add new tests, I do it in the *embedded* local copy. Seems reasonable, unless I misunderstand the purpose of these locally referenced packages. I treat them as released, not as work-in-progress ones.

    I also don't want *added from disk* packages to spam my VS solution with their test projects. Right now they don't. However I do realize that being included in the solution is not the same thing as being available in the test runner.
     
  10. okcompute_unity

    okcompute_unity

    Joined:
    Jan 16, 2017
    Posts:
    756
    @alexzzzz , It is hard to meet everyone's expectation. They are a lot of users developing their packages using the
    file:
    project dependency. In 2019.2, we will support local package tarballs. Those will be defined as immutable (i.e. tests won't show up in the tests runner). You could use this way of introducing local packages in your project when available. The only requirement will be to tar the package folder. Hope this will resolve your issue!

    Regards,

    Pascal
     
    jorgegalvaominiclip likes this.
  11. okcompute_unity

    okcompute_unity

    Joined:
    Jan 16, 2017
    Posts:
    756
    Going back to this thread after a long time! I just realized that I made a mistake. Only *embedded* packages are automatically set as visible in the test runner. To make a *local* package visible in the test runner, you need to manually make the package *testable* . You can do so by adding a new
    testables
    attribute in the project manifest (Packages/manifest.json).

    Ex:

    Code (JavaScript):
    1. {
    2.   "dependencies": {
    3.     "a": "file:/some/path"
    4.   },
    5.   "testables" : ["a"]
    6. }
    Regards,

    Pascal
     
  12. zhouwensi

    zhouwensi

    Joined:
    Feb 13, 2020
    Posts:
    1
    Thanks, it works , carefull that add testables to project manifest (Packages/manifest.json), not the package json file.
     
    pocketandrew likes this.
  13. UnityMaru

    UnityMaru

    Community Engagement Manager PSM

    Joined:
    Mar 16, 2016
    Posts:
    1,227
    Hey there,

    I've spoken to the team who advise this does seem to be a potential bug. They'd love to get some report from you all on this. Please follow the process in the link below and let me know the bug report ID numbers so I can share this with the team separately.

    https://unity3d.com/unity/qa/bug-reporting
     
  14. jmguillemette

    jmguillemette

    Joined:
    Mar 4, 2015
    Posts:
    53
    Hi,
    I think im running into this same issue.

    I have followed the specifications for making a custom package but my runtime and editor tests simply do not show up in the Test Runner.
     
  15. jmguillemette

    jmguillemette

    Joined:
    Mar 4, 2015
    Posts:
    53
    I resolved my issue.

    I missed that the testables entry needs to be in the MANIFEST file not the Package file.