Hi,
I’m trying to write tests for a scene. Because a lot of my scene is already in place and I need to check positions I wanted to load the scene up at test-time and perform tests on it. The issue I’m having it I use SceneManagement.LoadScene([scene name], LoadSceneMode.Single) at the moment to load the scene at the start of each test, but doing this causes the Editor itself to crash when I run all the tests. From looking at the logs (putting Debug.Log()s before and after the load) I can tell this happens exactly as I try and load the scene over itself, but it doesn’t have any information as to what actually causes the crash.
If I run the tests individually they’re fine, and if I put a check in to see if the scene is already loaded at the start of each test then everything works. But this isn’t ideal as I’d like to run the tests on a fresh scene each time. I can’t achieve this with Tear downs and set ups either as I can’t unload a scene if it’s the only one loaded (according to an error message I get in the console if I try to do it).
What’s the best way to run the tests within a scene across multiple files with different test cases in them and reset it between tests?