ssannandeji / Zenject-2019

Dependency Injection Framework for Unity3D
MIT License
2.53k stars 363 forks source link

Unable to run Play mode tests in player/device #577

Closed Vangaorth closed 5 years ago

Vangaorth commented 5 years ago

Hi, I was trying out the Zenject test framework, mainly for integration tests and scene tests and I found out that testing in play mode in player (run all in player) is not supported.

Digging into the ZenjectIntegrationTestFixture class, I found a different implementation when instantiating the class in editor with respect to the device (that explained why all tests failed on the player/device). I went a step further and removed the “non-editor” implementation, also doing the appropriate fixes on ProjectContext (basically, making sure the same code that is executed in editor is also run in the player/device) and I was able to deploy and run every test on the device.

Being unaware if this edit may lead to side effects, is this something that could be fixed (i.e., being able to run Play mode tests in player (device)) like I did or is there any other reason why in-device-tests are not supported?

svermeulen commented 5 years ago

No reason other than I never got around to ensuring that works. But good to know that it does after making a few changes to it, we'll have to fix that

svermeulen commented 5 years ago

Ok fixed, thanks for reporting it