docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class RuntimeUITestFixture

    Test fixture base class that creates a runtime panel.

    Inheritance
    object
    AbstractUITestFixture
    CommonUITestFixture
    RuntimeUITestFixture
    Inherited Members
    CommonUITestFixture.AddTestComponent(UITestComponent)
    CommonUITestFixture.RemoveTestComponent(UITestComponent)
    CommonUITestFixture.FindTestComponent<T>()
    CommonUITestFixture.simulate
    CommonUITestFixture.clearContentAfterTest
    CommonUITestFixture.themeStyleSheet
    CommonUITestFixture.debugMode
    CommonUITestFixture.FixtureUnitySetUp()
    AbstractUITestFixture.AddTestComponent<T>()
    AbstractUITestFixture.RemoveTestComponent<T>()
    AbstractUITestFixture.panel
    AbstractUITestFixture.rootVisualElement
    AbstractUITestFixture.panelName
    AbstractUITestFixture.needsRendering
    AbstractUITestFixture.pixelsPerPoint
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.UIElements.TestFramework
    Assembly: Unity.UI.TestFramework.Runtime.dll
    Syntax
    public abstract class RuntimeUITestFixture : CommonUITestFixture
    Remarks

    Use this class to write Play mode tests for UI Toolkit content.

    By default, the runtime panel uses the default runtime theme. To customize the theme during tests, set themeStyleSheet. The test fixture creates an empty runtime panel with no `UIDocument` attached. To provide your own UI content for testing, call SetUIContent(UIDocument).

    Constructors

    RuntimeUITestFixture()

    Instantiates a new empty RuntimeUITestFixture.

    Declaration
    protected RuntimeUITestFixture()

    Properties

    panelSize

    The size of the rootVisualElement of the panel.

    Declaration
    public override sealed Vector2 panelSize { get; set; }
    Property Value
    Type Description
    Vector2
    Overrides
    AbstractUITestFixture.panelSize

    Methods

    ApplyPanelSize()

    Applies the panelSize to the panel.

    Declaration
    public void ApplyPanelSize()

    CreateDefaultUIScene()

    Sets up a GameObject with an empty UIDocument. Use themeStyleSheet to set the style sheet. To use your own UI content during the test, use SetUIContent(UIDocument).

    Declaration
    public void CreateDefaultUIScene()

    FixtureOneTimeSetUp()

    Sets up the test fixture.

    Declaration
    public override void FixtureOneTimeSetUp()
    Overrides
    CommonUITestFixture.FixtureOneTimeSetUp()

    FixtureOneTimeTearDown()

    Tears down the test fixture.

    Declaration
    public override void FixtureOneTimeTearDown()
    Overrides
    CommonUITestFixture.FixtureOneTimeTearDown()

    FixtureSetUp()

    Sets up the test.

    Declaration
    public override void FixtureSetUp()
    Overrides
    CommonUITestFixture.FixtureSetUp()

    FixtureTearDown()

    Tears down the test.

    Declaration
    public override void FixtureTearDown()
    Overrides
    CommonUITestFixture.FixtureTearDown()

    FixtureUnityTearDown()

    Tears down the test using coroutines.

    Declaration
    public override IEnumerator FixtureUnityTearDown()
    Returns
    Type Description
    IEnumerator

    An IEnumerator for yield instructions

    Overrides
    CommonUITestFixture.FixtureUnityTearDown()

    RecreatePanel()

    Recreates the simulated UI Toolkit panel, providing a fresh instance. If you set a custom UIDocument using SetUIContent(UIDocument), it disables the associated GameObject and re-enables it instead of recreating.

    Declaration
    public override void RecreatePanel()
    Overrides
    AbstractUITestFixture.RecreatePanel()

    ReleasePanel()

    Destroys created scene components and the UIDocument.

    Declaration
    public override void ReleasePanel()
    Overrides
    AbstractUITestFixture.ReleasePanel()

    SetUIContent(UIDocument)

    Assigns the specified UIDocument to be used by the test fixture.

    Declaration
    public void SetUIContent(UIDocument doc)
    Parameters
    Type Name Description
    UIDocument doc

    The UIDocument component to host the test content.

    In This Article
    Back to top
    Copyright © 2025 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)