bashunit icon indicating copy to clipboard operation
bashunit copied to clipboard

A test with no assertions should fail?

Open khru opened this issue 2 years ago • 5 comments

Add a configuration that allow the user to say if a test has no assertions should fail.

image

khru avatar Sep 25 '23 16:09 khru

What about not fail but raise a note saying "no assertions found in this test"?

Actually, for the first iteration, we can simply go with the failing option, and revisit/improve if needed later.

Chemaclass avatar Sep 25 '23 16:09 Chemaclass

To me it should be a configuration, while doing TDD I would never want a test that does not assert anything, and we are nor offering any code coverage metric, so for me a test with no assertion should be by default a test that fails, unless you can tell me a case in which this could be a problem

What about not fail but raise a note saying "no assertions found in this test"?

Actually, for the first iteration, we can simply go with the failing option, and revisit/improve if needed later.

khru avatar Sep 25 '23 16:09 khru

What does phpunit/jest?

antonio-gg-dev avatar Sep 25 '23 17:09 antonio-gg-dev

Some fail, some don't

khru avatar Sep 25 '23 18:09 khru

I found this reading phpunit docs:

https://docs.phpunit.de/en/10.3/writing-tests-for-phpunit.html#incomplete-tests

imagen

antonio-gg-dev avatar Oct 07 '23 08:10 antonio-gg-dev