A few suggestions in writing tests

4 views
Skip to first unread message

Majid Laali

unread,
Mar 24, 2015, 3:23:41 PM3/24/15
to cleartk-d...@googlegroups.com
Hi, 

I have a few suggestions for writing tests in ClearTk. First, I suggest to adopt the given-when-then style to name tests. In this style, 'given' represent the current state of ClearTK, 'when' specifies the interaction with ClearTK, and finally 'then' indicate the expectation of running the test. For more information, please refer to this. As an example, consider the testMutualInformationFeatureSelection in MutualInformationTest class. The name of this test can be something like this: givenInstancesWhenOrderingFeatureBasedOnMutualInformationThenTheOrderOfFeaturesIsInDescending(), long name but more clear :)

Second, I like to suggest adding Mockito dependency to the maven file in the test scope. This tool mainly useful to create stub. For more information, please refer to this. I am not suggesting to use BDD instead of TDD, however, I believe the Mockito can make many tests easier to write.

Thanks, 
Majid

/*******************************************
 *   Majid Laali, Ph.D. Candidate, 
 *   Computer Science & Software Engineering Department
 *   Concordia University
*******************************************/

Philip Ogren

unread,
Apr 6, 2015, 11:50:16 PM4/6/15
to cleartk-d...@googlegroups.com
Hi Majid,

I am quite open to anything that improves our testing in ClearTK.  I know my own testing code could use a bit more imagination and/or infrastructure.  

If you haven't seen the FAQ on adding dependencies, then you should read the following:


Thanks,
Philip

--
You received this message because you are subscribed to the Google Groups "cleartk-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cleartk-develop...@googlegroups.com.
To post to this group, send email to cleartk-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/cleartk-developers.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages