I have several tests (~50) for my game and finally got to the point to start testing classes that require input from the player. When I wrote my tests for the Gamepad and Keyboard + Mouse inputs every test passed properly but they were using the [Test] attribute and not [UnityTest] attribute.
Now that I'm trying to test button press with [UnityTest] it refuses to register it, neither with Set(_gamepad.rightShoulder, 1); neither with Press(_gamepad.rightShoulder); For curiosity, I tried the same test with the regular [Test] attribute and there it registered the button press.
Is this a known limitation for the [InputTestFixture] attribute or am I doing something wrong?
I'm using InputSystem v1.4.4 and the code that I was trying to test was the following:
[UnityTest]
public IEnumerator Shoot() {
var bullets = GameObject.FindGameObjectsWithTag("Bullet");
Assert.IsEmpty(bullets);
Set(_gamepad.rightShoulder, 1);
yield return new WaitForFixedUpdate();
bullets = GameObject.FindGameObjectsWithTag("Bullet");
Assert.IsNotEmpty(bullets);
}
The Shooting controller is setup before, so it should run its Update() after yielding a new WaitForFixedUpdate(). This was checked while debugging but the problem is the _gamepad.rightShoulder not being pressed.