docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Run a test and check the results

    After you run a test for the first time to create a reference image, run the test again when you want to check for changes.

    Note: To run a test with a C# script instead, refer to the GraphicsTestBuildManager and GraphicsTestBuilder API documentation.

    Run the test

    To run the test, follow these steps:

    1. From the main menu, select Window > General > Test Runner to open the Test Runner window.
    2. Select your test.
    3. Select Run Selected.

    Unity generates the following in the Project window:

    • The captured image from the test run. The file name ends in Test.
    • The reference image the test used as a comparison, if the test fails. The file name ends in .expected
    • An image with the difference between the two images, if the test fails. The file name ends in .diff.

    Unity also generates an XML test report called TestResults.xml in the user folder of your computer.

    For more information, refer to Run tests in the Test Runner window.

    Note: If you run a test in Edit Mode or Play Mode, Unity uses assets directly from the Project window. If you run a Player test, Unity adds assets to an AssetBundle for runtime code to load.

    Compare the images

    To compare the images, follow these steps:

    1. From the main menu, select Window > General > Graphics Tests to open the Graphics Tests window.
    2. Select your test.
    3. Select the correct tab. For example, if Unity saved the captured image in Assets/ActualImages/Linear/WindowsEditor/Direct3D12/None, select the linear-windowseditor-direct3d12-none tab.
    4. Move the slider to compare the captured image with the reference image.

    For more information, refer to Graphics Tests window reference.

    Check why the test failed

    Check the reasons why a test failed.

    To make tests less sensitive to differences in the images, refer to Change the comparison settings.

    Check in your C# script

    To get the result of the test, add an ImageComparisonResults out parameter when you call the ImageAssert API. For example:

    ImageAssert.AreEqual(
        testCase.ReferenceImage.Image,
        actualTexture,
        settings,
        expectedImagePathLog: testCase.ReferenceImage.LoadMessage,
        saveFailedImage: true,
        saveFailedImageToDisk: false,
        logMessages: true,
        result: out ImageComparisonResults result
    );
    

    Check the logs

    The Graphics Test Framework adds logs in the following places:

    • The Logs tab in the Graphics Tests window.
    • The Console window.
    • A GraphicsTestLogs.log file in the Logs folder.

    To add your own logs, use the GraphicsTestLogger API. For example:

    GraphicsTestLogger.Log("Camera clear flags: " + camera.clearFlags);
    GraphicsTestLogger.Log("Render pipeline: " + GraphicsSettings.currentRenderPipeline?.name);
    

    Additional resources

    • Running tests
    • Write a scene test
    • Graphics Tests window reference
    • Deduplicate reference images
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)