Skip to content

Commit

Permalink
Merge pull request #4 from BinaryBirds/dev
Browse files Browse the repository at this point in the history
Version 1.1.1
  • Loading branch information
tib authored Mar 14, 2023
2 parents 4c1cd5e + 77fe6c3 commit 25aa799
Show file tree
Hide file tree
Showing 11 changed files with 1,308 additions and 1,328 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ In your project folder run:
* for JUNIT format: `swift test | testify junit`
* for MD format: `swift test | testify md`

If no argument or wrong argument added then output format fallbacks to JSON!

You can just use the [Swift Package Manager](https://theswiftdev.com/2017/11/09/swift-package-manager-tutorial/) as usual:

```swift
.package(url: "https://github.com/binarybirds/testify", from: "1.1.0"),
.package(url: "https://github.com/binarybirds/testify", from: "1.1.1"),
```

⚠️ Don't forget to add "Testify" to your target as a dependency!
Expand Down
24 changes: 5 additions & 19 deletions Sources/TestifySDK/Codable/TestResultMarkdownEncoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,19 @@ public struct TestResultMarkdownEncoder: TestResultEncoder {
let successCount = suite.cases.reduce(0) { $0 + ($1.outcome == .success ? 1 : 0) }
let failureCount = suite.cases.reduce(0) { $0 + ($1.outcome == .failure ? 1 : 0) }

result += "\(name): \(count) tests were completed in \(time) with \(successCount) passed, \(failureCount) failed and \(0) skipped.\n\n"
result += "| Test case | Passed | Failed | Skipped | Time |\n"
result += "| :--- | ---: | ---: | ---: | ---: |\n"
result += "\(name): \(count) tests were completed in \(time) with \(successCount) passed, \(failureCount) failed.\n\n"
result += "| Test case | Result | Time |\n"
result += "| :--- | ---: | ---: |\n"

for testCase in suite.cases {
let name = testCase.testName
let passed = testCase.outcome == .success ? "" : ""
let failed = testCase.outcome == .failure ? "" : ""
let skipped = "🔀"
let testResult = testCase.outcome == .success ? "" : ""
let time = "\(testCase.duration)s ⌛️"
result += "| \(name) | \(passed) | \(failed) | \(skipped) | \(time) |\n"
result += "| \(name) | \(testResult) | \(time) |\n"
}

}

return result
}
}

/*
| git status lorem ipsum dolor sit amet | git status | git status | 0 | 12.32s |
| git diff | git diff | git diff | 0 | 123.323s |
| git diff | git diff | git diff | 0 | 123.323s |
| git diff | git diff | git diff | 0 | 123.323s |
| [git diff](Sources/test/test.swift#L4) | git diff ✅ | git diff ❌ | 0 🔀 | 123.323s ⌛️ |
| git diff | git diff ✅ | git diff ❌ | 0 🔀 | 123.323s ⌛️ |
| git diff | git diff ✅ | git diff ❌ | 0 🔀 | 123.323s ⌛️ |
| git diff | git diff ✅ | git diff ❌ | 0 🔀 | 123.323s ⌛️ |
| git diff | git diff ✅ | git diff ❌ | 0 🔀 | 123.323s ⌛️ |
*/
8 changes: 2 additions & 6 deletions Sources/testify/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@ import TestifySDK

let args = CommandLine.arguments
var format: String = OutputFormat.json.rawValue
let msg = "Testify output format is"
if (args.count >= 2) {
if let enumCase = OutputFormat(rawValue: args[1]) {
format = enumCase.rawValue
print(msg, "'\(format)'")
} else {
print("Unknown Testify output format, the format is 'json' for now. Available formats: 'json', 'junit', 'md'")
fatalError("Error: Unknown output format. Available formats: 'json', 'junit', 'md'")
}
} else {
print(msg, "'json'")
}

var data: Data
Expand Down Expand Up @@ -50,5 +46,5 @@ case OutputFormat.md.rawValue:
print(mdData)

default:
print("Unknown output format")
fatalError("Error: Unknown output format")
}
1,556 changes: 778 additions & 778 deletions Tests/Assets/md/Alamofire.md

Large diffs are not rendered by default.

