This gives me a chance to ask a couple of questions then.  See below.

-----Original Message-----
From: Jason Carreira [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 23, 2003 10:50 AM
To: [EMAIL PROTECTED]
Subject: RE: [OS-webwork] WebWork Getting Started Guide

Hi Les,

Yes, I did get the email... I started looking at it and was confused as
to why you weren't just using Junit straight up, and sent you a note :-)
--
Looks like hotmail put you in my junk mail folder. :)  Apparently, it
thought you were sending p0rn. :-P
--

My suggestions would be 2:

1) Look at MockObjects - you can set up your ServletContext, etc before
hand if your action needs it. They ARE unit tests, so you need to
isolate them from the environment and surrounding code, which
MockObjects do very well.
--
I actually want to move to mockobjects, however I have not had the time
yet to figure out how to use them seemlessly in leu of Hibernate.
Essentially, I would like to find a way to make the substitution of mock
object a runtime option that the tests, themselves can invoke. I think I
have read of a way, but my schedule is too tight right now.  If I do
this, they do become unit tests.  However, as is, my tests are testing
both action, any middleware, and the hibernate mappings.  So, in the
current incarnation they are somewhat functional.  Obviously, I would
like to move to a setup where I have individual unit tests at the layers
and then combine them into a functional test for interfacing work.  If
you have examples or suggestions, I would love to see them.
--
2) Don't use ServletContext and the other web framework artifacts unless
you HAVE to. 
--
The problem that I ran into is that I am not just testing the action
code (i.e. calling action.doExecute).  Instead, I am using the
ActionProxy.  As a result, I am testing the xwork.xml file as well.
What this means is that if I have an action declared that, based on the
resultCode, uses the ServletDispatcher then I will hit this
ServletContext problem.  I would love to find away of testing this in a
way that would prevent me from hitting that.  I would also love to find
a way to incorporate multiple actions in a test is there is chaining
involved. Maybe there is a way to isolate this more and to interact more
intelligently, but I haven't found it yet.  Again, I would love some
suggestions as to how to keep the tests complete (testing the xwork.xml
file as well as the actual execution) and prevent those tests from
succumbing to issues related to the interceptors and result handlers I
have defined.
--
A) it makes it harder to test (only a little with MockObjects, but
still) and 
B) Maybe I'm just a purist, but I don't like to muddy my Actions with
web code. I like to have the flexibility to have them called from a
JMSDispatcher, etc. 
WebWork2 does a pretty good job of isolating you from the Web stuff if
you only need the parameters, Session, etc. 
--
I agree with what you are saying, it should be kept pure.  However, from
a practical aspect I am looking to test my actions, the stuff they call,
and the many descriptors (validators, xwork.xml, etc) that I have setup.
The best way I can find to do this is to write my tests to behave as if
they are calling from the web (ActionProxy).  The problem is that I am
not calling from the web.  So, I have to deal with the consequences of
not having some correct objects.  Maybe it would be better to figure out
a way to test all of these pieces individually, but I simply have not
figured out how to do that yet.  So, I suppose the ultimate question is
how should I be writing test cases that test the interceptors, the
validators, the actions, and the xwork.xml file independantly (for unit
tests) and then together (for use case level functional tests)??
--
Thanx,
LES

Jason

