-
-
Notifications
You must be signed in to change notification settings - Fork 906
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
Pending Example Impovement #491
Conversation
@modocache, if you have spare time, it would be helpful that you review this! 👍 |
} | ||
|
||
func testBeforeEachDoesNotRunForContextsWithOnlyPendingExamples() { | ||
onlyPendingExamplesBeforeEachExecutedCount = 0 | ||
|
||
qck_runSpec(FunctionalTests_PendingSpec.self) | ||
XCTAssertEqual(onlyPendingExamplesBeforeEachExecutedCount, 0) | ||
XCTAssertEqual(onlyPendingExamplesBeforeEachExecutedCount, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assertion no longer matches the name of the test. The test is named "test that beforeEach
does not run for context
s with only pending
examples", whereas this assertion verifies that beforeEach
does run. The same goes for testBeforeEachOnlyRunForEnabledExamples
above.
So, why do these tests exist? pending
examples were first implemented in #38. At that time, Quick had an ad hoc test suite: a single test file that used Quick and was expected to pass. I added in-depth tests in #154, which included tests for pending
in 6b7681b. Unfortunately, I neglected to realize the importance of documenting in the commit message whether beforeEach
not running was intended, or merely the behavior at the time that I wrote these tests.
I think these tests merely documented the behavior of pending
at the time. It seems like the purpose of this PR is to ensure that beforeEach
, afterEach
, beforeSuite
, and afterSuite
always run, even for pending
examples. If that's the case, please:
- Delete the
testBeforeEachOnlyRunForEnabledExamples
andtestBeforeEachDoesNotRunForContextsWithOnlyPendingExamples
tests. - Add tests for
beforeEach
,afterEach
,beforeSuite
, andafterSuite
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated test(add tests for beforeEach
, afterEach
, beforeSuite
, and afterSuite
) and create new target.
See also, #491 (comment) 😄
@takecian This is awesome!! Thanks for working on this, and sorry for the wait in reviewing. |
Sources/Quick/DSL/World+DSL.swift
Outdated
} | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit-pick: Remove this extra whitespace.
This looks great! I think the tests need some additional work, though. Thanks, @takecian! |
Thank you for review! I'll fix it! |
Hi @modocache , I've updated comment and added test for pending. Thanks! |
beforeEach { isBeforeEachCalled = true } | ||
pending("an example that will not run") {} | ||
afterEach { isAfterEachCalled = true } | ||
afterSuite { isAfterSuiteCalled = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, this is almost what we want. However, the beforeSuite
and afterSuite
tests here will pass even without your changes. This is because this test suite contains non-pending examples. To really test these, you'd need an entirely new test target in the Quick workspace -- just like the QuickFunctionalTests target.
I think we should test this in a new QuickPendingTests target.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! I understand. I will create new test target and move this test into it.
…ases into QuickPendingTests.
I've created new test target for "pending" and merged master branch. |
Looking good! There are build failures on Linux, though. I think you'll need to use |
|
||
Mock makes us easy to verify behavior which works with other objects. | ||
|
||
For more details about writing test, see https://realm.io/news/testing-in-swift/ . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am planning on reviewing this additional documentation in #487, but I don't think you meant to include it in this pull request. Could you take it out?
I did,
However build error on linux still occcurs. I will work for it. |
@modocache , I've fixed errors on linux. |
@modocache: Do you have time to review this? |
@modocache: Re-pinging, just in case the notification or email got lost. 👍 |
Didn't get lost, but it's a lot to review! 😅 I'll need to find some time to read through it. Hopefully sometime this week. |
Okay, no problem. Didn't know if you had seen it or not. 😸 I'll assign the PR to you? |
Bringing attention back to this. Could we get the merge conflicts fixed @takecian and have it reviewed @modocache. Cheers! :) |
@takecian: Please fix the merge conflicts so we can finish reviewing your changes. |
Closing as this is stale/abandoned. |
This PR is related to #490 .
please review, thanks.
Takeshi.