Open bitsmakerde opened 1 year ago
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.
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 😉
@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:
XCTFail("Empty test, please add code to your test")
Thank you