xrun

Crates.ioxrun
lib.rsxrun
version0.9.0
sourcesrc
created_at2024-05-03 13:10:39.627894
updated_at2024-07-11 03:47:47.475528
descriptionCommand Line Tools for macOS. With xrun you can run Xcode unit tests faster through the terminal.
homepage
repositoryhttps://github.com/heroesofcode/xrun
max_upload_size
id1228749
size627,814
João Lucas (joaolfp)

documentation

README

Command-line tools for macOS. With xrun you can run iOS and iPadOS unit tests through the terminal or CI with more ease and reading.

  • Shows the tests that were executed most easily.
  • Shows a table with test information.
  • If there is an error, it shows a table with failed tests.
  • Runs in the terminal and CI with an easy command
  • Support to iOS, iPadOS and macOS
  • Generate PDF of failed tests

Installing

Cargo

Installing from crates.io (requires Rust/Cargo):

cargo install xrun

Homebrew

You can install with Homebrew:

brew tap heroesofcode/taps
brew install heroesofcode/taps/xrun

How to use?

// iOS
xrun extension project scheme version iPhone

// macOS
xrun extension project scheme macOS

Example .xcodeproj

// iOS
xrun project DeliveryApp.xcodeproj DeliveryApp 17.4 15

// macOS
xrun project DeliveryApp.xcodeproj DeliveryApp macOS

Example .xcworkspace

// iOS
xrun workspace DeliveryApp.xcworkspace DeliveryApp 17.4 15

// macOS
xrun workspace DeliveryApp.xcworkspace DeliveryApp macOS

Example with fail

If you want when any test fails at the end, shows the terminal or CI as an error (it is optional if you don't use it and even test fails not to show it at terminal or CI as an error).

// iOS
xrun workspace DeliveryApp.xcworkspace DeliveryApp 17.4 15 fail

// macOS
xrun workspace DeliveryApp.xcworkspace DeliveryApp macOS fail

Example with generate-file

If there are errors in the tests, use generate-file to generate a results-xrun.pdf file with the error table.

// iOS
xrun workspace DeliveryApp.xcworkspace DeliveryApp 17.4 15 fail generate-file

or

xrun workspace DeliveryApp.xcworkspace DeliveryApp 17.4 15 generate-file

------------

// macOS
xrun workspace DeliveryApp.xcworkspace DeliveryApp macOS fail generate-file

or

xrun workspace DeliveryApp.xcworkspace DeliveryApp macOS generate-file
    __  __    ____      _   _   _   _
    \ \/"/ U |  _"\ uU |"|u| | | \ |"|
    /\  /\  \| |_) |/ \| |\| |<|  \| |>
   U /  \ u  |  _ <    | |_| |U| |\  |u
    /_/\_\   |_| \_\  <<\___/  |_| \_|
  ,-,>> \\_  //   \\_(__) )(   ||   \\,-.
   \_)  (__)(__)  (__)   (__)  (_")  (_/  (0.9.0)

💻 https://github.com/heroesofcode/xrun
===================================================

📋 Processing.......


CoreTests
    ✅ testSuccessWhenRegisteringTheUICollectionViewCellAndDequeuing (0.064 seconds)
    ✅ testSuccessWhenRegisteringTheUITableViewCellAndDequeuing (0.013 seconds)
    ✅ testWhenSetupBaseViewWithSuccess (0.001 seconds)

DesignSystemTests
    ✅ testShouldValidateLayout (0.137 seconds)

CoordinatorTests
    ✅ testHandleEvent (0.002 seconds)
    ✅ testInit (0.003 seconds)
    ✅ testStart (0.001 seconds)

AnalyticsTests
    ✅ testExample (0.001 seconds)

AuthenticationTests
    ✅ testShouldValidateLayout (0.093 seconds)


🗳️  The results have been completed below

+---------+-------------+-----------------+------------------+
| Runtime | Total Tests | ✅ Passed Tests |  ❌ Failed Tests |
+============================================================+
| 65.45s  | 9           | 9               | 0                |
+---------+-------------+-----------------+------------------+

👏 Congratulations, no errors were found!!!

If all tests present errors, a table will be presented with the information and another table with only the errors.

CoordinatorTests
    ✅ testHandleEvent (0.001 seconds)
    ❌ testInit, XCTAssertNil failed: "Coordinator.BaseCoordinator"
    ✅ testStart (0.000 seconds)

AnalyticsTests
    ✅ testExample (0.001 seconds)

AuthenticationTests
    ❌ testShouldValidateLayout, failed - Snapshot does not match reference.


🗳️  The results have been completed below

+---------+-------------+-----------------+------------------+
| Runtime | Total Tests | ✅ Passed Tests |  ❌ Failed Tests |
+============================================================+
| 35.64s  | 48          | 46              | 2                |
+---------+-------------+-----------------+------------------+

⚠️ Below contains the errors

+---------------------+------------------------------------------------------------------------------+
| Module              | Errors found                                                                 |
+====================================================================================================+
| CoordinatorTests    |     ❌ testInit, XCTAssertNil failed: "Coordinator.BaseCoordinator"          |
|---------------------+------------------------------------------------------------------------------|
| AuthenticationTests |     ❌ testShouldValidateLayout, failed - Snapshot does not match reference. |
+---------------------+------------------------------------------------------------------------------+

GitHub Actions

It works on any CI, here I'll bring an example on GitHub Action for you to add to your iOS/iPadOS project

- name: Install xrun
  run: |
      brew tap heroesofcode/taps
      brew install heroesofcode/taps/xrun

- name: Run tests with xrun
  run: xrun project DeliveryApp.xcodeproj DeliveryApp 17.5 15 fail

Contributing

To contribute, just fork this project and then open a pull request, feel free to contribute, bring ideas and raise any problem in the issue tab.

License

xrun is released under the MIT license. See LICENSE for details.

Commit count: 134

cargo fmt