Skip to content

serralvo/XCTestMetrics

Repository files navigation

“XCTestMetrics

Welcome to XCTestMetrics, a command-line tool that provides metrics about your project tests.

XCTestMetrics Report on Slack

Features

  • Get metrics about your project tests, like the number of failures, when it happened, the percentage of flakiness.
  • Identify flaky tests.
  • Easy and fast setup.

Requirements

  • Xcode 11

Installation

Homebrew

$ brew tap serralvo/XCTestMetrics https://github.com/serralvo/XCTestMetrics.git
$ brew install serralvo/XCTestMetrics/xctestmetrics

CocoaPods

pod 'XCTestMetrics'

Usage

The usage of XCTestMetrics is based on two steps: the first one is to register each test result, the second one is to display all results using a report.

First Step:

  • Run project tests.
  • Get the path of your project inside DerivedData folder.
    • Will be something like this: ~/Library/Developer/Xcode/DerivedData/YourProject-gybqxixuerfernzjaklbxkwwstqj
  • Call log command using derived data path:
$ xctestmetrics log path-to-derived-data
  • The log will be added to xctestmetrics-output folder.
  • Commit the log file.
$ git add xctestmetrics-output/.
$ git commit -m "Adds xctestmetrics log" 

⚠️ Important, do it for every build of your project, use this tool on your continuous integration system.

Second Step:

Slack

  • You will need to input a webhook URL:
  • Run:
$ xctestmetrics report slack your-web-hook-url
  • That's it! The message with metrics will be sent to Slack.

HTML

  • Run:
$ xctestmetrics report html
  • That's it! The report file (index.html) will be stored into xctestmetrics-report folder.

If you want remove xctestmetrics-output after report generation:

$ git rm -r xctestmetrics-output/
$ git add . 
$ git commit -m "Removes xctestmetrics-output folder"

License

XCTestMetrics is released under the MIT License.

Credits

Made with ❤️ by Fabrício Serralvo

About

🛠 A command-line tool that provides metrics about your project tests. Written in Swift 🧡

Topics

Resources

License

Stars

Watchers

Forks