Class CommonUITestFixture
Basic implementation of AbstractUITestFixture.
Manages NUnit's lifetime and provides a PanelSimulator to simulate interactions with UI Toolkit content.
Provides component-based extensibility for reusable utilities.
Actual usage done via UITestFixture, EditorWindowUITestFixture<EditorWindowType>, or RuntimeUITestFixture
Inherited Members
Namespace: UnityEngine.UIElements.TestFramework
Assembly: Unity.UI.TestFramework.Runtime.dll
Syntax
public abstract class CommonUITestFixture : AbstractUITestFixture
Properties
clearContentAfterTest
Clears the rootVisualElement after each test when set to true.
Declaration
public override sealed bool clearContentAfterTest { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
Remarks
Defaults to true.
debugMode
Property which determines whether the window should remain open at the end of a failed test for debugging purposes. Default is false (off).
Declaration
public override bool debugMode { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
Remarks
Set this property to true if you want an editor window to remain open for manual debugging after a test failure. Tests in playmode will pause execution
Should be set to false when running tests in batch mode.
simulate
Returns the PanelSimulator used by the test fixture.
Declaration
public override sealed PanelSimulator simulate { get; set; }
Property Value
| Type | Description |
|---|---|
| PanelSimulator |
Overrides
Remarks
Use this property to interact with the simulated panel.
themeStyleSheet
Theme style sheet used by this test fixture.
Declaration
public override ThemeStyleSheet themeStyleSheet { get; set; }
Property Value
| Type | Description |
|---|---|
| ThemeStyleSheet |
Overrides
Remarks
Defaults to null.
When the value is null, the style applied is the default theme style sheet.
Methods
AddTestComponent(UITestComponent)
Adds the component to the test fixture.
Declaration
public override sealed void AddTestComponent(UITestComponent component)
Parameters
| Type | Name | Description |
|---|---|---|
| UITestComponent | component | The UITestComponent to add to the test fixture. |
Overrides
Remarks
Adding the component to the test fixture triggers relevant
UITestComponent virtual methods based on the current test state.
FindTestComponent<T>()
Returns the first component of type T attached to the test fixture.
Declaration
public override sealed T FindTestComponent<T>()
Returns
| Type | Description |
|---|---|
| T | The first component of type T. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of |
Overrides
FixtureOneTimeSetUp()
Sets up the test fixture.
Declaration
public override void FixtureOneTimeSetUp()
Overrides
FixtureOneTimeTearDown()
Tears down the test fixture.
Declaration
public override void FixtureOneTimeTearDown()
Overrides
FixtureSetUp()
Sets up the test.
Declaration
public override void FixtureSetUp()
Overrides
FixtureTearDown()
Tears down the test.
Declaration
public override void FixtureTearDown()
Overrides
FixtureUnitySetUp()
Sets up the test using coroutines.
Declaration
public override IEnumerator FixtureUnitySetUp()
Returns
| Type | Description |
|---|---|
| IEnumerator | An IEnumerator for yield instructions |
Overrides
FixtureUnityTearDown()
Tears down the test using coroutines.
Declaration
public override IEnumerator FixtureUnityTearDown()
Returns
| Type | Description |
|---|---|
| IEnumerator | An IEnumerator for yield instructions |
Overrides
RemoveTestComponent(UITestComponent)
Removes the component from the test fixture.
Declaration
public override sealed void RemoveTestComponent(UITestComponent component)
Parameters
| Type | Name | Description |
|---|---|---|
| UITestComponent | component | The |
Overrides
Remarks
Removing the component from the test fixture triggers relevant
UITestComponent virtual methods based on the current test state.