720 changes: 360 additions & 360 deletions Tests/Assets/md/Kitura.md

Large diffs are not rendered by default.

240 changes: 120 additions & 120 deletions Tests/Assets/md/PromiseFailure.md
Original file line number Diff line number Diff line change
@@ -1,120 +1,120 @@
ExecutionContextTests: 6 tests were completed in 18.541 with 6 passed, 0 failed and 0 skipped.

| Test case | Passed | Failed | Skipped | Time |
| :--- | ---: | ---: | ---: | ---: |
| testConcurrency || | 🔀 | 15.354s ⌛️ |
| testInvalidatableQueueSupportsNonMainQueues || | 🔀 | 0.002s ⌛️ |
| testInvalidatedInvalidatableQueue || | 🔀 | 0.102s ⌛️ |
| testNonInvalidatedInvalidatableQueue || | 🔀 | 0.007s ⌛️ |
| testTapContinuesToFireInvalidatableQueue || | 🔀 | 0.001s ⌛️ |
| testThreads || | 🔀 | 3.075s ⌛️ |

PromiseAllTests: 5 tests were completed in 0.271 with 5 passed, 0 failed and 0 skipped.

| Test case | Passed | Failed | Skipped | Time |
| :--- | ---: | ---: | ---: | ---: |
| testAll || | 🔀 | 0.108s ⌛️ |
| testAllWithEmptyArray || | 🔀 | 0.001s ⌛️ |
| testAllWithPreFulfilledValues || | 🔀 | 0.001s ⌛️ |
| testAllWithRejectionHappeningFirst || | 🔀 | 0.058s ⌛️ |
| testAllWithRejectionHappeningLast || | 🔀 | 0.103s ⌛️ |

PromiseAlwaysTests: 4 tests were completed in 1.024 with 4 passed, 0 failed and 0 skipped.

| Test case | Passed | Failed | Skipped | Time |
| :--- | ---: | ---: | ---: | ---: |
| testAlways || | 🔀 | 0.507s ⌛️ |
| testAlwaysInstantFulfill || | 🔀 | 0.001s ⌛️ |
| testAlwaysInstantReject || | 🔀 | 0.001s ⌛️ |
| testAlwaysRejects || | 🔀 | 0.515s ⌛️ |

PromiseDelayTests: 4 tests were completed in 0.9360000000000002 with 4 passed, 0 failed and 0 skipped.

| Test case | Passed | Failed | Skipped | Time |
| :--- | ---: | ---: | ---: | ---: |
| testDelay || | 🔀 | 0.202s ⌛️ |
| testTimeoutFunctionFails || | 🔀 | 0.519s ⌛️ |
| testTimeoutFunctionSucceeds || | 🔀 | 0.012s ⌛️ |
| testTimeoutPromise || | 🔀 | 0.203s ⌛️ |

PromiseEnsureTests: 3 tests were completed in 0.003 with 3 passed, 0 failed and 0 skipped.

| Test case | Passed | Failed | Skipped | Time |
| :--- | ---: | ---: | ---: | ---: |
| testEnsureOnlyCalledOnSucceess || | 🔀 | 0.001s ⌛️ |
| testEnsureRejects || | 🔀 | 0.001s ⌛️ |
| testEnsureSucceeds || | 🔀 | 0.001s ⌛️ |

PromiseKickoffTests: 3 tests were completed in 0.104 with 3 passed, 0 failed and 0 skipped.

| Test case | Passed | Failed | Skipped | Time |
| :--- | ---: | ---: | ---: | ---: |
| testFailingKickoff || | 🔀 | 0.001s ⌛️ |
| testKickoff || | 🔀 | 0.001s ⌛️ |
| testPromiseKickoff || | 🔀 | 0.102s ⌛️ |

PromiseRaceTests: 4 tests were completed in 0.111 with 4 passed, 0 failed and 0 skipped.

| Test case | Passed | Failed | Skipped | Time |
| :--- | ---: | ---: | ---: | ---: |
| testInstantReject || | 🔀 | 0.001s ⌛️ |
| testInstantResolve || | 🔀 | 0.001s ⌛️ |
| testRace || | 🔀 | 0.056s ⌛️ |
| testRaceFailure || | 🔀 | 0.053s ⌛️ |

PromiseRecoverTests: 6 tests were completed in 0.423 with 6 passed, 0 failed and 0 skipped.

| Test case | Passed | Failed | Skipped | Time |
| :--- | ---: | ---: | ---: | ---: |
| testIgnoreRecover || | 🔀 | 0.107s ⌛️ |
| testIgnoreRecoverInstant || | 🔀 | 0.001s ⌛️ |
| testRecover || | 🔀 | 0.105s ⌛️ |
| testRecoverInstant || | 🔀 | 0.001s ⌛️ |
| testRecoverWithThrowingFunction || | 🔀 | 0.106s ⌛️ |
| testRecoverWithThrowingFunctionError || | 🔀 | 0.103s ⌛️ |

PromiseRetryTests: 3 tests were completed in 0.005 with 3 passed, 0 failed and 0 skipped.

| Test case | Passed | Failed | Skipped | Time |
| :--- | ---: | ---: | ---: | ---: |
| testRetry || | 🔀 | 0.002s ⌛️ |
| testRetryWithInstantSuccess || | 🔀 | 0.001s ⌛️ |
| testRetryWithNeverSuccess || | 🔀 | 0.002s ⌛️ |

PromiseTests: 17 tests were completed in 0.503 with 16 passed, 1 failed and 0 skipped.

| Test case | Passed | Failed | Skipped | Time |
| :--- | ---: | ---: | ---: | ---: |
| testAsync || | 🔀 | 0.056s ⌛️ |
| testAsyncRejection || | 🔀 | 0.052s ⌛️ |
| testAsyncThrowing || | 🔀 | 0.002s ⌛️ |
| testDoubleReject || | 🔀 | 0.001s ⌛️ |
| testDoubleResolve || | 🔀 | 0.001s ⌛️ |
| testFlatMap || | 🔀 | 0.108s ⌛️ |
| testFulfilled || | 🔀 | 0.053s ⌛️ |
| testMap || | 🔀 | 0.001s ⌛️ |
| testPending || | 🔀 | 0.001s ⌛️ |
| testRejected || | 🔀 | 0.001s ⌛️ |
| testRejectedAfterFulfilled || | 🔀 | 0.051s ⌛️ |
| testRejectThenResolve || | 🔀 | 0.001s ⌛️ |
| testResolveThenReject || | 🔀 | 0.001s ⌛️ |
| testThen || | 🔀 | 0.001s ⌛️ |
| testThenWhenPending || | 🔀 | 0.054s ⌛️ |
| testTrailingClosuresCompile || | 🔀 | 0.107s ⌛️ |
| testZalgoContained | || 🔀 | 0.012s ⌛️ |

PromiseThrowsTests: 4 tests were completed in 0.004 with 4 passed, 0 failed and 0 skipped.

| Test case | Passed | Failed | Skipped | Time |
| :--- | ---: | ---: | ---: | ---: |
| testThrowsInFlatmapping || | 🔀 | 0.001s ⌛️ |
| testThrowsInFlatmappingWithError || | 🔀 | 0.001s ⌛️ |
| testThrowsInMapping || | 🔀 | 0.001s ⌛️ |
| testThrowsInMappingWithError || | 🔀 | 0.001s ⌛️ |

PromiseZipTests: 2 tests were completed in 0.007 with 2 passed, 0 failed and 0 skipped.

| Test case | Passed | Failed | Skipped | Time |
| :--- | ---: | ---: | ---: | ---: |
| testMultipleParameters || | 🔀 | 0.001s ⌛️ |
| testZipping2 || | 🔀 | 0.006s ⌛️ |
ExecutionContextTests: 6 tests were completed in 18.541 with 6 passed, 0 failed.

| Test case | Result | Time |
| :--- | ---: | ---: |
| testConcurrency ||15.354s ⌛️ |
| testInvalidatableQueueSupportsNonMainQueues ||0.002s ⌛️ |
| testInvalidatedInvalidatableQueue ||0.102s ⌛️ |
| testNonInvalidatedInvalidatableQueue ||0.007s ⌛️ |
| testTapContinuesToFireInvalidatableQueue ||0.001s ⌛️ |
| testThreads ||3.075s ⌛️ |

PromiseAllTests: 5 tests were completed in 0.271 with 5 passed, 0 failed.

| Test case | Result | Time |
| :--- | ---: | ---: |
| testAll ||0.108s ⌛️ |
| testAllWithEmptyArray ||0.001s ⌛️ |
| testAllWithPreFulfilledValues ||0.001s ⌛️ |
| testAllWithRejectionHappeningFirst ||0.058s ⌛️ |
| testAllWithRejectionHappeningLast ||0.103s ⌛️ |

PromiseAlwaysTests: 4 tests were completed in 1.024 with 4 passed, 0 failed.

| Test case | Result | Time |
| :--- | ---: | ---: |
| testAlways ||0.507s ⌛️ |
| testAlwaysInstantFulfill ||0.001s ⌛️ |
| testAlwaysInstantReject ||0.001s ⌛️ |
| testAlwaysRejects ||0.515s ⌛️ |

PromiseDelayTests: 4 tests were completed in 0.9360000000000002 with 4 passed, 0 failed.

| Test case | Result | Time |
| :--- | ---: | ---: |
| testDelay ||0.202s ⌛️ |
| testTimeoutFunctionFails ||0.519s ⌛️ |
| testTimeoutFunctionSucceeds ||0.012s ⌛️ |
| testTimeoutPromise ||0.203s ⌛️ |

PromiseEnsureTests: 3 tests were completed in 0.003 with 3 passed, 0 failed.

| Test case | Result | Time |
| :--- | ---: | ---: |
| testEnsureOnlyCalledOnSucceess ||0.001s ⌛️ |
| testEnsureRejects ||0.001s ⌛️ |
| testEnsureSucceeds ||0.001s ⌛️ |

PromiseKickoffTests: 3 tests were completed in 0.104 with 3 passed, 0 failed.

| Test case | Result | Time |
| :--- | ---: | ---: |
| testFailingKickoff ||0.001s ⌛️ |
| testKickoff ||0.001s ⌛️ |
| testPromiseKickoff ||0.102s ⌛️ |

PromiseRaceTests: 4 tests were completed in 0.111 with 4 passed, 0 failed.

| Test case | Result | Time |
| :--- | ---: | ---: |
| testInstantReject ||0.001s ⌛️ |
| testInstantResolve ||0.001s ⌛️ |
| testRace ||0.056s ⌛️ |
| testRaceFailure ||0.053s ⌛️ |

PromiseRecoverTests: 6 tests were completed in 0.423 with 6 passed, 0 failed.

| Test case | Result | Time |
| :--- | ---: | ---: |
| testIgnoreRecover ||0.107s ⌛️ |
| testIgnoreRecoverInstant ||0.001s ⌛️ |
| testRecover ||0.105s ⌛️ |
| testRecoverInstant ||0.001s ⌛️ |
| testRecoverWithThrowingFunction ||0.106s ⌛️ |
| testRecoverWithThrowingFunctionError ||0.103s ⌛️ |

PromiseRetryTests: 3 tests were completed in 0.005 with 3 passed, 0 failed.

| Test case | Result | Time |
| :--- | ---: | ---: |
| testRetry ||0.002s ⌛️ |
| testRetryWithInstantSuccess ||0.001s ⌛️ |
| testRetryWithNeverSuccess ||0.002s ⌛️ |

PromiseTests: 17 tests were completed in 0.503 with 16 passed, 1 failed.

| Test case | Result | Time |
| :--- | ---: | ---: |
| testAsync ||0.056s ⌛️ |
| testAsyncRejection ||0.052s ⌛️ |
| testAsyncThrowing ||0.002s ⌛️ |
| testDoubleReject ||0.001s ⌛️ |
| testDoubleResolve ||0.001s ⌛️ |
| testFlatMap ||0.108s ⌛️ |
| testFulfilled ||0.053s ⌛️ |
| testMap ||0.001s ⌛️ |
| testPending ||0.001s ⌛️ |
| testRejected ||0.001s ⌛️ |
| testRejectedAfterFulfilled ||0.051s ⌛️ |
| testRejectThenResolve ||0.001s ⌛️ |
| testResolveThenReject ||0.001s ⌛️ |
| testThen ||0.001s ⌛️ |
| testThenWhenPending ||0.054s ⌛️ |
| testTrailingClosuresCompile ||0.107s ⌛️ |
| testZalgoContained | | 0.012s ⌛️ |

