-
Notifications
You must be signed in to change notification settings - Fork 34
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
Alsatian should warn when a test has no Expects executed #455
Comments
This would be difficult with the current architecture, I think. It works currently by throwing an exception on failure. We could potentially achieve this by using an emitter pattern rather than relying on exceptions, but then we might lose stack traces... |
I do agree that it would be a useful feature, though, and something we should look to implement. |
From what I can tell, Also, I am working on a fluent Expect API for Alsatian, and will look at incorporating this, there. Certain parts of the API already safeguard against incomplete assertions at compile time. For instance, when asserting on object properties: Expect(sthg).with.properties({
Prop0: actual => Expect(actual),
Prop1: actual => Expect(actual).to,
Prop2: actual => Expect(actual).to.equal(3)
}); Prop0 and Prop1 above will not compile, because However, outside of |
Great suggestion!!! I think this could tie in with allowing a test to fail multiple times #225 To enable that we'd need to know whether any expect calls failed, perhaps via metadata? As a result we should be able to get this in as well :) |
With regards to empty expects raised by @cdibbs we should hopefully be able to detect that too if we collect the data about the expects run on that test |
This could be solved in a similar fashion to my solution on #458 Proof Of Concept:
Output:
|
Alsatian should warn when a test has no Expects executed.
In my code I have a lots of tests and I found test that werent executed. For example:
The asyn test has no returns, so, the Expects are not executed. Alsatian should WARN when a test has no Expects (like other test runners), in this way those typing misstakes could be easily solved.
The text was updated successfully, but these errors were encountered: