Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pending tests #38

Merged
merged 3 commits into from Jun 14, 2014
Merged

Add pending tests #38

merged 3 commits into from Jun 14, 2014

Conversation

bastos
Copy link
Contributor

@bastos bastos commented Jun 13, 2014

pending function ignores the block passed (Issue #16).

pending function ignores the block passed.
@@ -31,6 +31,10 @@
let example = Example(description, closure)
World.currentExampleGroup()!.appendExample(example)
}

class func pending(description: String, closure: () -> ()) {
NSLog("Pending: %@", description)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should import Foundation at the top of this file to prevent warnings when using NSLog.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Sorry, I will fix it.

@modocache
Copy link
Member

What this Pull Request Does

OK, I think this is a good start. Since all example groups are compiled at the very beginning, before any tests are actually run, these pending blocks print before the rest of the test output:

2014-06-14 10:28:38.338 xctest[22961:303] Pending: Pending Spec
2014-06-14 10:28:38.351 xctest[22961:303] Pending: contains an it block
Test Suite 'All tests' started at 2014-06-14 01:26:56 +0000
...

What Specta Does

Specta produces something like this, at the very end of the test output:

3 tests; 0 skipped; 1 failure; 1 exception; 1 pending

Furthermore, Specta pending examples are displayed in the test navigator. That's because they're registered as examples, just ones with nil closures. So they're reported to XCTest as test methods, but when it comes time to run them they don't do anything. And since they don't fail, they appear in the test navigator with green check marks.

Also, while Kiwi displays warnings in Xcode, Specta does not. In any case, it's probably impossible to display a warning in Swift at this point anyway (Swift doesn't support #pragma declarations).

What Quick Should Do

So my new set of goals for pending is:

  1. Report the example is pending to Quick's test reporter (see Support custom output formatters #9)
  2. Do not display the example in the test navigator (or, if possible, display it with a gray check mark)
  3. Do not print anything directly to stdout/stderr (such as by using println or NSLog)
  4. Do not highlight the pending line with a warning in Xcode (I want to, but I think it's impossible at this point)

This pull request is probably the best we can do on the 4 goals above until I implement custom output formatters as part of #9.

@bastos Thanks for the pull request! I had a few comments, but I'll merge as soon as you address those. Ping me @modocache once you're done or if you have any questions!

@bastos
Copy link
Contributor Author

bastos commented Jun 14, 2014

@modocache Done.

Yes, I agree with you, we need a better way to report pending tests, this implementation is very simple. Must be improved later.

About the #pragma, you are right, Swift doesn't have it and I couldn't find anything similar.

@modocache
Copy link
Member

Merged! Thanks, @bastos! 🌟

NachoSoto pushed a commit to NachoSoto/Quick that referenced this pull request Jul 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants