Search Unity

Resolved Code Coverage isn't calculated for embedded package in batchmode

Discussion in 'Testing & Automation' started by liortal, Apr 16, 2023.

  1. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    We are using Code Coverage package v1.2.2, when running from batchmode (command line) on our build server, we are not getting the coverage for embedded packages we have in the project.

    Running tests locally (from the Test runner window) properly generates the code coverage reports, with the data for embedded packages.

    Is this a known issue ? am i missing something here ?
     
  2. JuliusJ

    JuliusJ

    QA Minion of the month Unity Technologies

    Joined:
    May 20, 2015
    Posts:
    35
    Hi. This sounds like a bug. We had a similar issue in the past, but I'm unable to reproduce it on any of the editor streams, so you must be experiencing a different issue.

    Can you report a bug and include editor version and command line you're using on your build server? Editor.log from your build server would also be useful. Let me know the incident ID and I'll see if I can reproduce it.
     
  3. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    @JuliusJ Quick update -
    After adding the useProjectSettings command line option, it works fine (the embedded package is listed in project settings).

    When omitting this, i am getting coverage results for all assemblies in the project, but not for the embedded package. I would expect to see it as well.
     
  4. JuliusJ

    JuliusJ

    QA Minion of the month Unity Technologies

    Joined:
    May 20, 2015
    Posts:
    35
    Are you using
    assemblyFilters
    coverage option? If it's not used, the current default behaviour is to only include assemblies under Assets folder.

    If your package assembly names have the same beginning then something like
    assemblyFilters:+<assets>,+my.package.assembly.*
    would work. Another option is to list all package assemblies you want to be included. Recently released Code Coverage 1.2.3 version added filtersFromFile option which makes managing longer filtering rules easier.
     
    liortal likes this.
  5. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    @JuliusJ i was not using that option - so i was expecting all assemblies to be included.
    After adding useProjectSettings it works just fine.