Skip to main content

Questions tagged [unit-testing]

A method by which individual parts of code or modules together with associated control data, usage procedures, and operating procedures, are tested to determine if they are fit for use.

Filter by
Sorted by
Tagged with
1 vote
1 answer
230 views

Unit Testing start method of a MonoBehaviour

In Unity how can I unit test the start method? I am not trying to test interaction between objects but the private methods are called by the Start method, so I figured I should call the start method ...
WVrock's user avatar
  • 111
0 votes
1 answer
258 views

Unity PlayMode tests - cannot find UnityEngine.InputSystem assembly

I'm trying to simulate user input in my Unity PlayMode tests. I've been reading this guide on the Unity website about adding input simulation into my tests. Specifically, it mentions I need to add the ...
Samuel Slade's user avatar
1 vote
1 answer
91 views

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

I'm experiencing an issue with my PlayMode tests, where all tests pass individually, but when running 21 or more tests together (using Run Selected or Run All), the same 2 tests fail. From further ...
Samuel Slade's user avatar
0 votes
1 answer
118 views

Errors in Play Mode test setting Animator parameters

I've just started adding tests to my game project in Unity. I know the difference between EditMode and PlayMode tests. I've written a PlayMode test that triggers a change to the Animator internally, ...
Samuel Slade's user avatar
1 vote
2 answers
728 views

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

My player has an Action in the Input System Move, that takes a Vector2 and moves the player based on that input. Straight-...
JShoe's user avatar
  • 75
3 votes
1 answer
266 views

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

GitHub actions attempt to upload my coverage reports to CodeCov, but I get an error. Below is my most recent GitHub Action code, and the error I'm receiving from CodeCov. Please let me know if there ...
JShoe's user avatar
  • 75
0 votes
1 answer
163 views

Unity3D Tests - Edit Mode vs Test Mode

I have been reading about Edit Mode vs Play Mode testing and I'm not seeing any real reasons of why I would use Play mode testing over Edit mode testing. My assumption is that edit mode is better for ...
Jacksonkr's user avatar
  • 259
4 votes
0 answers
735 views

How to validate an Exception occurred as expected in a Unity Test?

I am trying to write unit tests in Unity that assert that logs, errors, and exceptions are raised as expected in my code, but I'm getting inconsistent results. I'm using ...
Just_Alex's user avatar
  • 141
0 votes
1 answer
630 views

How do I set up unit tests in Unity?

I have followed the Unity Test Framework documentation to create an EditMode test assembly and a test script. When I try to test a function like Utils.SomeMethod(), ...
Matt's user avatar
  • 405
2 votes
1 answer
644 views

How to subscribe for events for easy unit testing?

I've run into the same problem multiple times that is begging for a solution. I try to write a lot of decoupled code to make my MonoBehaviour scripts as reusable as possible. This means that I end up ...
Adam B's user avatar
  • 800
0 votes
1 answer
212 views

How can i write automated tests for some SDL2 objects?

For eg having a class that is rendering something on the screen, could be even a point or a line if not an image or whatever. How is possible to write some tests for that class only? or just a small ...
Raffaello's user avatar
  • 125
2 votes
1 answer
363 views

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

Bit of a noob question, but I'm having trouble getting unit testing working in Unity. I created a PlayMode test assembly, I toggled "Enable playmode tests for all assemblies" as directed in the manual,...
Skatche's user avatar
  • 141
2 votes
0 answers
368 views

Unity build trying to include Editor Scripts

I'm having a peculiar problem. I'm creating a 2D Unity game using Fungus for cutscenes and the Unity Test Tools for unit testing. The game runs fine in the editor, but when I try and build an ...
Ben Partridge's user avatar
1 vote
1 answer
889 views

How to properly setup unit testing for my c++ game project? [closed]

I'm currently creating a 2d game in C++ using visual studio and utilizing gtest/gmock for my testing framework. The problem I'm having is I'm not sure what my best option is for testing. I'm using SDL ...
Jason's user avatar
  • 423
1 vote
0 answers
64 views

