193 lines
5.5 KiB
HTML
Executable File
193 lines
5.5 KiB
HTML
Executable File
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<meta name="GENERATOR" content="Mozilla/4.51 [en] (X11; U; SunOS 5.6 sun4u) [Netscape]">
|
|
</head>
|
|
<body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">
|
|
<b><u><font color="#993399"><font size=+1>JavaTest Template</font></font></u></b>
|
|
<br>
|
|
<p>Woking on similar lines as JavaSpec, this template generator parses
|
|
an
|
|
<br>input Class file and creates unique Test Template Files for
|
|
<br>each public method complying with all combinations of its parameter
|
|
list.
|
|
<br>It is mainly used for doing a white box testing for all API's (methods).
|
|
<p>This will ensure that all Java Testcase Files follow a given template.
|
|
<p>It uses reflection to figure out all constructors and public methods
|
|
<br>for a given class.
|
|
<br>The file-naming convention for output files is a straight forward one.
|
|
<br>[class Name]_[method name]_[param combinations].java
|
|
<p>param combinations is based on all permutations depending on the values
|
|
<br>of different data types (as listed below)
|
|
<br>
|
|
<p>Listed below is all possible values for types of parameter.
|
|
<br>
|
|
<table BORDER COLS=2 WIDTH="100%" BGCOLOR="#99FFCC" NOSAVE >
|
|
<tr NOSAVE>
|
|
<td WIDTH="100" NOSAVE>String</td>
|
|
|
|
<td>(null, "DUMMY_STRING")</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>int</td>
|
|
|
|
<td>(0, Integer.MIN_VALUE, Integer.MAX_VALUE)</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>float</td>
|
|
|
|
<td>(0, Float.MIN_VALUE, Float.MAX_VALUE)</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>double</td>
|
|
|
|
<td>(0, Double.MIN_VALUE, Double.MAX_VALUE)</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>long</td>
|
|
|
|
<td>(0, Long.MIN_VALUE, Long.MAX_VALUE)</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>short</td>
|
|
|
|
<td>(0, Short.MIN_VALUE, Short.MAX_VALUE)</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>char</td>
|
|
|
|
<td>(Character.MAX_VALUE)</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>boolean</td>
|
|
|
|
<td>(true, false)</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>byte</td>
|
|
|
|
<td>(Byte.MIN_VALUE, Byte.MAX_VALUE)</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>Integer</td>
|
|
|
|
<td>(null, 0, Integer.MIN_VALUE, Integer.MAX_VALUE)</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>Float</td>
|
|
|
|
<td> (null, 0, Float.MIN_VALUE, Float.MAX_VALUE)</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>Double</td>
|
|
|
|
<td>(null, 0, Double.MIN_VALUE, Double.MAX_VALUE)</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>Long</td>
|
|
|
|
<td>(null, 0, Long.MIN_VALUE, Long.MAX_VALUE)</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>Short</td>
|
|
|
|
<td>(null, 0, Short.MIN_VALUE, Short.MAX_VALUE)</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>Character</td>
|
|
|
|
<td>(null, Character.MAX_VALUE)</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>Byte</td>
|
|
|
|
<td>(null, Byte.MIN_VALUE, Byte.MAX_VALUE)</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>Object</td>
|
|
|
|
<td>(null, "NOTNULL")</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td></td>
|
|
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p>So for a method 'm' for class 'c' with two String parameters the output
|
|
files generated will be
|
|
<br>c_m_String_String_0.java --> (null, null)
|
|
<br>c_m_String_String_1.java --> ("DUMMY_STRING", null)
|
|
<br>c_m_String_String_2.java --> (null, "DUMMY_STRING")
|
|
<br>C_m_String_String_3.java --> ("DUMMY_STRING", "DUMMY_STRING")
|
|
<p>
|
|
<hr NOSHADE WIDTH="100%">
|
|
<h2>
|
|
<b><u><font color="#993399"><font size=+1>How to run</font></font></u></b></h2>
|
|
|
|
<p><br>java BWJavaTestTemplate [ -d <output directory>] classname
|
|
<br><output directory>is the location where u want to generate these
|
|
<br>TestCase files
|
|
<br>
|
|
<hr NOSHADE WIDTH="100%">
|
|
<h2>
|
|
<u><font color="#993399">Example</font></u></h2>
|
|
<font color="#FF6666">Class: x.java</font><font color="#FF6666"></font>
|
|
<p><font color="#FF6666"> public class x</font>
|
|
<br><font color="#FF6666"> {</font>
|
|
<br><font color="#FF6666"> public x(String
|
|
arg)</font>
|
|
<br><font color="#FF6666"> {</font>
|
|
<br><font color="#FF6666"> }</font><font color="#FF6666"></font>
|
|
<p><font color="#FF6666"> private void modifyVal(String
|
|
instr)</font>
|
|
<br><font color="#FF6666"> {</font>
|
|
<br><font color="#FF6666"> }</font><font color="#FF6666"></font>
|
|
<p><font color="#FF6666"> public void setVal (String
|
|
ival)</font>
|
|
<br><font color="#FF6666"> {</font>
|
|
<br><font color="#FF6666"> }</font><font color="#FF6666"></font>
|
|
<p><font color="#FF6666"> public void setIndexVal
|
|
(String ival, int index)</font>
|
|
<br><font color="#FF6666"> {</font>
|
|
<br><font color="#FF6666"> }</font>
|
|
<br><font color="#FF6666"> }</font>
|
|
<br><font color="#FF6666"></font> <font color="#FF6666"></font>
|
|
<p>Generated Files are
|
|
<br><font color="#FF6666"> x_setVal_String_0.java</font>
|
|
<br><font color="#FF6666"> x_setIndexVal_String_int_0.java</font>
|
|
<br><font color="#FF6666"> x_setIndexVal_String_int_1.java</font>
|
|
<br><font color="#FF6666"> x_setIndexVal_String_int_2.java</font>
|
|
<br><font color="#FF6666"> x_setIndexVal_String_int_3.java</font>
|
|
<br><font color="#FF6666"> x_setIndexVal_String_int_4.java</font>
|
|
<br><font color="#FF6666"> x_setIndexVal_String_int_5.java</font>
|
|
<br><font color="#FF6666"> x_x_String_0.java</font>
|
|
<br><font color="#FF6666"> x_x_String_1.java</font>
|
|
<br><font color="#FF6666"> x.txt</font><font color="#FF6666"></font>
|
|
<p>
|
|
<hr NOSHADE WIDTH="100%">
|
|
<p><u><font color="#993399"><font size=+1>NOTE</font></font></u>
|
|
<p>Right now the author name in each of those generated files is left
|
|
empty. Future version will reflect the same from configuration files.
|
|
</body>
|
|
</html>
|