I currently unit test using VTK&#39;s testing capabilities. Been doing if for many years.<br><br>People can certainly try something like GTest.<br><br><br><div class="gmail_quote">On Wed, Oct 3, 2012 at 12:10 PM, Aashish Chaudhary <span dir="ltr">&lt;<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If we want to use a unit test library, I would recommend googletest (I<br>
have some testing with it and found it better compare to cppunit). Its<br>
BSD license and I think other folks at Kitware are using gtest<br>
(correct me if I am wrong).<br>
<br>
For some of the comparisons, read here:<br>
<a href="http://stackoverflow.com/questions/7922289/googletest-vs-cppunit-the-facts" target="_blank">http://stackoverflow.com/questions/7922289/googletest-vs-cppunit-the-facts</a><br>
<br>
and here:<br>
<a href="http://stackoverflow.com/questions/242926/comparison-of-c-unit-test-frameworks" target="_blank">http://stackoverflow.com/questions/242926/comparison-of-c-unit-test-frameworks</a><br>
<br>
Best,<br>
<br>
<br>
On Wed, Oct 3, 2012 at 11:31 AM, Nikhil Shetty<br>
<div class="HOEnZb"><div class="h5">&lt;<a href="mailto:nikhil.shetty@kitware.com">nikhil.shetty@kitware.com</a>&gt; wrote:<br>
&gt; +1<br>
&gt;<br>
&gt; On Wed, Oct 3, 2012 at 10:41 AM, David Cole &lt;<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; On Wed, Oct 3, 2012 at 8:35 AM, Nikhil Shetty &lt;<a href="mailto:nikhil.shetty@kitware.com">nikhil.shetty@kitware.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt; &gt; Hi Bill,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Are you planning to bring in some type of Unit Testing into VTK?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Currently each tests in VTK tests a bunch of different classes spread<br>
&gt;&gt; &gt; across<br>
&gt;&gt; &gt; different modules. An obvious disadvantage is that some parts of the<br>
&gt;&gt; &gt; code<br>
&gt;&gt; &gt; keeps getting tested multiple times which is sort of pointless (in terms<br>
&gt;&gt; &gt; of<br>
&gt;&gt; &gt; testing). With unit testing one could just focus on one class at at<br>
&gt;&gt; &gt; time.<br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt; +1 for unit tests...<br>
&gt;&gt;<br>
&gt;&gt; BUT:<br>
&gt;&gt; testing multiple times is not pointless -- there are limitless<br>
&gt;&gt; possibilities of &quot;combinations of stuff&quot; -- and only with certain<br>
&gt;&gt; combinations will you find some problem cases.<br>
&gt;&gt;<br>
&gt;&gt; Testing as much as you have resources for (but no more) is ALWAYS a good<br>
&gt;&gt; idea.<br>
&gt;&gt;<br>
&gt;&gt; Both are useful.<br>
&gt;&gt;<br>
&gt;<br>
&gt; Definitely Agree.<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; &gt; Also a unit testing approach may be good for focused coverage where one<br>
&gt;&gt; &gt; is<br>
&gt;&gt; &gt; focused on improving coverage on a limited set of classes.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; There are many unit test frameworks out there. CppUnit seem to a good<br>
&gt;&gt; &gt; one.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; -Nikihl<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Tue, Sep 18, 2012 at 5:43 PM, Bill Lorensen &lt;<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt;<br>
&gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; My main concern is that vtk coverage is very low, and unacceptable.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; I would rather spend time on improving the coverage. If others want to<br>
&gt;&gt; &gt;&gt; improve the process, that is great. Past experience shows that too much<br>
&gt;&gt; &gt;&gt; time<br>
&gt;&gt; &gt;&gt; is spent on testing process and too little on actual testing.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; I say go for it, but I will concentrate in test coverage.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Bill<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; On Tue, Sep 18, 2012 at 5:34 PM, David Doria &lt;<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; On Tue, Sep 18, 2012 at 4:23 PM, Bill Lorensen<br>
&gt;&gt; &gt;&gt;&gt; &lt;<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt;&gt; &gt; Folks,<br>
&gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt; I mentioned earlier that my Fall/Winter VTK project is improving<br>
&gt;&gt; &gt;&gt;&gt; &gt; code<br>
&gt;&gt; &gt;&gt;&gt; &gt; coverage.<br>
&gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt; I&#39;m starting with some low hanging fruit, namely Common/Core which<br>
&gt;&gt; &gt;&gt;&gt; &gt; has<br>
&gt;&gt; &gt;&gt;&gt; &gt; 19<br>
&gt;&gt; &gt;&gt;&gt; &gt; files flagged by cdash as low coverage:<br>
&gt;&gt; &gt;&gt;&gt; &gt; <a href="http://open.cdash.org/viewCoverage.php?buildid=2568829" target="_blank">http://open.cdash.org/viewCoverage.php?buildid=2568829</a><br>
&gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt; For example I just pushed this topic to gerrit that addresses<br>
&gt;&gt; &gt;&gt;&gt; &gt; testing<br>
&gt;&gt; &gt;&gt;&gt; &gt; for<br>
&gt;&gt; &gt;&gt;&gt; &gt; vtkTimePointUtilities, a class that has 0 coverage. I&#39;m pretty sure<br>
&gt;&gt; &gt;&gt;&gt; &gt; there<br>
&gt;&gt; &gt;&gt;&gt; &gt; are bugs in this code, mainly surrounding boundary conditions that<br>
&gt;&gt; &gt;&gt;&gt; &gt; would not<br>
&gt;&gt; &gt;&gt;&gt; &gt; affect its usage, whatever that may be.<br>
&gt;&gt; &gt;&gt;&gt; &gt; <a href="http://review.source.kitware.com/#/t/1295/" target="_blank">http://review.source.kitware.com/#/t/1295/</a><br>
&gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt; But rather than rant, I&#39;ll ask the community to review the gerrit<br>
&gt;&gt; &gt;&gt;&gt; &gt; topics.<br>
&gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt; Bill<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; This sounds like a great project.<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; If you are going to be adding tons of tests, can we discuss a<br>
&gt;&gt; &gt;&gt;&gt; standardized format for them? The current method of putting everything<br>
&gt;&gt; &gt;&gt;&gt; in Test[TestName]() seems very error prone (accidental use of<br>
&gt;&gt; &gt;&gt;&gt; previously defined variables, name clashes, etc) and is definitely<br>
&gt;&gt; &gt;&gt;&gt; hard to read. I have pushed a new patch set that breaks some things<br>
&gt;&gt; &gt;&gt;&gt; out into functions. Is there any problem with doing it like this? It<br>
&gt;&gt; &gt;&gt;&gt; seems much more readable to me. In this case these functions are all<br>
&gt;&gt; &gt;&gt;&gt; void (because the content doesn&#39;t get checked for failure anyway), but<br>
&gt;&gt; &gt;&gt;&gt; of course they could return &#39;int&#39; so that &#39;return EXIT_SUCCESS&#39; could<br>
&gt;&gt; &gt;&gt;&gt; be ANDed with the other tests to produce the final test return value.<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; Thoughts?<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; David<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; --<br>
&gt;&gt; &gt;&gt; Unpaid intern in BillsBasement at noware dot com<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Visit other Kitware open-source projects at<br>
&gt;&gt; &gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; &gt;&gt; <a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Visit other Kitware open-source projects at<br>
&gt;&gt; &gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; &gt; <a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
&gt;<br>
&gt;<br>
<br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
| Aashish Chaudhary<br>
| R&amp;D Engineer<br>
| Kitware Inc.<br>
| <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Unpaid intern in BillsBasement at noware dot com<br><br>