Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Code Coverage by Sachin Vas

Code Coverage by Sachin Vas

Swift Bangalore Chapter #18

Swift India

October 19, 2019
Tweet

More Decks by Swift India

Other Decks in Programming

Transcript

  1. CI/CD ▸ Merges changes to main branch as often as

    possible ▸ Validates changes using automated tests ▸ Added advantage over delayed merges which usually ends up in integration hell ▸ Always checks newer commits doesn’t break any of the existing code CI PIPELINE
  2. CI/CD ▸ Extension on the previous step ▸ Release new

    changes quickly in a sustainable way ▸ Deploy at your convenience time (daily, weekly, fortnightly) ▸ Best practice is to rollout updates in small batches for ease troubleshooting any production issues. ▸ Continuous Deployment is the automatic version of Continuous Delivery. CD PIPELINE
  3. CODE COVERAGE ▸ Percentage of code covered by automated tests

    ▸ Determines which statements are executed ▸ Part of feedback loop WHAT?
  4. CODE COVERAGE ▸ Our tests actually test our code ▸

    Do we have enough testing in place ▸ Maintain Test Quality over the lifetime of a project WHY?
  5. CODE COVERAGE ▸ Built into the IDE ▸ Provides line

    coverage metrics ▸ You can exercise your frameworks (only open source files) ▸ You can customise running certain TestBundles on Certain Targets XCODE CODE COVERAGE
  6. LLVM-COV ▸ llvm-cov ▸ Provides 4 types of code coverage

    ▸ Sub commands for meaningful statistics ▸ Custom script to generate coverage ▸ Provides similar reports as Jacuco. LLVM CODE COVERAGE
  7. LLVM-COV ▸ llvm-profdata ▸ Merge multiple Profile Data Files ▸

    Useful if you have multiple in-house frameworks LLVM PROFDATA COVERAGE
  8. CODE COVERAGE ▸ Ensure every Public Method is covered ▸

    Increase Code Coverage for each Public Method ▸ Cover Conditionals ▸ Prefer Branch Coverage over other types RECOMMENDATION