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.

Question Code Coverage not being calculated at all

Discussion in 'Testing & Automation' started by alterfenix, Jan 22, 2023.

  1. alterfenix

    alterfenix

    Joined:
    Jul 19, 2015
    Posts:
    6
    Hello, I have a problem with code coverage.

    One machine is Mac with Unity Editor 2022.2.0 and another is Linux also with Unity 2022.2.0.
    On both I run command (paths are different ofc). On Mac everything works fine however when testing exactly same commit on Linux I get code coverage 0 for all classes. Not sure what I may be doing wrong. Last time I tried this with completely fresh workspace to make sure it's not broken however nothing changed. Also tests are run and results are properly updated - Unity is finding and executing those tests

    Following input is obtained by Unity:

    Code (bash):
    1. /var/lib/jenkins/Unity-2022.2.0f1/Editor/Unity
    2. -runTests
    3. -batchmode
    4. -nographics
    5. -debugCodeOptimization
    6. -burst-disable-compilation
    7. -enableCodeCoverage
    8. -coverageResultsPath
    9. /var/lib/jenkins/workspace/Tafl_verify/coverage/EditMode
    10. -coverageOptions
    11. generateAdditionalMetrics;generateHtmlReport;generateHtmlReportHistory;generateBadgeReport;generateAdditionalReports
    12. -projectPath
    13. /var/lib/jenkins/workspace/Tafl_verify/Tafl/main/client/Tafl
    14. -testResults
    15. /var/lib/jenkins/workspace/Tafl_verify/EditMode.xml
    16. -testPlatform
    17. EditMode
     
  2. alterfenix

    alterfenix

    Joined:
    Jul 19, 2015
    Posts:
    6
    As a workaround I have moved test execution to Mac for the time being however I'd still like to understand the reason why it is not working on this Linux worker. One thing that I have noticed as a difference is that on Mac csproj files are properly regenerated while on Linux they are not.
     
  3. Unity-Nikos

    Unity-Nikos

    Unity Technologies

    Joined:
    Sep 30, 2015
    Posts:
    82
    Hi @alterfenix. Could you please install package version 1.2.2 from the Package Manager and see if you still get this behaviour?
     
  4. JuliusJ

    JuliusJ

    QA Minion of the month Unity Technologies

    Joined:
    May 20, 2015
    Posts:
    30
    Hi @alterfenix. I've tried to reproduce your issue but was unable to. Would you be able to submit a bug report with your project or a small repro project and share the incident ID? I'll then be able to open a bug if necessary or provide you with a solution to your issue.

    Also, I've noticed that you're using -burst-disable-compilation command line argument which is incorrect. It appears that our documentation had a typo. We'll update it with a correct argument, which is --burst-disable-compilation (notice double dash at the front). Until we release a new package version with the fix, you will need to add both of them - one which actually works and the other which is (incorrectly) expected by the package.
     
  5. watsonsong

    watsonsong

    Joined:
    May 13, 2015
    Posts:
    555
    I think I met the same problem, not sure about this command line option.
    All other options is single dash but this use double dash, I think the requirement of double dash is more like a bug but the document?