open-project-1 icon indicating copy to clipboard operation
open-project-1 copied to clipboard

Unit test for the Input system

Open kgc00 opened this issue 5 years ago • 0 comments

Do you have a forum thread linked to this PR?
https://forum.unity.com/threads/what-about-unit-testing.981069/#post-6488173

What will this PR bring to the project for everyone? Some example of a unit test for the input system and project structure for future tests. inlcudes tests for the input reader and unity's new input system.

Why are these changes necessary?
RE forum: the earlier we get this stuff in the easier it will be to maintain. Less headaches in the future =)

How did you implement them?

  • for inputreader i had to make the GameInput property public get, private set
  • I had to put the input reader in it's own assembly so I could access it from the tests folder. it's in UOP1.Input now
  • altered the manifest.json to mark com.unity.inptutsystem] as testable
  • made some boiler plate folder structure in a tests folder to hold future edit / play mode tests
  • wrote some tests for input reader

Mostly similar to https://github.com/UnityTechnologies/open-project-1/pull/88 but with functional inputreader tests and no introduced packages/dependencies.

kgc00 avatar Nov 03 '20 22:11 kgc00