Author: artdaw
Date: 2008-10-17 12:29:09 -0400 (Fri, 17 Oct 2008)
New Revision: 10821
Modified:
trunk/docs/cdkguide/en/src/main/docbook/includes/ui_conf.xml
trunk/docs/cdkguide/en/src/main/docbook/modules/test.xml
trunk/docs/cdkguide/en/src/main/resources/examples/inputDate.xml
Log:
https://jira.jboss.org/jira/browse/RF-3692 - 'Generating unit tests' chapter
creation
Modified: trunk/docs/cdkguide/en/src/main/docbook/includes/ui_conf.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/includes/ui_conf.xml 2008-10-17 11:10:54 UTC
(rev 10820)
+++ trunk/docs/cdkguide/en/src/main/docbook/includes/ui_conf.xml 2008-10-17 16:29:09 UTC
(rev 10821)
@@ -93,7 +93,7 @@
<programlisting role="XML"><![CDATA[...
<property>
<name>value</name>
- <classname>java.lang.String</classname>
+ <classname>java.lang.Object</classname>
<description>
The value of the component
</description>
Modified: trunk/docs/cdkguide/en/src/main/docbook/modules/test.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/modules/test.xml 2008-10-17 11:10:54 UTC (rev
10820)
+++ trunk/docs/cdkguide/en/src/main/docbook/modules/test.xml 2008-10-17 16:29:09 UTC (rev
10821)
@@ -11,6 +11,98 @@
</chapterinfo>
<title>Generating unit tests</title>
<para>
- Work in progress...
+ Unit testing is a method of testing that verifies the individual units of source
code are working properly.
+ A unit is the smallest testable part of an application, method for example.
+ </para>
+ <para>
+ The goal of unit testing is to isolate each part of the program and show that the
individual parts are correct.
+ Unit tests find problems early in the development cycle and allow you
+ to perform code refactoring at a later date, and make sure the module still works
correctly.
+ By testing the parts of a program first and then testing the sum of its parts,
integration testing becomes much easier.
+ </para>
+ <para>
+ Unit testing provides a sort of living documentation of the system. You could learn
unit functionality
+ by looking at the unit test and get a basic understanding of the unit API.
</para>
+ <note>
+ <title>Note:</title>
+ <para>
+ Unit testing cannot be expected to catch every error in the program.
+ It only tests the functionality of the units themselves.
+ Therefore it is more effective if the other software testing activities
+ are used in conjunction with unit tests.
+ </para>
+ </note>
+ <para>
+ Unit tests generated by CDK check all the properties of the component, resources
availability,
+ and perform render test view.
+ </para>
+ <para>
+ In order to add unit tests to the project you should
+ take the following steps:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ proceed to the <property>inputDate/src/main/config/component</property>
directory,
+ open the <property>inputDate.xml</property> file
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ add the <emphasis
role="bold"><property><test></property></emphasis>
element nested to
+ <emphasis
role="bold"><property><component></property></emphasis>
in order to generate
+ unit test for the <property>UIInputDate</property> class
+ </para>
+ <programlisting role="XML"><![CDATA[...
+<test>
+ <classname>org.richfaces.component.html.HtmlInputDateComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+</test>
+...]]></programlisting>
+ </listitem>
+ <listitem>
+ <para>
+ add the <emphasis role="bold"><property><test
/></property></emphasis> element nested to
+ <emphasis
role="bold"><property><tag></property></emphasis>
in order to generate
+ unit test for the <property>InputDateTag</property> class
+ </para>
+ <programlisting role="XML"><![CDATA[...
+<tag>
+ <name>inputDate</name>
+ <classname>org.mycompany.taglib.InputDateTag</classname>
+ <superclass>org.ajax4jsf.webapp.taglib.HtmlComponentTagBase</superclass>
+ <test/>
+</tag>
+...]]></programlisting>
+ </listitem>
+ <listitem>
+ <para>
+ proceed to the <property>inputDate</property> directory,
+ and add new execution with the <property>generate-tests</property> goal
to <property>pom.xml</property>
+ </para>
+ <programlisting role="XML"><![CDATA[...
+<execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+</execution>
+...]]></programlisting>
+ </listitem>
+ <listitem>
+ <para>
+ launch the following command in the <property>inputDate</property>
directory
+ </para>
+ <programlisting role="XML"><![CDATA[mvn clean
install]]></programlisting>
+ </listitem>
+ </itemizedlist>
+ <para>
+ If all the tests have been run successfully, the "BUILD SUCCESSFUL"
message will appeared.
+ </para>
+ <para>
+ You could also find detailed tests information in the <property>surefire
reports</property> placed in the
+ <property>inputDate/target/surefire-reports</property> directory.
+ </para>
</chapter>
\ No newline at end of file
Modified: trunk/docs/cdkguide/en/src/main/resources/examples/inputDate.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/resources/examples/inputDate.xml 2008-10-17 11:10:54
UTC (rev 10820)
+++ trunk/docs/cdkguide/en/src/main/resources/examples/inputDate.xml 2008-10-17 16:29:09
UTC (rev 10821)
@@ -29,7 +29,7 @@
<property>
<name>value</name>
- <classname>java.lang.String</classname>
+ <classname>java.lang.Object</classname>
<description>
The value of the component
</description>