Mark a test or test fixture as requiring that particular platform support has been installed into Unity.
This attribute can be used in Editor tests to indicate that the test requires support for particular platforms to have been installed. If the required support is not available, the test will be skipped.
For example, tests that use the BuildPipeline API to build a player for iOS may wish to use this attribute to indicate that they require iOS support to be installed, avoiding test failures when the tests are run on a machine without iOS support installed.
using UnityEditor; using UnityEditor.TestTools; using NUnit.Framework;
public class MyBuildTests { [Test] [RequirePlatformSupport(BuildTarget.StandaloneWindows64)] public void CanBuildForWin64Bit() { var result = BuildPipeline.BuildPlayer(EditorBuildSettings.scenes, System.IO.Path.GetTempFileName(), BuildTarget.StandaloneWindows64, BuildOptions.None); Assert.Equals("", result); } }
platforms | The list of platforms required by the test or test fixture marked with this attribute. |
RequirePlatformSupportAttribute | Specifies that the test or test fixture requires particular platform support to be installed. See RequirePlatformSupportAttribute. |