angeloskath/php-nlp-tools

Too many Assertions In Unit Tests

yooper opened this issue · 2 comments

I just finished running the test suite on master branch.

OK, but incomplete or skipped tests!
Tests: 31, Assertions: 23664, Skipped: 1.

There are too many assertions in the unit tests. Please do no put assertions inside of loops. This makes it harder to determine what the unit test is actually testing. If you want to count the correct number of items were returned, just test that.

The assertion inside the loop which accounts for the 23531 of those assertions is for the PorterStemmer for which I simply run the whole test as uploaded by Martin Porter at http://tartarus.org/~martin/PorterStemmer/ .

The loop is not used to count the number of items that were returned (I don't know how I would do that with a loop :-) ), it is used to assert that the correct items were returned. It is simply a more elaborate test than the one you have for the LancasterStemmer.

Is the PorterStemmerTest hard to understand? Is there any other reason why I should not run a test with thousands of assertions?

Now I understand why there are so many assertions. To me, it is a
preference issue. Thank you for the explanation. You can close this issue.

On Tue, Aug 27, 2013 at 10:50 AM, Angelos Katharopoulos <
notifications@github.com> wrote:

The assertion inside the loop which accounts for the 23531 of those
assertions is for the PorterStemmer for which I simply run the whole test
as uploaded by Martin Porter at http://tartarus.org/~martin/PorterStemmer/.

The loop is not used to count the number of items that were returned (I
don't know how I would do that with a loop :-) ), it is used to assert that
the correct items were returned. It is simply a more elaborate test than
the one you have for the LancasterStemmer.

Is the PorterStemmerTest hard to understand? Is there any other reason why
I should not run a test with thousands of assertions?


Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-23342462
.