ios - 使用 getcov 和 lcov 的 xcode7 代码覆盖率

标签 ios xcode code-coverage gcov lcov

使用最新的 Xcode,我们现在可以查看本地构建或集成的代码覆盖率。我想导出覆盖结果来构建对这些数据的一些分析。

项目https://github.com/jonreid/XcodeCoverage似乎是一种将报告数据导出为 xml 或 html 的简单方法,我可以用它来构建其他东西。但我遇到了一些困难。

设置相当简单。

  • 从存储库中拉取。
  • 在我的项目中添加 XcodeCovearage。
  • 添加构建阶段脚本以运行 exporting.sh
  • 运行我的测试。
  • 执行 getcov 查看数据。

  • 当我运行 getcov 时,我得到以下输出:
    ~/Library/Developer/Xcode/DerivedData/Garage-emxrmloetsurmcgqiahicyecarix/Build/Intermediates/CodeCoverage/Garage/Products/Debug-iphonesimulator /Workspace/ios/Garage/XcodeCoverage
    /Workspace/ios/Garage/XcodeCoverage
    Capturing coverage data from /Users/Seamus/Library/Developer/Xcode/DerivedData/Garage-emxrmloetsurmcgqiahicyecarix/Build/Intermediates/CodeCoverage/Garage/Intermediates/Garage.build/Debug-iphonesimulator/Garage.build/Objects-normal/x86_64
    geninfo: Use of uninitialized value $version_string in substitution (s///) at /Workspace/ios/Garage/XcodeCoverage/lcov-1.11/bin/geninfo line 1914.
    geninfo: Use of uninitialized value $version_string in pattern match (m//) at /Workspace/ios/Garage/XcodeCoverage/lcov-1.11/bin/geninfo line 1917.
    geninfo: Use of uninitialized value $version_string in pattern match (m//) at /Workspace/ios/Garage/XcodeCoverage/lcov-1.11/bin/geninfo line 1930.
    geninfo: Use of uninitialized value $gcov_version_string in pattern match (m//) at /Workspace/ios/Garage/XcodeCoverage/lcov-1.11/bin/geninfo line 3720.
    geninfo: Use of uninitialized value $gcov_version_string in pattern match (m//) at /Workspace/ios/Garage/XcodeCoverage/lcov-1.11/bin/geninfo line 3720.
    Scanning /Users/Seamus/Library/Developer/Xcode/DerivedData/Garage-emxrmloetsurmcgqiahicyecarix/Build/Intermediates/CodeCoverage/Garage/Intermediates/Garage.build/Debug-iphonesimulator/Garage.build/Objects-normal/x86_64 for .da files ...
    geninfo: WARNING: no .da files found in /Users/Seamus/Library/Developer/Xcode/DerivedData/Garage-emxrmloetsurmcgqiahicyecarix/Build/Intermediates/CodeCoverage/Garage/Intermediates/Garage.build/Debug-iphonesimulator/Garage.build/Objects-normal/x86_64 - skipping!
    Finished .info-file creation
    Reading tracefile Coverage.info
    lcov: ERROR: no valid records found in tracefile Coverage.info
    Reading tracefile Coverage.info
    lcov: ERROR: no valid records found in tracefile Coverage.info
    Reading data file Coverage.info
    genhtml: ERROR: no valid records found in trace file Coverage.info
    

    似乎缺少有关 lcov 或 getcov 脚本版本的一些信息,并且无法构建 coverage.info

    有没有人尝试使用 Xcode7

    有人知道从 Xcode 导出覆盖数据的任何其他有用工具吗?

    谢谢,

    最佳答案

    这是lcov的问题。您只需要将 lcov 版本更新到 1.12 并在代码覆盖中替换

    关于ios - 使用 getcov 和 lcov 的 xcode7 代码覆盖率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32912030/

    相关文章:

    teamcity - 了解 TeamCity 中 dotCover 的覆盖率摘要

    python - 可视化代码覆盖率结果的好方法

    ios - swift 3 : How to export video with text using AVVideoComposition

    ios - 在 Firebase 数据库中查找对象

    iOS 应用商店唯一的应用名称?

    swift - SwiftLint 自定义规则的正则表达式不匹配

    xcode - swift 错误 : class RecordSoundsViewController has no initializers

    ios - 你可以在小部件上使用 3D Touch 吗?

    iphone - 自动供应与临时供应

    javascript - JavaScript 引擎可能会忽略什么样的代码?