Graphics Test Framework sample projects
Learn the structure of a project that uses the Graphics Test Framework.
Prerequisites
To use the sample projects, install the Graphics Test Framework package in your project.
Initial setup
- From the main menu, select Window > Package Manager to open the Package Manager window.
- Select All Packages then Graphics Test Framework.
- Select the Samples tab.
- Select Import next to a sample.
Unity installs samples in the Assets/Samples/Graphics Test Framework/<version>/ folder in the Project window.
Write a basic test
Open the scripts in the Basic Graphics Tests folder for simple examples of [GraphicsTest] and [SceneGraphicsTest] tests. For more information, refer to Write a scene test and Write a rendering code test.
Write a parameterized test
Open the scripts in the Parameterized Tests folder for examples of parameterized tests with [GraphicsTestParam] and [GraphicsTestParamSource] attributes. For more information, refer to Write a scene test.
Customize image comparison
Open the scripts in the Image Comparison Examples folder for examples of using ImageComparisonSettings to configure different comparison algorithms and thresholds. For more information, refer to Customize tests.
Filter tests by platform
Open the scripts in the Platform Filtering Examples folder for examples of ignoring tests using [IgnoreGraphicsTest], [TestNotSupportedOn], and [TestOnlySupportedOn] attributes. For more information, refer to Test specific platforms.
Capture a Unity Editor window
Open the scripts in the Editor Window Capture folder for examples of using EditorWindowCapture to capture Editor windows and the Scene view. For more information, refer to Write a Unity Editor window test.
Advanced use cases
Open the scripts in the Advanced Patterns folder for examples of advanced use cases, such as custom test case sources, custom pre-build setup attributes, GlobalContext, custom IPlatformNode implementations, and the GraphicsTestLogger. For more information, refer to Run code before a test and Customize tests.