This project does not contain a build. In order to run tests need to:
- instrument app (load AltTester Unity SDK as package in Unity Editor)
- build application with desired target platform (e.g.: Standalone Windows)
- Install the required .NET Framework Developer Pack, version 4.7.1 installer link
- Install Unity Hub
- Install Unity Editor version 2021.3.12f1
- Import AltTester Unity SDK in Unity Editor
- Assets > Import Package > Custom Package > use the SDK version suggested below in Before running the tests
To run the tests, you must include the AltTester Unity SDK in the project. To do that, you can choose between the following ways:
-
Add the AltTester Unity SDK submodule to the project
- use
git submodule update --init
command to pull the git submodule; - make sure that the submodule added is on the master branch (you can use the following command
git checkout master
in the Assets/AltTester-Unity-SDK folder); - also, if you already have the project, you should make a
git pull
on the master branch, in order to ensure that you are using the latest version of AltTester.
- use
-
Download AltTester Unity SDK and import it into Unity
- download the AltTester Unity SDK from the Altom website: Alttester or using this link for unitypackage;
- import the package into the project (drag-n-drop the package in the Assets folder);
- a pop-up will appear, select All and click on Import.
- Open the project in Unity Editor (see pre-requisites for which version proved to work).
- Platform > Standalone > Build Target: StandaloneWindows
- Build Only
- Open AltTester Editor from Unity Editor menu (displayed only after imported package as mentioned above) and see tests under
Assembly-CSharp-Editor.dll
- If build completed successfully, should see in folder
New Input System proj
build folder. - Launch Game from executable inside build folder
- In Unity Editor: select tests under AltTester_NIS_Tests
- Run Selected Tests
The tests can be found in New Input System proj > Assets > Editor > Tests folder in the AltTester_NIS_Tests.cs class.
Run tests: using dotnet CLI
In order to be able to execute tests using dotnet, need to have an NUnit Test project. Compared with parent repository generated following steps to be able to execute tests from terminal with dotnet CLI.
- Create a folder
CoinCollector.Tests
insideNew Input System proj
- From
CoinCollector.Tests
create a test project that uses NUnit as the test library:
dotnet new nunit
-
Rename
UnitTest1.cs
to smth convenient ( eg:AltTester_NIS_Tests.cs
) -
Add necessary nuget packages:
- AltTester-Driver (v 1.8.0)
dotnet add package AltTester-Driver --version 1.8.0
- UnityEngine
dotnet add package UnityEngine --version 1.0.0
- Execute tests
dotnet test
This project contains C# AltTester tests for a project using the New Input System.
The tested actions are:
- BeginTouch, EndTouch
- Click
- PressKey
- Scroll
- Swipe
- Tap
- KeyDown, KeyUp