tl;dr: is this supposed to work? I’m generating tests for individual prefabs found in Resources.LoadAll()
So an example given for ValueSource shows it pointing to a static int array. I’m guessing at compile time, this array gets traversed, and code is generated behind the scenes, with a unique [UnityTest] instance for each element in the array.
But, instead of something pre-defined and static, I wanted to populate my tests with the dynamic results of Resources.LoadAll(). So, for each prefab in a specific resources path, I wanted a test to be created, receiving that prefab so I could instantiate it and have tests run upon it. So instead of a hand written collection of string paths to prefabs in Resources, it uses the (dynamic) results of Resources.LoadAll() with specifiers I give it like subfolders and component types.
The only downside is that tests are only generated when the code is recompiled, not when new prefabs are added (though hooking into the prefab importer pipeline might be able to trigger something?)
I guess my questions are:
1- is this correct or a fluke?
2- Am I creating references to the prefab assets themselves (maybe risking corruption?) or is Unity doing some magic behind the scenes to store these as paths, but loading them up when the tests are run? Because I’m getting actual objects being passed to my tests, not just string resource paths I have to load and then instantiate myself.
3- Should I be using Addressables for this instead? Can I just set some criteria for which addressables to load, and tests will show up in the test runner?