{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Class RequiresPlayModeAttribute | Test Framework | 2.0.1-exp.2
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class RequiresPlayModeAttribute

    Use this attribute to instruct the test framework to run tests in PlayMode or EditMode when run in the Editor, independent of the assembly configuration. The attribute can be applied to a single test method, a test fixture, or the whole assembly. If specified on multiple levels, the test follows the attribute on the lowest level. E.g. if the assembly has [RequiresPlayMode(false)], which runs all tests in EditMode, and the test fixture has [RequiresPlayMode], which runs all tests in PlayMode, then a test in that fixture will run in PlayMode, taking the configuration from the fixture. The attribute allows for two new combinations:

    • Editor-only tests that always run in PlayMode.
    • Tests that can run on platforms, but that run without entering PlayMode when run in the Editor.

    By default, any Editor-only assembly has the equivalent of [RequiresPlayMode(false)] applied, while an assembly with platform support has the equivalent of [RequiresPlayMode] applied.

    Inheritance
    object
    RequiresPlayModeAttribute
    Implements
    IApplyToTest
    Namespace: UnityEngine.TestTools
    Assembly: solution.dll
    Syntax
    [AttributeUsage(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Method)]
    public class RequiresPlayModeAttribute : NUnitAttribute, IApplyToTest

    Constructors

    Name Description
    RequiresPlayModeAttribute(bool)

    Flags whether a test, test fixture, or assembly should run in PlayMode when run in the Editor.

    Methods

    Name Description
    ApplyToTest(Test)

    Modifies a test as defined for the specific attribute.

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