Search Unity

Feedback Explicit attribute ignored by Test Runner

Discussion in 'Testing & Automation' started by DrummerB, May 15, 2020.

  1. DrummerB

    DrummerB

    Joined:
    Dec 19, 2013
    Posts:
    135
    The Test Runner seems to ignore the [Explicit] attribute added to test cases when starting the test run via the API.

    I start a test run like this:

    Code (CSharp):
    1.  
    2. [MenuItem("Test/Run Runtime Tests")]
    3. static void RunRuntimeTests()
    4. {
    5.     var testRunner = ScriptableObject.CreateInstance<TestRunnerApi>();
    6.     var filter = new Filter
    7.     {
    8.         testMode = TestMode.PlayMode,
    9.         groupNames = new[] {@"^Core\.Tests\.Runtime\."}
    10.     };
    11.     testRunner.Execute(new ExecutionSettings(filter));
    12. }
    13.  
    Is there a way to run a selection of tests (i.e. all in a certain namespace) and still skip [Explicit] tests?
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    You can tag the tests with a category (e.g: Explicit) instead of using the attribute. Then run whatever groups you want.