Thread: [Mockpp-commits] mockpp/mockpp/docs/en dev_test_framework.docbook,1.1,1.2 index.docbook,1.35,1.36
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2005-12-21 20:05:50
|
Update of /cvsroot/mockpp/mockpp/mockpp/docs/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23973/mockpp/docs/en Modified Files: dev_test_framework.docbook index.docbook Log Message: extended Index: index.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/index.docbook,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- index.docbook 10 Dec 2005 15:16:39 -0000 1.35 +++ index.docbook 21 Dec 2005 20:05:40 -0000 1.36 @@ -6,11 +6,13 @@ <!DOCTYPE book PUBLIC "-//OASIS//DTD Docbook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ - <!ENTITY mockpp '<application>mockpp</application>' > - <!ENTITY cppunit '<application>CppUnit</application>' > - <!ENTITY cygwin '<application>Cygwin</application>' > - <!ENTITY copyyears '2002-2005' > - <!ENTITY mockpp_email 'mockpp at ewald-arnold dot de' > + <!ENTITY mockpp '<application>mockpp</application>' > + <!ENTITY cppunit '<application>CppUnit</application>' > + <!ENTITY cxxtest '<application>CxxTest</application>' > + <!ENTITY boosttest '<application>Boost.Test</application>' > + <!ENTITY cygwin '<application>Cygwin</application>' > + <!ENTITY copyyears '2002-2005' > + <!ENTITY mockpp_email 'mockpp at ewald-arnold dot de' > <!ENTITY release_date '<pubdate>Published: <?dbtimestamp format="Y-m-d"?></pubdate>' > <!ENTITY release_info '<releaseinfo>1.11.00</releaseinfo>' > Index: dev_test_framework.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/dev_test_framework.docbook,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- dev_test_framework.docbook 10 Dec 2005 15:16:39 -0000 1.1 +++ dev_test_framework.docbook 21 Dec 2005 20:05:40 -0000 1.2 @@ -1,19 +1,108 @@ <sect1 id="unittest-framework"> <title>Choosing a Unit Test Framework</title> +<para>Basically &mockpp; should work with every unittesting framework. It does +not necessarily need advanced features like runtime type information (RTTI) +or exceptions. But if possible they should both be used. RTTI provides some +information about the actual type in use. And exceptions help to avoid resource +leaks since the compiler adds code to destruct automatic variables.</para> + +<para>The following section lists frameworks which have actually been used to +verify the correctness of &mockpp;. Or at least they are known to work +properly.</para> + <sect2 id="framework-cppunit"> <title>CppUnit</title> +<para>Tests with &cppunit; are usually grouped in classes. A method contains one +single test. Each of the tests is typically registered automatically with a test +runner by using some macros. This is internally done by instantiating a static +variable.</para> + +<para>&cppunit; does not need RTTI to work but it relies on exceptions to check +assertions and report the results.</para> + +<para>At runtime each of the methods are then invoked in unspecified order.</para> + +<programlisting> + +class AssertMo_test : public CppUnit::TestFixture +{ + public: + + CPPUNIT_TEST_SUITE( AssertMo_test ); + CPPUNIT_TEST(test_A_includes); + CPPUNIT_TEST_SUITE_END(); + + void test_A_includes(); +}; + +void AssertMo_test::test_A_includes() +{ + ... +} + +</programlisting> + </sect2> + <sect2 id="framework-cxxtest"> <title>CxxTest</title> +<para>The original working method of &cxxtest; is different to &cppunit;. A perl +script searches the test sources and creates an additional source file which +is then call ompiled and run. All the library source files are directly included +into the main source file which means that you do not need to create a binary +library for &cxxtest;.</para> + +<para>Since not every environment supports the execution of a perl script within +the edit-compile cycle &mockpp; contains some additional macros similar to +&cppunit; which +register the test methods automatically at runtime. The main difference is the +fact that the macros are located outside the class. Additionally the version of +&cxxtest; included in &mockpp; comes as binary library which should help to save +some memory and download time which is important on embedded platforms.</para> + +<para>&cxxtest; does netiher need RTTI nor exceptions to work. But it is possible +to check exception conditions.</para> + +<para>Similar to &cppunit; the test methods are invoked in unspecified order.</para> + +<programlisting> + +class AssertMo_test : public CxxTest::TestSuite +{ + public: + + void test_A_includes(); +}; + +MOCKPP_CXXTEST_SUITE_REGISTRATION( AssertMo_test ); +MOCKPP_CXXTEST(AssertMo_test, test_A_includes); + +void AssertMo_test::test_A_includes() +{ + ... +} + +</programlisting> + </sect2> <sect2 id="framework-boost"> <title>Boost.Test</title> +<para>TBD</para> + +<!-- +As opposed to the previous frameworks &boosttest; does not use + +<programlisting> +</programlisting> + +--> + </sect2> </sect1> |