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.
구현
네임스페이스: UnityEngine.TestTools
어셈블리: solution.dll
구문
[AttributeUsage(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Method)]
public class RequiresPlayModeAttribute : NUnitAttribute, IApplyToTest
생성자
이름 | 설명 |
---|---|
RequiresPlayModeAttribute(bool) | Flags whether a test, test fixture, or assembly should run in PlayMode when run in the Editor. |
메서드
이름 | 설명 |
---|---|
ApplyToTest(Test) | Modifies a test as defined for the specific attribute. |