Class VerifyRunConfigurationAttribute
Stops a test when the run doesn't render the way its command line asks, so the test doesn't report results for a configuration that nobody asked for.
Implements
Inherited Members
Namespace: UnityEngine.TestTools.Graphics
Assembly: UnityEngine.TestTools.Graphics.dll
Syntax
[AttributeUsage(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Method)]
public sealed class VerifyRunConfigurationAttribute : Attribute, ITestAction
Remarks
The framework checks the run once, before the first test with this attribute:
- The graphics API, if the command line forces one with
-force-d3d11,-force-d3d12,-force-vulkan,-force-metal,-force-glcoreor its alias-force-opengl, or-force-gles, including versioned forms such as-force-glcore45and-force-gles32. On Xbox consoles, the console's Direct3D 12 device satisfies-force-d3d12. - The rendering threading mode, if the command line forces one with
-force-gfx-direct,-force-gfx-st,-force-gfx-mtor-force-gfx-jobs. - WARP, the Direct3D software rasterizer, which the device can be only if the
command line asks for it with
-force-driver-type-warp. Without the argument, WARP means the GPU driver didn't load.
Write these arguments in the documented form, the name with one dash and the value after a space,
as in -force-gfx-jobs split. A double dash or a value joined with = fails the check, because
the engine reads those forms for some arguments and ignores them for others.
The checks compare the device with the command line of the run, so they don't check a graphics API
chosen when the player is built, in the Player Settings or with the Unity Test Runner's
--playerGraphicsAPI option. To detect a player that falls back to another graphics API, also pass
the matching argument to the run, such as -force-vulkan for a player built for Vulkan. The WARP
check applies whichever way the graphics API was chosen.
If a check fails, the first test with this attribute fails and lists every failed check, and
the framework skips the later tests with this attribute. The log shows the result of every check:
search it for Run configuration.
Examples
[VerifyRunConfiguration]
public class MySceneTests
{
[UnityTest, SceneGraphicsTest("Assets/Scenes")]
public IEnumerator Run(SceneGraphicsTestCase testCase) { ... }
}
Properties
Targets
Declaration
public ActionTargets Targets { get; }
Property Value
| Type | Description |
|---|---|
| ActionTargets |
Methods
AfterTest(ITest)
Declaration
public void AfterTest(ITest test)
Parameters
| Type | Name | Description |
|---|---|---|
| ITest | test |
BeforeTest(ITest)
Declaration
public void BeforeTest(ITest test)
Parameters
| Type | Name | Description |
|---|---|---|
| ITest | test |