docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class UITestComponent

    Use this class to create your own reusable test components that define custom behavior at specific phases of the test lifecycle.

    Inheritance
    object
    UITestComponent
    StylesApplicator
    CleanupUtil
    MenuSimulator
    Inherited Members
    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 UITestComponent
    Remarks

    Implement the Initialize(CommonUITestFixture), BeforeTest(), AfterTest(), Shutdown() as needed. Use AddTestComponent(UITestComponent) to activate the test component. Use RemoveTestComponent(UITestComponent) to deactivate the test component.

    Properties

    fixture

    The test fixture to which the UITestComponent is attached.

    Declaration
    protected AbstractUITestFixture fixture { get; }
    Property Value
    Type Description
    AbstractUITestFixture

    Methods

    AfterTest()

    This function will be invoked when the RemoveTestComponent(UITestComponent) function is called.

    Declaration
    protected virtual void AfterTest()

    BeforeTest()

    This function will be invoked when the AddTestComponent(UITestComponent) function is called.

    Declaration
    protected virtual void BeforeTest()

    Initialize(AbstractUITestFixture)

    Invoked when the AddTestComponent(UITestComponent) function is called.

    Declaration
    protected virtual void Initialize(AbstractUITestFixture testFixture)
    Parameters
    Type Name Description
    AbstractUITestFixture testFixture

    The test fixture to which the test component is being added.

    Shutdown()

    This function will be invoked when the RemoveTestComponent(UITestComponent) function is called.

    Declaration
    protected virtual void Shutdown()
    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)