Date: 2005-01-28T15:30:41
Editor: ZacharySmith
Wiki: Apache Beehive Wiki
Page: Controls/TestingControls/Milton
URL: http://wiki.apache.org/beehive/Controls/TestingControls/Milton
no comment
Change Log:
------------------------------------------------------------------------------
@@ -129,3 +129,33 @@
If you have questions about the JPF syntax please set the [wiki:/NetUI NetUI]
documentation. In the above example there are two 'Actions'. The first is the
`begin()` Action which is required on every JPF. In this case the `begin()`
Action does not contain a test and puts an Report with an ABORT status on the
request. Because Milton must relies on the data found in the `Report` obejct
to analyzet he results of a test this is accomplised with JPF but putting the
`Report` on the request and giving it a known name, `Report.KEY` and
'Forwarding' the user to a known JSP, `Report.RESULTS`. Using `Report.RESULTS`
and `Report.KEY` is required for correct Milton operation because the `Report`
must be forwarded to a JSP which converts the `Report` to an HTML table which
can be parsed by the JUnit accessor. THis will be true of all Actions which
execute test code you want analyzed. (The Milton JSPs are copied into your
webapp at build time. See ControlsTestWebApps) The second action is
`testInstantiation()` which creates a `Report`, instantiates a Driver, invokes
the `testInstantiation(InstantiationControlBean icb)` method on the Driver, and
returns the results by putting the `Report` on the request using the `Forward`.
Again, the scope of this doc is not to explain JPF so if the JPF doesn't make
sense please see the [wiki:/NetUI NetUI] documentation. To correctly use
Milton to test your controls you will need to mimic the above Action. Also
note, this test uses the Declarative Instantiation to instantiate the test
control. If you want to use Programatic Instantiation please [wiki:/Controls
Controls] documentation.
+'''JWS Client Example:'''
+{{{
+package milton.webservices.instantiate;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+import
org.apache.beehive.controls.test.controls.instantiate.InstantiateControlBean;
+import org.apache.beehive.controls.test.driver.instantiate.InstantiationDriver;
+
+import org.apache.beehive.test.tools.milton.common.Report;
+
+import org.apache.beehive.controls.api.bean.Control;
+
[EMAIL PROTECTED]
+public class InstantiationDriverWebService
+{
+ @Control
+ public InstantiationControlBean icb;
+
+
+ @WebMethod
+ public Report testInstantiation() throws Exception
+ {
+ InstantiationDriver id = new InstantiationDriver();
+ return id.testInstantiation(icb);
+ }
+}
+}}}
+