Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug Impossible to run PlayMode tests grouped by namespace

Discussion in 'Testing & Automation' started by kosieniakd, Jul 20, 2021.

  1. kosieniakd

    kosieniakd

    Joined:
    Aug 17, 2020
    Posts:
    5
    Hello,

    I have spotted what seems to be a regression when upgrading the test framework from 1.1.24 to any more recent version. The project I am working on is using Unity 2019.4.28f1
    To reproduce this:
    - Create a test directory as explained in the documentation
    - Create directories inside there to organise some tests
    - For each Script inside of a folder, make them part of a namespace with the corresponding name (in my example, it is Tests.Namespace1 or Tests.Namespace2)
    - Create some [UnityTest] in each script
    You should have an arborescence looking like the screenshot below :

    TestFrameworkExample.png


    Now, right-click on a namespace listed in the TestRunner, and click on Run. The tests will be ignored.
    With the version 1.1.24, I have a normal behavior and tests are run.
     
    mvaz_p likes this.
  2. Warnecke

    Warnecke

    Unity Technologies

    Joined:
    Nov 28, 2017
    Posts:
    78
    Hey. Thanks for reporting this. It is indeed a regression and we are working on a fix for it.
     
    cacolukia likes this.
  3. cacolukia

    cacolukia

    Joined:
    Sep 23, 2012
    Posts:
    4
    So temporary workaround is to flatten Namespace and leave files structure unchanged, while renaming classes to single class splitted among files with "partial" keyword. Is that so?

    Taking example above, it would be:
    NewTestScript1.cs with "public partial class NewTestScript{}" and namespace Tests/Namespace1
    NewTestScript2.cs
    with "public partial class NewTestScript{}" and namespace Tests/Namespace1