Unit testing graphics [duplicate]

What is the standard (if there is one) method which professional games developers use to unit test (or closest equivalent) graphics output? I am developing with Corona SDK and I would like to test ...
Matt W's user avatar
  • 203
1 vote
1 answer
833 views

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

I made a Blender 3D model with animations. Then I used the Animator Controller, and attached it to the model. The Animator Controller has a few Boolean parameter variables like ...
Mack's user avatar
  • 11
4 votes
1 answer
3k views

How to write a unit test in Unity? [duplicate]

is there a tutorial and patterns to write unit tests in Unity ? Should we use the classical c# way and test the code or should we test the interactions in UI ? If so how?
Rıfat Erdem Sahin's user avatar
2 votes
2 answers
1k views

How do you create test for unity variables that are set through the [SerializeField] tag?

I need to create some tests for a bunch of variables that are initialized via the editor, So in the script they are always null and can't be set publicly. Usually using the tag is a good way to ...
user3797758's user avatar
  • 3,641
6 votes
2 answers
7k views

How to write testable MonoBehaviour and test scripts in Unity?

I had problems with decoupled scripts and exposing interfaces in Unity, and these answers helped me a lot. But now, since I don't have hard-coded references in my scripts, I wanted to write unit tests ...
K.L.'s user avatar
  • 795
2 votes
2 answers
1k views

How do I separate testable game logic from my UI in Cocos2d-x?

I read some articles on why I should separate game logic and UI code: That makes it possible to test game logic code can be independently of the rest. However, I am having trouble implementing this in ...
ductran's user avatar
  • 73
1 vote
1 answer
738 views

Unit Testing with Cocos2D

How to implement Unit Testing with Cocos2D framework? What are the good practices? Is there any testing framework like JUnit Framework at Eclipse for Android?
Md Mahbubur Rahman's user avatar
13 votes
3 answers
3k views

How can I do unit testing in Unity? [closed]

How to implement Unit Test at Unity3D. I wonder if it would be possible to extend the Unity editor to have some sort of testing framework in it. Is there any guideline to implement it? Any ...
Md Mahbubur Rahman's user avatar
2 votes
0 answers
454 views

UI Automation for Flash Games [closed]

has anyone used or heard of a good selenium-like toolset for doing automated UI testing with Flash? I would ideally like to have the ability to record and playback events against my game and integrate ...
j03m's user avatar
  • 149
25 votes
3 answers
10k views

How does one do unit testing in a game engine?

Much to my shame, I have never written a proper unit test, only small unorganized test programs that I would then dispose of after the test succeeded. I don't really have a clear idea of how unit ...
Paul Manta's user avatar
  • 3,197
22 votes
4 answers
10k views

How can I unit test rendering output?

I've been embracing Test-Driven Development (TDD) recently and it's had wonderful impacts on my development output and the resiliency of my codebase. I would like to extend this approach to some of ...
notlesh's user avatar
  • 3,897
37 votes
7 answers
25k views

How common is automated testing in game development? [closed]

Do gamers developers use to write unit and integration tests? How common is it among puzzle developers? And among developers of MMORPGs and FPSes? (I have no background in game development neither am ...
brandizzi's user avatar
  • 473
5 votes
2 answers
2k views

Best practices for UnitTesting heavy Flash game clients and libraries?

We have several quite heavy game clients completely written in AS3 (some also use Flex for UI). Some clients are built with PureMVC, others are a pile of spaghetti code that's grown over the years. We ...
Baelnorn's user avatar
  • 153
26 votes
4 answers
4k views

How to design a game's software such that it is easy to unit test?

Is it practical to use a testing framework like JUnit in a game development situation? What sort of design considerations can you follow in order to make your game more testable? What parts of a game ...
Ricket's user avatar
  • 14.8k
13 votes
1 answer
3k views

Unit Testing a C#/XNA Game Project

I have been dabling in game development since I started programming, but never very seriously. I work as a business app developer, but I'm working on some games in my spare time. In the business ...
Nate's user avatar
  • 5,064