You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class BlahBlah : ZenjectIntegrationTestFixture
{
[UnityTest]
public IEnumerator RunTest1()
{
// Setup initial state by creating game objects from scratch, loading prefabs/scenes, etc
PreInstall();
// Call Container.Bind methods
PostInstall();
// Add test assertions for expected state
// Using Container.Resolve or [Inject] fields
yield break;
}
}
Run RunTest1 in PlayMode in Unity's test runner. Notice that it hangs.
Put breakpoint on PreInstall() in Rider or whatever IDE you have and attach to Unity. Run test again, notice that breakpoint never gets hit.
Comment out the line GameObject.DestroyImmediate(obj); in ZenjectIntegrationTestFixture.SetUp. Run test again, notice that the breakpoint IS hit this time.
What is expected instead
Expected is that the test runner doesn't hang and the actual test is run (and the breakpoint is hit) even as listed in step 3.
Other notes
It seems that the only object that's destroyed is "Code-based tests runner", which seems to be the thing actually running the tests.
Workaround
I replaced the offending line with
if (obj.name != UnitTestRunnerGameObjectName)
{
Object.DestroyImmediate(obj);
}
and my tests work now.
The text was updated successfully, but these errors were encountered:
Repro steps:
This is on Unity 2020.3.8f1
GameObject.DestroyImmediate(obj);
in ZenjectIntegrationTestFixture.SetUp. Run test again, notice that the breakpoint IS hit this time.What is expected instead
Expected is that the test runner doesn't hang and the actual test is run (and the breakpoint is hit) even as listed in step 3.
Other notes
It seems that the only object that's destroyed is "Code-based tests runner", which seems to be the thing actually running the tests.
Workaround
I replaced the offending line with
and my tests work now.
The text was updated successfully, but these errors were encountered: