Search Issue Tracker
By Design
By Design in 1.11.X
Votes
9
Found in [Package]
1.11.0
Issue ID
ISXB-464
Regression
No
Test with InputTestFixture fails or causes other tests to fail when running it with other tests
Reproduction steps:
1. Open the attached project "InputTestFixtureBugSample"
2. Open the Test Runner window and switch to "PlayMode"
3. Click "Run All"
Expected result: All tests are successful
Actual result: TestB fails
Reproducible with: 1.5.0 (2020.3.46f1), 1.5.1 (2020.3.46f1, 2021.3.24f1, 2022.2.17f1, 2023.1.0b14, 2023.1.0a12)
Couldn’t test with: 1.4.4 (2020.3.46f1) (Compilation error)
Notes:
1. If running TestA and TestB, TestB fails
2. If running TestB and TestC, TestC fails
3. If running TestA and TestC, both are successful
4. If running TestB alone, it is successful
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Texture2D hash changes inside of an AssetBundle when rebuilding a SpriteAtlas bundle with an empty AssetPostprocessor Script enabled
- Aniso Level still applies when Generate MipMap is disabled in Texture Import Settings
- Mipmap Limit Groups long names are not truncated when creating a new Mipmap Limit Group with a long name
- “ArgumentException: Invalid double parameter.” error is thrown when Infinity is typed into the Fixed Timestep field
- GameObject becomes gray when using HDRP and STP together on macOS
Resolution Note:
The InputTestFixture is designed to test low-level Input System functionality.
If you have tests that load scenes / create objects and otherwise affect global state you need to clean-up after each each test so that each tests can run in a clean environment,
Use a teardown method like the below to clean up any state left over by your tests. For the tests provided in this bug report the following will work.
public class Framework : InputTestFixture
{
private void Cleanup()
{
var activeScene = SceneManager.GetActiveScene();
foreach (var go in activeScene.GetRootGameObjects())
{
if (go.name.Contains("Protagonist"))
{
UnityEngine.Object.Destroy(go);
// We could just destroy the PlayerInput component:
//
// var pi = go.GetComponent<UnityEngine.InputSystem.PlayerInput>();
// if (pi != null) UnityEngine.Object.Destroy(pi);
}
}
}
[TearDown]
public override void TearDown()
{
Cleanup();
base.TearDown();
}
}
Resolution Note (1.11.X):
The InputTestFixture is designed to test low-level Input System functionality.
If you have tests that load scenes / create objects and otherwise affect global state you need to clean-up after each each test so that each tests can run in a clean environment,
Use a teardown method like the below to clean up any state left over by your tests. For the tests provided in this bug report the following will work.
public class Framework : InputTestFixture
{
private void Cleanup()
{
var activeScene = SceneManager.GetActiveScene();
foreach (var go in activeScene.GetRootGameObjects())
{
if (go.name.Contains("Protagonist"))
{
UnityEngine.Object.Destroy(go);
// We could just destroy the PlayerInput component:
//
// var pi = go.GetComponent<UnityEngine.InputSystem.PlayerInput>();
// if (pi != null) UnityEngine.Object.Destroy(pi);
}
}
}
[TearDown]
public override void TearDown()
{
Cleanup();
base.TearDown();
}
}