> -----Original Message-----
> From: Les Stroud [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, June 22, 2003 10:40 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [OS-webwork] WebWork Getting Started Guide
> 
> 
> Ah, somehow I missed it.  
> 
> Anyway, it's not really on top of junit, it is just an 
> extension that makes figuring out how to test an action a 
> little simpler.  Like I said, there's not that much to it. It 
> simply encapsulates all of the Action Proxy stuff.  Also, if 
> you are new to it like I am, I found that it took quite some 
> time to discover why my test cases were all bombing out with 
> NullPointerExceptions (which were not originating in my tests 
> :)). Turned out, it was related to the lack of a servlet 
> context.  So, the test case extension figures out whether the 
> null pointer exception that you are getting is servlet 
> related and manages it.  That's about it. So, it does enough 
> and provides enough of a blue print for someone new to 
> webwork2 to easily build action tests (which are really functional not
> unit.)  If that's useful you guys are welcome to it. 
> 
> BTW -- Jason, did you get my direct email with source in it?
> 
> LES
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Jason Carreira
> Sent: Sunday, June 22, 2003 9:43 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [OS-webwork] WebWork Getting Started Guide
> 
> I replied... Not sure if you got it... You seem to have a 
> framework for testing actions... I'm just not sure why you 
> need a framework on top of Junit instead of just directly 
> testing your Actions with TestCase's?
> 
> > -----Original Message-----
> > From: Les Stroud [mailto:[EMAIL PROTECTED]
> > Sent: Sunday, June 22, 2003 1:18 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: [OS-webwork] WebWork Getting Started Guide
> > 
> > 
> > Jason,
> > Should I take that as a not interested??  No problem. :)
> > 
> > LES
> > 
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On
> > Behalf Of [EMAIL PROTECTED]
> > Sent: Monday, June 16, 2003 6:42 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: [OS-webwork] WebWork Getting Started Guide
> > 
> > I replied to your notiva.com email with some files (I didn't
> > wanna eat up everyone's bandwidth :) ).  Let me know what you think.
> > 
> > LES
> > 
> > -----Original Message-----
> > From: Jason Carreira [mailto:[EMAIL PROTECTED]
> > Sent: Monday, June 16, 2003 3:47 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: [OS-webwork] WebWork Getting Started Guide
> > 
> > 
> > 
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, June 16, 2003 3:00 PM
> > > > 
> > > Jason -- I did have one question.  I implemented all of the 
> > > interfaces for junit in a set of classes to test the 
> actions using 
> > > ActionProxy.  It makes it a little easier because it handles the 
> > > exceptions that are thrown as a result of not having a servlet 
> > > context when running the unit tests.  Is this something 
> that would 
> > > be useful to the project?  If so, how would I submit them?
> > > 
> > > LES
> > 
> > I don't follow... Which interfaces?
> > 
> > Jason
> > 
> > 
> > -------------------------------------------------------
> > This SF.NET email is sponsored by: eBay
> > Great deals on office technology -- on eBay now! Click here:
> > http://adfarm.mediaplex.com/ad/ck/711-11697-> 6916-5
> > 
> > _______________________________________________
> > 
> > Opensymphony-webwork mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> > 
> > 
> > -------------------------------------------------------
> > This SF.Net email is sponsored by: INetU
> > Attention Web Developers & Consultants: Become An INetU
> > Hosting Partner. Refer Dedicated Servers. We Manage Them. You 
> > Get 10% Monthly Commission! INetU Dedicated Managed Hosting 
> > http://www.inetu.net/partner/index.php
> > 
> > _______________________________________________
> > Opensymphony-webwork mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> > 
> > 
> > 
> > 
> > 
> > -------------------------------------------------------
> > This SF.Net email is sponsored by: INetU
> > Attention Web Developers & Consultants: Become An INetU
> > Hosting Partner. Refer Dedicated Servers. We Manage Them. You 
> > Get 10% Monthly Commission! INetU Dedicated Managed Hosting 
> > http://www.inetu.net/partner/index.php
> > 
> > _______________________________________________
> > Opensymphony-webwork mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> > 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: INetU
> Attention Web Developers & Consultants: Become An INetU 
> Hosting Partner.
> Refer Dedicated Servers. We Manage Them. You Get 10% Monthly 
> Commission!
> INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
> _______________________________________________
> Opensymphony-webwork mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> 
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: INetU
> Attention Web Developers & Consultants: Become An INetU 
> Hosting Partner.
> Refer Dedicated Servers. We Manage Them. You Get 10% Monthly 
> Commission!
> INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
> _______________________________________________
> Opensymphony-webwork mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> 


-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork


-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to