angeloskath / php-nlp-tools

Natural Language Processing Tools in PHP
Do What The F*ck You Want To Public License
745 stars 152 forks source link

Too many Assertions In Unit Tests #7

Closed yooper closed 11 years ago

yooper commented 11 years ago

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.

angeloskath commented 11 years ago

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?

yooper commented 11 years ago

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/angeloskath/php-nlp-tools/issues/7#issuecomment-23342462 .