{!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} Interface IOuterUnityTestAction | Test Framework | 2.0.1-exp.2
docs.unity3d.com
"{0}"의 검색 결과

    목차 표시/숨기기

    Interface IOuterUnityTestAction

    An attribute can implement this interface to provide actions to execute before setup and after teardown of tests.

    네임스페이스: UnityEngine.TestTools
    어셈블리: solution.dll
    구문
    public interface IOuterUnityTestAction
    예

    IOuterUnityTestAction Example

    using System.Collections;
    using NUnit.Framework;
    using NUnit.Framework.Interfaces;
    using UnityEngine;
    using UnityEngine.TestTools;
    
    public class MyTestClass
    {
       [UnityTest, MyOuterActionAttribute]
       public IEnumerator MyTestInsidePlaymode()
       {
           Assert.IsTrue(Application.isPlaying);
           yield return null;
       }
    }
    
    public class MyOuterActionAttribute : NUnitAttribute, IOuterUnityTestAction
    {
       public IEnumerator BeforeTest(ITest test)
       {
           yield return new EnterPlayMode();
       }
    
       public IEnumerator AfterTest(ITest test)
       {
           yield return new ExitPlayMode();
       }
    }

    Test actions with domain reload example

    using NUnit.Framework.Interfaces;
    
    
    public class TestActionOnSuiteAttribute : NUnitAttribute, ITestAction
    {
       public void BeforeTest(ITest test)
       {
           Debug.Log("TestAction OnSuite BeforeTest");
       }
    
       public void AfterTest(ITest test)
       {
       }
    
       public ActionTargets Targets { get { return ActionTargets.Suite; } }
    }
    
    public class TestActionOnTestAttribute : NUnitAttribute, ITestAction
    {
       public void BeforeTest(ITest test)
       {
           Debug.Log("TestAction OnTest BeforeTest");
       }
    
       public void AfterTest(ITest test)
       {
           Debug.Log("TestAction OnTest AfterTest");
       }
    
       public ActionTargets Targets { get { return ActionTargets.Test; } }
    }
    
    public class OuterTestAttribute : NUnitAttribute, IOuterUnityTestAction
    {
       public IEnumerator BeforeTest(ITest test)
       {
           Debug.Log("OuterTestAttribute BeforeTest");
           yield return null;
       }
    
       public IEnumerator AfterTest(ITest test)
       {
           Debug.Log("OuterTestAttribute AfterTest");
           yield return null;
       }
    }
    
    [TestActionOnSuite]
    public class ActionOrderTestBase
    {
       [Test, OuterTest, TestActionOnTest]
       public void UnitTest()
       {
           Debug.Log("Test");
       }
    
       [UnityTest, OuterTest, TestActionOnTest]
       public IEnumerator UnityTestWithDomainReload()
       {
           Log("Test part 1");
           yield return new EnterPlayMode();
           //Domain reload
           yield return new ExitPlayMode();
           Log("Test part 2");
       }
    }

    메서드

    이름 설명
    AfterTest(ITest)

    Executed after each test is run

    BeforeTest(ITest)

    Executed before each test is run

    문서 개요
    맨 위로
    Copyright © 2023 Unity Technologies — 상표 및 이용약관
    • 법률정보
    • 개인정보처리방침
    • 쿠키
    • 내 개인정보 판매 금지
    • Your Privacy Choices (Cookie Settings)