Skip to main content
2 votes

How can I reference classes from my scripts in my unit tests?

Figured out how to do it. I had to create a new assembly definition in my Scripts folder. (I also moved my Tests folder out of the Scripts folder to be on the safe side.) Then, looking at the Tests ...
Skatche's user avatar
  • 141
1 vote

Unit Testing start method of a MonoBehaviour

I figured it out. gameObject.setActive(bool) is the solution. I believe the start method is being called when the MonoBehaviour object is added as the component in ...
1 vote
Accepted

Unity PlayMode tests - cannot find UnityEngine.InputSystem assembly

I've managed to resolve this issue, with some direction. I hadn't realised that the Input System test framework I was trying to use, was actually part of a package I hadn't yet installed: the new ...
Samuel Slade's user avatar
1 vote
Accepted

Unity PlayMode Tests - Lifecycle Events don't fire when running 21 or more tests together

In the end, I reworked this solution. Instead of using a static StateCache instance with static data that was clearly bleeding through my tests when run in batch, I ...
Samuel Slade's user avatar
1 vote
Accepted

Errors in Play Mode test setting Animator parameters

Two mistakes here: AddComponent<T>() adds a new component in its default state. That means the Animator you create this ...
DMGregory's user avatar
  • 141k
1 vote

Testing Message-Based Events using Unity's New Input System and InputTestFixture, getting unhelpful error

So, I think you're hitting a red herring with the error you're seeing. I'm unsure of exactly how Unity handles deleting objects in PlayMode tests if you don't manually control it with ...
Sean Kim's user avatar
1 vote
Accepted

How do I integrate Unity and CodeCov (Using GitHub Actions)?

The error that you're seeing [2022-01-27T20:19:24.133Z] ['error'] There was an error running the uploader: Error while cleaning paths. No paths matched existing files! implies that either (1) the ...
Thomas Hu's user avatar
  • 126
1 vote

I want to test the Animator component of a gameobject using nunit, but I am having issues

I'm testing my animators by always using animator.Update(0.1f) to make them pass from states to states. You should try this after your following triggers. ...
StackHola's user avatar
  • 267
1 vote
Accepted

How to write a unit test in Unity?

In Unity 2017.2 Unity has a feature called Unity Test Runner which is an integration of NUnit with the Unity Editor. You can access it through the menu: Window > Test Runner For more information, ...
Stephan's user avatar
  • 1,738

Only top scored, non community-wiki answers of a minimum length are eligible