Hi Karthik,

It's an interesting idea. However, if we want to be generic (i.e. cover all
kind of server side test cases) we'll have to define a pretty complex DTD,
especially for the asserts. The problem is probably that in the end we'll
reinvent a complete language ... like java ... That's why JUnit has been
successful : it is simple and uses java to write the test case, thus
allowing for flexibility. Now, if Cactus had a reduced scope, like testing
of JSP only, then I agree we could do something like you propose. Being a
generic tool for server side code, I don't think it is possible to write a
DTD that would work everywhere.

As Jari said, I think they're doing what you suggest in JXUnit. Also don't
forget that Cactus is primarily useful for writing unit tests and not
functional tests. Functional tests through the integration with HttpUnit is
added for convenience so that you can easily write tests that encompass both
white box and black box testing for added confidence.

Anyway, thanks very much for the proposition. Please continue to propose
them ! Tell me what you think of my arguments.
Cheers,
-Vincent

----- Original Message -----
From: "Karthik Kumar" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, October 03, 2001 10:28 AM
Subject: Automating tests


> Hello,
>   I have been using Cactus to test JSPs for sometime now. What I had been
doing
> is that I set some session attributes in the testXXX case and then
redirect to
> the JSP, get back the results in endXXX and then assert for the expected
> results and table values using HttpUnit, thanks to the integration of
> Cactus-HttpUnit software.
>   Now can I anyway automate the process ? Let me go into this in detail.
Lets
> say I have an XML file having my own custom DTD that allows me to do the
> following:
>
> 1) Set request parameters.
> 2) Set various session objects and values
> 3) Assign some expected values for the given set of request parameters,
session
> objects etc and then assert for these values.
>
> say an example could be,
>
> <testcase context="emp" file="getrecords.jsp">
>   <testcasesequence>
>     <request>
>         <param name="abcd" value="abcd_val" />
>     </request>
>     <session>
>       <object type="java.lang.Integer" value="16" />
>       <object type="EmpContext">
>          <field name="f1" value="vf1" />
>          <field name="f2" value="vf2" />
>       </object>
>     </session>
>     <response>
>        <table numbers="3" />
>     </response>
>   </testcasesequence>
> </testcase>
>
>
> Now this sequence says that for a given JSP file in a particular context
( as
> referred to by the attributes ), we write lot of test-cases, in the form
of XML
> tags.
>   Each test-case would have  - request, session, response children tags. A
> request would have param children tag. Session will have the number of
objects
> that  are to be used as the setAttribute( "name" , "value" ) . A Response
(
> HttpUnit WebResponse has got a great API to be manipulated . Let;s take
that as
> a reference ) . Now the response should have 3 tables.
>   Similar to this, there could be a great number of test cases available
for a
> given JSP file only. Now how would I automate the entire process ? I just
need
> to write the XML file and a single piece of code and run the tests. At the
end
> of the tests  I  should get that test-sequence 1,2 passed and
test-sequence 3
> failed. How would I do this with Cactus ? If not, can this one be
integrated
> with Cactus ?
>   Please Let me know your comment, suggestions.
>
> Thanks.
> Karthik Kumar.
>
> __________________________________________________
> Do You Yahoo!?
> Listen to your Yahoo! Mail messages from any phone.
> http://phone.yahoo.com
>

Reply via email to