| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
yg3n
10年前发布

为Swift生成测试代码覆盖信息的工具:SwiftCov

一个工具用于为Swift生成测试代码覆盖信息。

Installation

Install theswiftcovcommand line tool by runninggit clonefor this repo followed bymake installin the root directory.

Usage

$ swiftcov help  Available commands:       generate   Generate test code coverage files for your Swift tests     help       Display general or command-specific help     version    Display the current version of SwiftCov


generate

Run the tests and generate code coverage files. You can write any xcodebuild command as arguments for testing your project.

$ swiftcov generate  Usage: swiftcov generate [swiftcov options] xcodebuild [xcodebuild options] (-- [swift files])

$ swiftcov generate \    xcodebuild test \    -project Example.xcodeproj -scheme 'Example' \    -configuration Release -sdk iphonesimulator

Use the--outputparameter to specify a destination directory for the coverage files. If you think the coverage generation process is slow, you can specify thethresholdoption. It makes running faster to limit the count of the number of executions.

Currently, the default value of threshold option is 1 for performance reasons. Since some test cases may take a very long time generating coverage data, especially if some code paths are frequently hit (as is the case with loops).

$ swiftcov generate --output ./coverage --threshold 1 \    xcodebuild test \    -project Example.xcodeproj -scheme 'Example'    -configuration Release -sdk iphonesimulator

Options

  • --output OUTPUT_DIRspecify output directory for generated coverage files.
  • --threshold LIMIT_COUNTspecify the maximum number of hits you wish to measure. Reducing this number can drastically speed up SwiftCov.
  • --debugOutput very verbose progress messages.
  • -- [swift files]Pass a space-separated list of files for which to measure code coverage, with either relative or absolute paths, after the--at the end of your command.

help

Display general or command-specific help.

version

Display the current version.

How to run example project

$ make install  $ cd Examples/ExampleFramework/  $ swiftcov generate --output coverage_ios \    xcodebuild test \    -project ExampleFramework.xcodeproj \    -scheme ExampleFramework-iOS \    -sdk iphonesimulator \    -configuration Release

Please see the generated coverage file!


项目主页:
http://www.open-open.com/lib/view/home/1433384732666

 本文由用户 yg3n 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1433384732666.html
SwiftCov Apple Swift开发