I am going over the documentation for Unity Test Runner and some things aren’t totally clear to me. here’s my feedback:
- Play mode vs. edit mode tests
What is the technical distinction between the two types? what is allowed to be done in edit mode which is not allowed in play mode tests ? (and vice versa). i also do not understand the motivation for selecting either type (when should i use each of these?)
In Unity test tools (which is now deprecated), unit tests could not perform certain things (e.g: create new game objects). They were also executed as editor code (e.g: not in “play mode”) so they could not start coroutines and such things.
With these 2 new test types, it’s not clear anymore (to me).
-
Editor restart after enabling play mode tests
After enabling play mode tests, the editor must be restarted. kind of a nitpick, but that’s pretty annoying, and i don’t recall any other feature that behaves the same. wasn’t there any other solution for this? (why is it necessary anyway ?). Also, it is mentioned that this adds some overhead to the game at runtime - can someone clarify what does this add and whether i should actually worry about enabling this? (if it adds 10kb to the build i am totally fine with it). -
PrebuildSetupAttribute
(what an awful name BTW) - why should i prefer this over NUnit’s SetUp attribute? what is the difference between the two and which one should i prefer to use ? -
MonoBehaviourTest
while i believe the intention was good (probably due to lots of feedback about how it’s hard to test MonoBehaviour code), i don’t really see how this thing could be useful for real world scenarios.Also, it “asks” you to mix your runtime (MonoBehaviour) code with your tests (IMonoBehaviourTest interface). -
Command line execution
does this work in conjunction with -batchmode or -nographics? we would like to run editor / play mode tests from our build server. so far i haven’t been able to execute it via command line.Also, it can be nice to have more control over which tests will get executed (by name, category, etc). -
Improve the documentation
documentation on the docs page (linked above) is not clear at times. also links coming from this page to various attributes or other code related stuff is very under-documented and missing examples or includes confusing descriptions. -
Please Open source the test runner
I think we (the dev community) can benefit from it as well as improve on it and send it back as PRs.