I have a code like this
public static class TestClass
{
private static bool initialized;
public static void Initialize()
{
if (initialized) throw new Exception("TestClass already initialized.");
initialized = true;
}
}
[UnityTest]
public IEnumerator Test1()
{
TestClass.Initialize();
yield break;
}
[UnityTest]
public IEnumerator Test2()
{
TestClass.Initialize();
yield break;
}
If I run Test1 and Test2 by “Run Selected”, tests passed. But if i press “Run All” - second failed. Also, tests can create new game objects, thread, etc. How I can clear it?