Search Unity

Code coverage support for tests

Discussion in 'Testing & Automation' started by liortal, Jul 25, 2020.

  1. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    I am wondering which minimal Unity version is requirted for tracking code coverage in tests?

    I recall that Unity's code coverage support was introduced somewhere in the 2019.x cycle, but JetBrains DotCover claims that they support Unity 2018.3+

    So - which version is required? And on a more technical note - what runtime changed were required to achieve this? I suppose it is sonething that is baked into the .net (mono) runtime? Or is there some other magic going on?
     
  2. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,659
    I'm not sure how DotCover is doing things, but Unity's package requires 2019.3 - you might be able to hack it to work in 2019.2 as that's when the Coverage API was added, but no earlier than that.

    Yes, there were changes required to Mono to support this - e.g. making their coverage data structures get cleaned up correctly when unloading/reloading the AppDomain.
     
  3. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    In that case, i wonder how DotCover pulls it off in 2018.3 ...