Search Unity

Why does the package manager download test folders/assemblies to the user machine?

Discussion in 'Package Manager' started by Xarbrough, Jun 27, 2019.

  1. Xarbrough


    Dec 11, 2014
    This is more a curious question than any sort of criticism, but I wanted to know why packages include their test code in a way that the package manager downloads this part of the package to the local machine.

    In Unity projects, users can't run tests for packages, right? It's only something the original developer or other contributors use when their package code is within their own development project environment.

    Would it actually make sense to provide means to let users run tests for packages? Maybe to validate that they run as expected within the actual project setup and find potential side-effects early.

    Or would it make sense to strip these files from the download to save time and disk space?
  2. okcompute_unity


    Unity Technologies

    Jan 16, 2017
    Hi @Xarbrough,

    The intention behind providing tests inside a package is to let you make a change locally and test that it still works. So, if you embed a Unity package in your project, you can run the tests. You can try it if you want. Locate the package content on your machine. In recent Unity versions, look into the
    folder. Copy a package that you know have tests in
    (Make sure you copy the package root folder).

    The package test should now show up in the tests runner.

    Note: We are thinking of changing this approach. We want to fetch the tests from the package Git source repository if available on demand. The drawback of the current approach is that it requires all users to download the tests even though they don't need it.


    Xarbrough likes this.
  3. Xarbrough


    Dec 11, 2014
    Good to know! I haven't tried the embed functionality yet, that makes more sense and is a nice way to handle things! I'll probably use it to make some temporary modifications or quick-bug fixes for packages.

    I agree, that the perfect solution would be to make the tests or additional content of the package repositories available on demand. :)
    okcompute_unity likes this.
  4. Stormy102


    Jan 17, 2014
    We have actually integrated the Unity tests as part of our general Continuous Integration. No particular reason - they don't take up extra time (unless milliseconds count) but its good for peace of mind.