Risky Tests

I came across a feature of PHPUnit that might be helpful to include in the Crystal spec runner. The concept of risky tests.

I wanted to gather some feedback on if this would be something that should be added to the standard library, or would be better suited to a shard, like ameba.

The main concept of it, would be test cases that do not have any assertions, i.e. an it block with no should or should_not matchers.


Finished in 16.23 milliseconds
3 examples, 0 failures, 0 errors, 0 pending, 1 risky

Running crystal spec with such a test, could result in something like that. The spec itself would not fail, but would be designated with a R to indicate it as risky.

1 Like

If you have a simple way to detect that a test has no assertions then I see it as something good. But how do you implement it?

Dunno yet, didn’t get that far.

I’ll see if I can come up with something.

It is probably quite late to answer but I will try. It is possible to do if for each test that created you have a table record where it marks if assertions were called. If flag is not set then it can be marked as Risky. It should use a macro to pickup the test method name to use for matching.