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

Code suggestion should fail without changes #58

Open
bitsmakerde opened this issue Dec 27, 2022 · 2 comments
Open

Code suggestion should fail without changes #58

bitsmakerde opened this issue Dec 27, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@bitsmakerde
Copy link
Contributor

@Tyler-Keith-Thompson I think it can be good behavior if an empty Given, When, Then should be failed. At the moment I write an empty test and its not fail.

I think in TDD should a empty test fail.

Here some possible solutions:

  1. in the code suggestion is automatic an placeholder code like this
    XCTFail("Empty test, please add code to your test")
  2. The Framework search for empty test an create a failure
  3. The Framework throw only a warning that the test is empty, but here the TDD is not complete fulfill.

Thank you

@Tyler-Keith-Thompson
Copy link
Owner

Tyler-Keith-Thompson commented Dec 27, 2022

So for the generated step stubs I can totally add an XCTFail, that seems like a great addition.

I'm hesitant to do more for a couple reasons. The first is that Gherkin is first and foremost meant to be a human readable specification. That means that there are times when people write Gherkin for context, but don't expect any code to execute. This has been discussed before and there are times (especially with a Given step) where it's really just about giving context to the reader.

Okay, getting past all that for a minute, it's impractical to detect whether a closure contains any executable instructions. The best I could conceive of it to use swift-syntax to try and parse the Swift code at the call site and determine it that way. That'd add dependencies and overhead that we realistically just don't want.

@Tyler-Keith-Thompson Tyler-Keith-Thompson added the enhancement New feature or request label Dec 27, 2022
@bitsmakerde
Copy link
Contributor Author

Ok I understand. Perhaps it make only sense to add this check or Stub to the Then. Because here should be a Assert or something. Without this it's only a test which is testing nothing 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants