Questions tagged [unity-test-tools]

Unity Test Tools is a test framework for the games and interactive content made in the Unity game engine.

Useful links:

13 questions
4
votes
2 answers

How to get the reference to a GameObject in a Unit Test in Unity from an opened scene?

I know of several methods, but they all have drawbacks I would like to avoid: The obvious way would be to use GameObject.Find(), but this breaks, as soon as the object gets renamed (and is very costly). Thus I would like to avoid using…
N8W1nD
  • 53
  • 6
2
votes
1 answer

Simulate Unity InputSystem mouse events

I'm busy working on a game where the player can attack by clicking the left mouse button. I have a InputManager class that will check the input events and then invoke a UnityEvent. This is all working while playing the game. But I'm struggling to…
user2917054
2
votes
1 answer

How to set up Unity unit tests with *many* Script directories

I've been reading many articles online about how to set up a unit test, and most of all it seems pretty straight forward: you create a Test directory using Test Running in Unity. According to this post here, if you run into a namespace issue, then…
2
votes
1 answer

How to test OnMouseDown function for Integration Testing using Unity Test Tools

I want to know, how do i test OnMouseDown() function (Or any Event based function) for integration testing using unity test tools. I attached CallTesting.cs script on cube who will get OnMouseDown() event. I have to test this functionality by using…
Sarthak mirajkar
  • 191
  • 1
  • 1
  • 7
2
votes
2 answers

Unity Test Tools Unit Test with GameObject gives "You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed."

I am using the Unity Test Tools framework. My unit test code looks like this (More included) [TestFixture] public class ActionMasterTester: MonoBehaviour{ private ActionMaster actionMaster; [SetUp] public void SetUp() { …
PearsonArtPhoto
  • 38,970
  • 17
  • 111
  • 142
1
vote
0 answers

Leap motion and Integration Tests

I am currently using Leap Motion alongside Unity3D in a VR-project I am making. I finished my unit tests finding inspiration from this site https://blogs.unity3d.com/2014/06/03/unit-testing-part-2-unit-testing-monobehaviours/. Now I need to make…
1
vote
1 answer

Why does assertion fail when values are equal

I'm writing my first test in unity3d. My objective is to assert that as the player runs, the Z axis remains consistent and the height doesn't change. In other terms, the Character's z position is consistently a 1 value. This test continuously…
Ben
  • 60,438
  • 111
  • 314
  • 488
0
votes
0 answers

Button press not registered in [UnityTest] but is registered in [Test]

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…
Narc0t1CYM
  • 499
  • 6
  • 25
0
votes
1 answer

Is there a way to test the position change of a class with MonoBehaviour?

I would like to learn the basics of testing, how to make a test I am using the new unity input system (OnMove), I store that input in a vector2, later I use that vector2 in a function that moves the character (ProcessMovementOfShip). The game works,…
0
votes
1 answer

Unity 3d simulate touch on screen play mode test case

I am writing playmode test case. I want to simulate touch/click at certain co-ordinate on screen for example (100,100) So far I just found following code Input.simulateMouseWithTouches = true; Any idea how simulate touch at a point in unity…
alphanso
  • 409
  • 5
  • 22
0
votes
1 answer

Unity testrunner running [Test]s but not [UnityTests] in playmode

I set up my test environment for PlayMode testing. Tests marked with [Test] work just fine, e.g. if my code looks like: using NUnit.Framework; using UnityEngine; using UnityEngine.TestTools; namespace Tests { public class WinTestSuite { …
Dori
  • 1,035
  • 1
  • 12
  • 22
0
votes
1 answer

Unity editorTestsFilter command line argument not working

Please tell me what is wrong with this command line for build android application in Unity with run tests with [Unity Test] attribute: "C:\Program Files\Unity\Editor\Unity.exe" -editorTestsFilter MyTestName -runTests -projectPath…
0
votes
0 answers

how to add properties file in Unity Testing Scripts

I am currently writing automation test script for android application that is built in Unity. So I have some game objects that I want to test and see. But the details related to that particular object like what it should display and all I need to…
Mohanakrrishna
  • 148
  • 3
  • 13