Search Unity

Resolved Code Coverage options are different in UI and on disk

Discussion in 'Testing & Automation' started by nick-morhun, Nov 2, 2023.

  1. nick-morhun

    nick-morhun

    Joined:
    May 12, 2015
    Posts:
    51
    Hi,

    We are using Code Coverage package v1.2.4. When running from batch mode on our build server, with USEPROJECTSETTINGS flag, we don't get the HTML report even when the option is checked in Unity editor. After double-checking, I can see that the option is not present in Settings.json but shows up in UI as checked.
     
  2. JuliusJ

    JuliusJ

    QA Minion of the month Unity Technologies

    Joined:
    May 20, 2015
    Posts:
    35
    Hi @nick-morhun, I've tried to reproduce your issue but useProjectSettings worked correctly for me. Can you check if Auto Generate Report option is enabled in the UI too? If it's not then that might be the reason why report is not getting generated. If it is enabled, then can you share full command line you use to launch the editor?
     
  3. nick-morhun

    nick-morhun

    Joined:
    May 12, 2015
    Posts:
    51
    The command line is: "-batchmode -silent-crashes -nographics -debugCodeOptimization -runTests -buildTarget Android -logFile - -testResults $ABS_LOG_DIR_PATH\test_results.xml -testPlatform editmode -assemblyNames $TEST_ASM -enableCodeCoverage -coverageOptions \"USEPROJECTSETTINGS\"".

    Settings attached. I triggered all the flags, now they are present but still no report inside CodeCoverage folder. Also in the XML report all assemblies are listed, filtering is not applied.
     

    Attached Files:

  4. nick-morhun

    nick-morhun

    Joined:
    May 12, 2015
    Posts:
    51
    OK looks like there is a syntax error, and the log says "Unknown coverage option provided". It was easy to miss... The default behavior to not use Settings.json is really surprising though, given the documentation says that -coverageOptions is optional.
     
    Last edited: Nov 2, 2023
  5. Unity-Nikos

    Unity-Nikos

    Unity Technologies

    Joined:
    Sep 30, 2015
    Posts:
    87
    Noted. Initially the settings and options were only configured in the command line in batchmode. Later we added the useProjectSettings option to be able to use the configuration in Settings.json. We will review this logic in the next major release.
     
    nick-morhun likes this.