Search Unity

How to exclude some tests when building a Build Test

Discussion in 'Testing & Automation' started by Maeslezo, May 20, 2020.

  1. Maeslezo

    Maeslezo

    Joined:
    Jun 16, 2015
    Posts:
    332
    Hello,

    I have some tests that I would like to run in a build test.

    The problem is that I can not generate the build because other tests don't compile in that platform.

    I have try with -testFilter
    Command line:
    %unityPath% -runTests -batchmode -projectPath %projectPath% -testResults %resultsPath% -testPlatform StandaloneWindows64 -testFilter CompleteFlowTests -buildTarget StandaloneWindows64


    I reckon it tries first to generate the build with all the tests and then it filters, running only some tests. Since some tests don't compile, although they are not included by the -testFilter, the whole process fails.

    What I want is to exclude those tests from the build generation

    Thank you
     
  2. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,659
    If you have platform-specific tests that should not be compiled on other platforms, put them in separate Assembly Definitions, and configure the Assembly Definition to only include the platforms that the tests compile on.
     
    Maeslezo likes this.
  3. Maeslezo

    Maeslezo

    Joined:
    Jun 16, 2015
    Posts:
    332
    Great, thank you!