docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class UITestComponent

    Creates 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(AbstractUITestFixture), BeforeTest(), AfterTest(), Shutdown() as needed.

    You can activate and deactivate test components:

    • To activate the test component, use AddTestComponent(UITestComponent).
    • To deactivate the test component, use RemoveTestComponent(UITestComponent).

    Properties

    fixture

    The test fixture to which the UITestComponent is attached.

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

    Methods

    AfterTest()

    Runs when the RemoveTestComponent(UITestComponent) function is called.

    Declaration
    protected virtual void AfterTest()

    BeforeTest()

    Runs 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 added.

    Shutdown()

    Runs 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)