Namespace UnityEngine.TestTools.Graphics
Classes
BakeLightingAttribute
Attribute to bake lighting for the specified scenes before running graphics tests. This attribute should be used on a test class or test method.
BinaryReaderExtensions
Extensions for the BinaryReader class. These extensions provide methods for reading strings and byte arrays from a binary reader.
BinaryWriterExtensions
Extensions for the BinaryWriter class. These extensions provide methods for writing strings and byte arrays to a binary writer.
CameraCaptureSettings
Settings to control how the camera capture frames.
CustomResolutionFields
This class is used to specify the custom resolution settings for a test.
CustomResolutionSettings
This class is used to specify the custom resolution settings for a test. It contains an array of CustomResolutionFields that specify the resolution settings for different nodes.
EqualToTextureConstraint
Constraint that verifies whether a texture is equal to an expected texture using a specified comparison algorithm.
EuclideanDistance
Uses the Pythagorean theorem to measure the per-pixel color difference between two textures using a compute shader.
EuclideanDistanceSettings
Settings for the Euclidean distance algorithm, including the maximum acceptable distance between two images.
GenerateShaderVariantList
This class is responsible for generating a shader variant list from the player log. It reads the log file and extracts the shader variants that were compiled during the test run. It also handles the conversion of shader not found errors to log entries.
GlobalContextManager
Provides access to activatable platform nodes (GlobalContext<TEnum>). Contexts are auto-discovered by PlatformNodeRegistry at startup. Use Get<T>() to retrieve a context, then call Activate(Enum) to change its state.
GlobalContext<TEnum>
Abstract base class for activatable platform nodes (mutable contexts). Extend this class to create a context that can be changed at runtime via Activate(Enum).
Simple contexts with no side effects need no overrides:
public class MyContext : GlobalContext<MyEnum> { }
GlobalResolutionSetter
Sets global rendering resolution.
GraphicsPrebuildSetupAttribute
Attribute to mark a method or class as a pre-build setup step for graphics tests. This attribute should be used on a test class or test method.
GraphicsTestAttribute
Attribute that allows to generate test cases based on the graphics test cases provided by DefaultGraphicsTestCaseSource.
GraphicsTestAttributeBase
Base class for attributes that define graphics tests.
GraphicsTestBuildSettings
A class that holds settings for the Graphics Test Build.
GraphicsTestCase
Represents one automatically-generated graphics test case.
GraphicsTestCaseCollector
Collects all graphics test cases in the project.
GraphicsTestCaseCreatedArgs
Event arguments for the GraphicsTestAttribute.TestCaseCreated event. This class contains the test case and the setup actions associated with the test case.
GraphicsTestLogger
A logger for the graphics tests. This class is used to log messages to a file.
The default log file is created as Logs/GraphicsTestLogs.log in the project's root directory.
GraphicsTestParamAttribute
Supplies one set of additional arguments for a graphics test method, producing one parameterized variant per graphics test case. Multiple instances create multiple variants.
GraphicsTestParamSourceAttribute
Supplies additional argument sets from an external source type for graphics test parameterization.
The source type must implement IEnumerable<T> of object[].
GraphicsTestSettings
This class is used to specify the settings for image comparison tests. It contains an instance of ImageComparisonSettings that specifies the settings for image comparison.
IgnoreDataSource
A source of IgnoreData to use for ignoring Graphics Tests. Inherit from this class to create a separable ignore data source.
IgnoreGraphicsTestAttribute
Attribute to mark a test case as ignored for specific nodes or configurations.
IgnoreGraphicsTestData
A class that holds data about ignoring test cases.
ImageAssert
Provides test assertion helpers for working with images.
ImageCapture
Utility class for capturing images from the back buffer or render textures.
ImageComparisonSettings
Settings to control how image comparison is performed by ImageAssert.
ImageHandler
Handles image events from the Unity Test Protocol.
ImageHandler.TextureImporterSettings
Settings for the texture importer.
ImageMessage
This class is used to represent an image message.
IsTexture
Provides constraints for texture assertions in tests.
LegacyImageExportOptions
Image comparison settings that have been extracted because specific to image exports.
LumaPipeline
Measure the luma of two Texture2D using the Job System. This is used by the PSNR and SSIM algorithms.
PeakSignalToNoiseRatio
Implements the Peak Signal-to-Noise Ratio (PSNR) metric for texture/image comparison. PSNR (in dB) is derived from the mean squared error (MSE) between a reference and a test image and depends on the peak pixel value (e.g., 255 for 8‑bit images). PSNR is commonly used to evaluate the fidelity of compressed images/video: higher values generally indicate better quality. Typical PSNR values for lossy compression often fall in the 30–50 dB range, though this depends on content, bit depth, resolution, and viewing conditions. Distortions are more likely to be perceptible below ~30–35 dB, while values above ~40 dB are often considered high quality. PSNR is a simple, non-perceptual metric; for perceptual assessment it should be complemented with other measures such as SSIM or color-difference metrics (e.g. DeltaE).
PeakSignalToNoiseRatioSettings
The settings for the PSNR algorithm, including the threshold under which the Peak Signal to Noise Ratio (PSNR) is considered too low.
ReferenceImage
Represents a reference image to use for a test case.
ReferenceImageFileDescriptor
Default implementation that uses a pattern of "root.extension" or "rootinteger.extension".
RuntimeSettings
Helper class for runtime automated graphics tests.
SceneGraphicsTestAttribute
Attribute to create a new Scene Graphics Test. When used, it will create a new test case for the method it is applied to.
SceneGraphicsTestCase
Represents one automatically-generated graphics test case that uses a scene.
SetupAction
Class to hold the setup action and its order.
ShaderWarmup
Provides helpers to ensure every shader variant needed by a scene is compiled and uploaded to the GPU before an image-comparison capture. In the Editor the helpers temporarily enable asynchronous shader compilation, yield frames so the driver can finish in the background, then restore the original settings. In a Player build every method is a no-op because all variants are pre-compiled at build time.
ShaderWarningCollector
Collects shader warnings from the Unity log during builds and test runs.
When enabled via -shader-warnings-as-errors, captured warnings are written
to a ShaderWarnings.log artifact and can be used to fail the job.
StringExtensions
This class contains extension methods for the string class.
StructuralSimilarity
Implements the Structural Similarity Index Measure (SSIM) for texture/image comparison. SSIM is widely used in image quality assessment (including digital video). The SSIM index is computed over sliding Gaussian-weighted windows on the reference and test images, and the per-window results are averaged across the full image. The window size and Gaussian parameters can be configured via StructuralSimilaritySettings. A window size of 11 and a Gaussian σ of 1.0–1.5 are common defaults. The resulting value typically lies between 0 and 1, where 1 indicates identical images and values near 0 indicate very low structural similarity. Note: Extreme cases (e.g., constant black vs. constant white) usually yield SSIM near 0; exact 0 depends on implementation details and stabilizing constants.
StructuralSimilaritySettings
Settings used by the structural similarity algorithm when comparing images, including the threshold under which two images are considered dissimilar, the gaussian weight which is applied to pixels within each SSIM comparison window, and the size of the SSIM comparison window, and handling of linear space images.
TestContentBundle
Abstract class representing a content bundle for graphics tests. This class provides a base for loading and unloading content bundles,
TestContentLoader
TestContentLoader is a class that loads test content bundles. It is used to load test content for graphics tests. It provides methods to load, unload, and reload test content. It also provides methods to check the load state of the content bundles.
TestNotSupportedOnAttribute
Marks a test as unsupported on the specified platforms. Tests decorated with this attribute will be skipped on the listed platforms. Unlike IgnoreGraphicsTestAttribute, this ignore cannot be overridden, since the test would never succeed on an incompatible platform.
TestOnlySupportedOnAttribute
Marks a test as only supported on the specified platforms. Tests decorated with this attribute will be skipped on all platforms except those listed. Unlike IgnoreGraphicsTestAttribute, this ignore cannot be overridden, since the test would never succeed on an incompatible platform.
TestUtils
Utility class for graphics test nodes.
TextureComparisonAlgorithm
Abstract base class for algorithms that compare two textures using a specified threshold.
UseGraphicsTestCasesAttribute
Attribute to specify that a test should use graphics test cases.
Structs
EuclideanDistanceResult
Result of a Euclidean distance comparison between two textures, including the average and maximum distance, as well as the per-pixel deltas and dimensions of the compared textures.
ImageAssert.ImageComparisonResults
Represents the results from an image comparison operation.
LumaPipelineResult
Contains the luma values on an actual and expect image. This is an output of the LumePipeline and used both by the SSIM and PSNR algorithm.
PeakSignalToNoiseRatioResult
The result of a Peak Signal to Noise Ratio (PSNR) texture comparison.
StructuralSimilarityResult
The result of a Structural Similarity Index Measure texture comparison.
Interfaces
IGlobalContextProvider
Interface for providing a global context. This is used to provide a context that is shared across all tests.
IGraphicsTestCaseCollector
Interface for Graphics Test Case Collectors
IPlatformNode
Interface for creating new platform nodes for GraphicsTestPlatform. Read-only nodes only need to implement DataType and Current. Activatable nodes (mutable contexts) should extend GlobalContext<TEnum> instead of implementing this interface directly.
IReferenceImageFileDescriptor
Describes and builds reference image file names and validates them against an expected pattern.
IReferenceImageNamingStrategy
Pluggable strategy for building a reference image file descriptor for parameterized graphics tests.
ITextureComparisonResult
Represents the result of an image comparison.
ITextureComparisonSettings
Represents settings used to compare images.
Enums
HeatmapColorScheme
The color scheme that the divergence heatmap will be displayed in.
IgnoreGraphicsTestMode
Enumeration for the different modes of ignoring graphics tests.
ImageComparisonSettings.ImageTests
The image comparison tests that are available. These tests are used to determine whether the images are equal or not.
ImageComparisonSettings.PixelTests
The image comparison pixel tests that are available. These tests are used to determine whether an individual pixel is correct or not. An incorrect pixel will increase the counter associated with the IncorrectPixelsCount image test. This is only relevant when ActiveImageTests has the IncorrectPixelsCount flag set.
ImageExtension
Describes an image extension.
LumaColorSpaceMode
Specifies how luminance (luma) values should be computed with respect to gamma and linear color spaces.
ReferenceImageRootSource
Selects how the reference image file stem is derived when a graphics test method is parameterized.
TestContentBundle.LoadState
Enumeration of the load state of the content bundle. This is used to track the loading state of the content bundle. It contains options for not loaded, loading, loaded, and failed states.