PromiseThrowsTests: 4 tests were completed in 0.004 with 4 passed, 0 failed.

| Test case | Result | Time |
| :--- | ---: | ---: |
| testThrowsInFlatmapping ||0.001s ⌛️ |
| testThrowsInFlatmappingWithError ||0.001s ⌛️ |
| testThrowsInMapping ||0.001s ⌛️ |
| testThrowsInMappingWithError ||0.001s ⌛️ |

PromiseZipTests: 2 tests were completed in 0.007 with 2 passed, 0 failed.

| Test case | Result | Time |
| :--- | ---: | ---: |
| testMultipleParameters ||0.001s ⌛️ |
| testZipping2 ||0.006s ⌛️ |
8 changes: 4 additions & 4 deletions Tests/Assets/md/PromiseUnexpectedFailure.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PromiseTests: 1 tests were completed in 0.021 with 0 passed, 1 failed and 0 skipped.
PromiseTests: 1 tests were completed in 0.021 with 0 passed, 1 failed.

| Test case | Passed | Failed | Skipped | Time |
| :--- | ---: | ---: | ---: | ---: |
| testUnexpected | || 🔀 | 0.021s ⌛️ |
| Test case | Result | Time |
| :--- | ---: | ---: |
| testUnexpected | | 0.021s ⌛️ |
18 changes: 9 additions & 9 deletions Tests/Assets/md/Shell.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
ShellTests: 6 tests were completed in 2.497 with 6 passed, 0 failed and 0 skipped.
ShellTests: 6 tests were completed in 2.497 with 6 passed, 0 failed.

| Test case | Passed | Failed | Skipped | Time |
| :--- | ---: | ---: | ---: | ---: |
| testAsyncRun || | 🔀 | 2.172s ⌛️ |
| testEnvironment || | 🔀 | 0.065s ⌛️ |
| testError || | 🔀 | 0.065s ⌛️ |
| testErrorHandler || | 🔀 | 0.066s ⌛️ |
| testOutput || | 🔀 | 0.065s ⌛️ |
| testOutputHandler || | 🔀 | 0.064s ⌛️ |
| Test case | Result | Time |
| :--- | ---: | ---: |
| testAsyncRun ||2.172s ⌛️ |
| testEnvironment ||0.065s ⌛️ |
| testError ||0.065s ⌛️ |
| testErrorHandler ||0.066s ⌛️ |
| testOutput ||0.065s ⌛️ |
| testOutputHandler ||0.064s ⌛️ |
20 changes: 10 additions & 10 deletions Tests/Assets/md/ShellFailure.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
ShellTests: 7 tests were completed in 2.532 with 4 passed, 3 failed and 0 skipped.
ShellTests: 7 tests were completed in 2.532 with 4 passed, 3 failed.

| Test case | Passed | Failed | Skipped | Time |
| :--- | ---: | ---: | ---: | ---: |
| testAsyncRun || | 🔀 | 2.143s ⌛️ |
| testEnvironment | || 🔀 | 0.067s ⌛️ |
| testError || | 🔀 | 0.064s ⌛️ |
| testErrorHandler || | 🔀 | 0.064s ⌛️ |
| testOutput | || 🔀 | 0.064s ⌛️ |
| testOutputHandler || | 🔀 | 0.064s ⌛️ |
| testThrow | || 🔀 | 0.066s ⌛️ |
| Test case | Result | Time |
| :--- | ---: | ---: |
| testAsyncRun ||2.143s ⌛️ |
| testEnvironment | | 0.067s ⌛️ |
| testError ||0.064s ⌛️ |
| testErrorHandler ||0.064s ⌛️ |
| testOutput | | 0.064s ⌛️ |
| testOutputHandler ||0.064s ⌛️ |
| testThrow | | 0.066s ⌛️ |
Loading

0 comments on commit 25aa799

Please sign in to comment.