Class RequireTestDataAttribute
Declares assets that a test fixture or method requires at run time on every platform. The build pipeline packs the declared assets into a content bundle for player builds, and the assets are available through TestData in the Editor and in players alike. Declarations that resolve to no assets fail the build; assets missing at run time fail the test.
Inherited Members
Namespace: UnityEngine.TestTools.Graphics
Assembly: UnityEngine.TestTools.Graphics.dll
Syntax
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method, AllowMultiple = true)]
public class RequireTestDataAttribute : Attribute
Remarks
Subclass and override CreateDescriptor(Type) to supply a custom ITestDataDescriptor with programmatic asset enumeration or custom addressing.
Examples
[RequireTestData("ssao-testdata", "Assets/Scenes/500_SSAO/depth.exr", "Assets/Scenes/500_SSAO/*.json")] public class SSAOShaderTestCases
Constructors
RequireTestDataAttribute(string, params string[])
Declares required test data assets packed into a bundle with the given logical name. Declarations sharing a bundle name, including declarations on different fixtures, are merged into one bundle. Asset paths support '' wildcards over one directory, e.g. "Assets/Scenes/500_SSAO/.json".
Declaration
public RequireTestDataAttribute(string bundleName, params string[] assetPaths)
Parameters
| Type | Name | Description |
|---|---|---|
| string | bundleName | The logical bundle name, or null to derive it from the declaring type. |
| string[] | assetPaths | Asset paths or wildcard patterns to include. |
Properties
AssetPaths
The declared asset paths or wildcard patterns.
Declaration
public IReadOnlyList<string> AssetPaths { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<string> |
BundleName
The logical bundle name, or null when the name is derived from the declaring type.
Declaration
public string BundleName { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
CreateDescriptor(Type)
Creates the ITestDataDescriptor for this declaration: by default a TestDataDescriptor over AssetPaths, with the bundle name defaulting to the lower-cased declaring type name.
Declaration
public virtual ITestDataDescriptor CreateDescriptor(Type declaringType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | declaringType | The type the attribute is declared on. |
Returns
| Type | Description |
|---|---|
| ITestDataDescriptor | The descriptor describing the declared assets. |