Skip to content

Commit a5cc644

Browse files
author
Rene Damm
authored
NEW: Add integration test that uses native runtime (#952).
1 parent 9f2680d commit a5cc644

15 files changed

+85
-2
lines changed

.yamato/upm-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ platforms:
4949
- upm-ci package pack --package-path ./Packages/com.unity.inputsystem/
5050
- upm-ci package test --package-path ./Packages/com.unity.inputsystem/ -u {{ editor.version }}
5151
- {% if platform.installscript %} {{ platform.installscript }} {{ editor.version }} {% endif %}
52-
- upm-ci~/tools/utr/utr --testproject=. --editor-location=.Editor --artifacts_path=upm-ci~/test-results/isolation-com.unity.inputsystem.tests --suite=playmode --api-profile=NET_4_6 --stdout-filter=minimal {% if platform.runtime %} --platform {{ platform.runtime }} {% endif %} {% if platform.scripting-backend %} --scripting-backend {{ platform.scripting-backend }} {% endif %}
52+
- upm-ci~/tools/utr/utr --testproject $PWD --editor-location=.Editor --artifacts_path=upm-ci~/test-results/isolation-com.unity.inputsystem.tests --suite=playmode --api-profile=NET_4_6 --stdout-filter=minimal {% if platform.runtime %} --platform {{ platform.runtime }} {% endif %} {% if platform.scripting-backend %} --scripting-backend {{ platform.scripting-backend }} {% endif %}
5353
triggers:
5454
branches:
5555
only:
@@ -80,4 +80,4 @@ publish:
8080
artifacts:
8181
artifacts:
8282
paths:
83-
- "upm-ci~/packages/*.tgz"
83+
- "upm-ci~/packages/*.tgz"

Packages/com.unity.inputsystem/Tests/IntegrationTests.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using NUnit.Framework;
2+
using UnityEngine.InputSystem;
3+
using UnityEngine.InputSystem.LowLevel;
4+
5+
// These tests are the only ones that we put *in* the package. The rest of our tests live in Assets/Tests and run separately
6+
// from our CI and not through upm-ci. This also means that IntegrationTests is the only thing we put on trunk through our
7+
// verified package.
8+
//
9+
// Rationale:
10+
// (1) Our APIVerificationTests have extra package requirements and thus need a custom package manifest.json. This will not
11+
// work with upm-ci.
12+
// (2) The tests we have in Assets/Tests exercise the input system in isolation. Having these run on trunk in addition to our
13+
// CI in the input system repo adds little value while adding extra execution time to trunk QV runs. This is unlike
14+
// the integration tests here which add value to trunk by making sure the input system is intact all the way through
15+
// to the native input module.
16+
// (3) If we added everything in Assets/Tests to the package, we would add more stuff to user projects that has no value to users.
17+
//
18+
// NOTE: The tests here are necessary to pass the requirement imposed by upm-ci that a package MUST have tests in it.
19+
20+
public class IntegrationTests
21+
{
22+
[Test]
23+
public void CanSendAndReceiveEvents()
24+
{
25+
var keyboard = InputSystem.AddDevice<Keyboard>();
26+
27+
try
28+
{
29+
InputSystem.QueueStateEvent(keyboard, new KeyboardState(Key.A));
30+
InputSystem.Update();
31+
32+
Assert.That(keyboard.aKey.isPressed, Is.True);
33+
}
34+
finally
35+
{
36+
InputSystem.RemoveDevice(keyboard);
37+
}
38+
}
39+
}

Packages/com.unity.inputsystem/Tests/IntegrationTests/IntegrationTests.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "Unity.InputSystem.IntegrationTests",
3+
"references": [
4+
"GUID:75469ad4d38634e559750d17036d5f7c",
5+
"GUID:dc04f38471c3a459fb4d31124ee9127d"
6+
],
7+
"optionalUnityReferences": [
8+
"TestAssemblies"
9+
],
10+
"includePlatforms": [],
11+
"excludePlatforms": [],
12+
"allowUnsafeCode": false,
13+
"overrideReferences": false,
14+
"precompiledReferences": [],
15+
"autoReferenced": false,
16+
"defineConstraints": [],
17+
"versionDefines": []
18+
}

Packages/com.unity.inputsystem/Tests/IntegrationTests/Unity.InputSystem.IntegrationTests.asmdef.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

Packages/com.unity.inputsystem/Tests/InputSystem/AssemblyInfo.cs renamed to Packages/com.unity.inputsystem/Tests/TestFixture/AssemblyInfo.cs

File renamed without changes.

Packages/com.unity.inputsystem/Tests/InputSystem/AssemblyInfo.cs.meta renamed to Packages/com.unity.inputsystem/Tests/TestFixture/AssemblyInfo.cs.meta

File renamed without changes.

Packages/com.unity.inputsystem/Tests/InputSystem/InputTestFixture.cs renamed to Packages/com.unity.inputsystem/Tests/TestFixture/InputTestFixture.cs

File renamed without changes.

0 commit comments

Comments
 (0)