All Projects → SwiftDocOrg → TAP

SwiftDocOrg / TAP

Licence: other
A Swift package for the Test Anything Protocol (v13)

Programming Languages

swift
15916 projects

Labels

Projects that are alternatives of or similar to TAP

react-fastclick
A react component that triggers click events for taps (short localized touches)
Stars: ✭ 20 (-4.76%)
Mutual labels:  tap
zx tape player
Just another tape player has been written in Flutter for iOS and Android. The application is able to find tapes and theirs images using https://zxInfo.dk public API and upload them to ZX-Spectrum compatible computers by the audio output of the smartphone. Now it supports TAP and TZX tape images only.
Stars: ✭ 26 (+23.81%)
Mutual labels:  tap
txm
Markdown code example tester; language-agnostic
Stars: ✭ 19 (-9.52%)
Mutual labels:  tap
homebrew-mopidy
Homebrew formulas for Mopidy and Mopidy extensions
Stars: ✭ 21 (+0%)
Mutual labels:  tap
pytest-tap
Test Anything Protocol (TAP) reporting plugin for pytest
Stars: ✭ 34 (+61.9%)
Mutual labels:  tap
net-protocol
golang模拟内核协议栈 实现链路层、网络层、传输层、应用层 用户态协议栈 ,基于虚拟网卡TUN/TAP
Stars: ✭ 129 (+514.29%)
Mutual labels:  tap
homebrew-ecmascript
Homebrew formulae for ECMAScript engines
Stars: ✭ 13 (-38.1%)
Mutual labels:  tap
unitest
🌎 Seamless node and browser unit testing with code coverage
Stars: ✭ 28 (+33.33%)
Mutual labels:  tap
homebrew-portable-ruby
🚗 Versions of Ruby that can be installed and run from anywhere on the filesystem.
Stars: ✭ 96 (+357.14%)
Mutual labels:  tap
cxx-tap
Test Anything Protocol (TAP) Producer for C++
Stars: ✭ 22 (+4.76%)
Mutual labels:  tap
homebrew-srm
Homebrew tap for srm since Apple and Homebrew decided nobody had mechanical disks anymore.
Stars: ✭ 14 (-33.33%)
Mutual labels:  tap
gtest-tap-listener
GoogleTest TAP Listener
Stars: ✭ 70 (+233.33%)
Mutual labels:  tap
use-double-tap
React hook for handling double tap on mobile devices
Stars: ✭ 18 (-14.29%)
Mutual labels:  tap
rspec-tap-formatters
TAP Producer for RSpec-3
Stars: ✭ 20 (-4.76%)
Mutual labels:  tap
puppet-homebrew
homebrew (+brewcask! +taps!) package installer and provider
Stars: ✭ 17 (-19.05%)
Mutual labels:  tap
google-one-tap
Google One Tap Login
Stars: ✭ 37 (+76.19%)
Mutual labels:  tap
YouP3
Android app for downloading media from YouTube with 4K Support (Beta)
Stars: ✭ 51 (+142.86%)
Mutual labels:  tap
profext
👣 Profile Extension - A profile 🔎 search engine for accessing my all social media profile in one tap.👨‍💻👩‍. This chrome extension let's you track your profiles on any account in a single click.
Stars: ✭ 43 (+104.76%)
Mutual labels:  tap
tap-html
📊 an html tap reporter
Stars: ✭ 17 (-19.05%)
Mutual labels:  tap
TAP-Rust
Emit test results using Rust and the Test Anything Protocol (TAP)
Stars: ✭ 40 (+90.48%)
Mutual labels:  tap

TAP

A Swift package for the Test Anything Protocol (v13).

Requirements

  • Swift 5.3+

Usage

You can use TAP as an alternative to XCTest in executable targets or as a custom reporter in test targets.

Running Tests Directly

import TAP

try TAP.run([
    test(1 + 1 == 2), // passes
    test(true == false) // fails
])
// Prints:
/*
TAP version 13
1..2
ok 1
not ok 2
  ---
  file: path/to/File.swift
  line: 5
  ...
  
*/

Custom Test Reporting

Linux

Swift Package Manager on Linux uses swift-corelibs-xctest, which provides an XCTMain that

Run the following command on macOS to (re)-generate your main test file:

$ swift test --generate-linuxmain

Open the resulting LinuxMain.swift file, add an import statement for the TAP module and register XCTestTAPObserver as a test observer. In Swift 5.4 and later, you can update the XCTMain invocation to include an observers parameter with an instance of XCTestTAPObserver.

#if os(Linux)
import XCTest
import TAP
@testable import TAPTests

#if swift(>=5.4)
XCTMain([
    testCase(TAPTests.allTests)
],
arguments: CommandLine.arguments,
observers: [
    XCTestTAPObserver()
])
#else
XCTestObservationCenter.shared.addTestObserver(XCTestTAPObserver())
XCTMain([
    testCase(TAPTests.allTests)
])
#endif

When you run the swift test command, your test suite will be reported in TAP format.

macOS and iOS

As of Swift 5.3, it's not possible to configure a custom reporter when running tests directly through Swift Package Manager. However, Xcode provides a mechanism for loading custom reports via XCTestObservationCenter.

Create a new file named TestObservation.swift and add it to your test bundle. Import the TAP module, declare a subclass of NSObject named TestObservation, and override its designated initializer to register XCTestTAPObserver with the shared XCTestObservationCenter.

import TAP

final class TestObservation: NSObject {
    override init() {
        XCTestObservationCenter.shared.addTestObserver(XCTestTAPObserver())
    }
}

Add an entry to your test target's Info.plist file designating the fully-qualified name of this class as the NSPrincipalClass.

    <key>NSPrincipalClass</key>
    <string>YourTestTarget.TestObservation</string>

When you run your test bundle, Xcode will instantiate the principle class first, ensuring that your test observers are registered in time to report the progress of all test runs.

Installation

Swift Package Manager

Add the TAP package to your target dependencies in Package.swift:

import PackageDescription

let package = Package(
  name: "YourProject",
  dependencies: [
    .package(
        url: "https://github.com/SwiftDocOrg/TAP",
        from: "0.2.0"
    ),
  ]
)

Add TAP as a dependency to your test target(s):

targets: [
.testTarget(
    name: "YourTestTarget",
    dependencies: ["TAP"]),

License

MIT

Contact

Mattt (@mattt)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].