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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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.
...
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, ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
unit-testing × 29unity × 17
c# × 9
testing × 9
c++ × 4
test-driven-development × 4
opengl × 2
input × 2
flash × 2
automated-testing × 2
xna × 1
game-design × 1
architecture × 1
rendering × 1
ios × 1
software-engineering × 1
sdl × 1
sdl2 × 1
design-patterns × 1
cocos2d-iphone × 1
actionscript-3 × 1
events × 1
cocos2d × 1
visual-studio × 1
cocos2d-x × 1