Re: unit testing Struts2 application (with Spring and Hibernate)

2009-08-07 Thread Musachy Barroso
I have updated the JUnit plugin, to provide support for this kind of testing(also for spring testing), see the documentation here: http://cwiki.apache.org/confluence/display/WW/Testing+Actions See the 2 classes here:

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-08-07 Thread Dimitrios Christodoulakis
Thanks for this news! I will give it a try. On Fri, Aug 7, 2009 at 1:56 PM, Musachy Barrosomusa...@gmail.com wrote: I have updated the JUnit plugin, to provide support for this kind of testing(also for spring testing), see the documentation here:

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-21 Thread Dimitrios Christodoulakis
I have used this testing code to a certain extend, and seems to work fine. So I am interested in making it work against a complete test case scenario. So, when trying to load a child entity after the parent is retrieved, I get a LazyInitializationException Error. Sure enough, when the system

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-21 Thread Haroon Rafique
On Today at 2:02pm, DC=Dimitrios Christodoulakis dimi@gmail.com wrote: DC [..snip..] DC DC The CONFIG_LOCATIONS is used to initialize the servletContext which in DC turn is used to initialize the applicationContext, right? So, I am not DC sure where is the correct place to add the web.xml

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-21 Thread Dimitrios Christodoulakis
In your code below, where you say // and then execute proxy again, are you missing some stepls where you need to supply some parameters to the action? Yes, that wasn't actual code, just the steps I was considering. -In any case it's good to know the limitations of the example. You are right,

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-20 Thread Haroon Rafique
On Yesterday at 9:16pm, DC=Dimitrios Christodoulakis dimi@gmail.com...: DC [..snip..] DC DC When testing (junit 4) an action implementing the Sessionaware DC interface (my login and register classes) I noticed that the session DC object is set to null by BaseStrutsTestCase. This was

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-20 Thread Dimitrios Christodoulakis
Thanks Haroon for the handy advice. That seems to do the trick as far as the session object is concerned. The test passes now. Would it be easy for someone to extend your code to include actions that implement the -aware interfaces? If I wanted to take a shot at that, is there a particular point

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-20 Thread Haroon Rafique
On Today at 4:32pm, DC=Dimitrios Christodoulakis dimi@gmail.com wrote: DC Thanks Haroon for the handy advice. That seems to do the trick as far DC as the session object is concerned. The test passes now. DC Glad it worked out. DC DC Would it be easy for someone to extend your code to

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-20 Thread Dimitrios Christodoulakis
Thanks for clarifying Haroon, Actually the additions you are mentioning sum up the original testing code pretty well. Like I said, from an educational point of view, I think one can learn a lot about the framework itself by studying that article and the comments. Thanks for the preparable bit

RE: unit testing Struts2 application (with Spring and Hibernate)

2009-07-20 Thread Martin Gainty
manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Date: Mon, 20 Jul 2009 19:07:09 -0500 Subject: Re: unit testing Struts2 application (with Spring and Hibernate) From: dimi@gmail.com To: user@struts.apache.org Thanks for clarifying Haroon

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-20 Thread Dimitrios Christodoulakis
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Date: Mon, 20 Jul 2009 19:07:09 -0500 Subject: Re: unit testing Struts2 application (with Spring and Hibernate) From: dimi@gmail.com To: user@struts.apache.org Thanks for clarifying

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-19 Thread musomesa
. It is a bummer when you switch versions and find the tests are dead. Chris -Original Message- From: Greg Lindholm greg.lindh...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Sat, Jul 18, 2009 3:00 am Subject: Re: unit testing Struts2 application (with Spring

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-19 Thread Paweł Wielgus
...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Sat, Jul 18, 2009 3:00 am Subject: Re: unit testing Struts2 application (with Spring and Hibernate) IMO that's outside the purview of unit testing, though--by definition this describes integration testing: the testing

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-19 Thread Dave Newton
Paweł Wielgus wrote: But You will hit the same scale of problems when You will change layout - all selenium tests are dead, I haven't really found that to be the case--I only rarely test deep structure with Selenium, but instead look for the presence of specific CSS selectors containing text

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-19 Thread Paweł Wielgus
Hi Dave, when i record my tests with selenium ide, all click or assert alements takes various loactor addresses, very often they contain DOM paths, so when layout is changed from tables to divs, all these addresses are no longer valid. To present one simple example, when i record logout click on

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-19 Thread Dave Newton
Paweł Wielgus wrote: Hi Dave, when i record my tests with selenium ide, all click or assert alements takes various loactor addresses, very often they contain DOM paths, so when layout is changed from tables to divs, all these addresses are no longer valid. On the rare occasions I use the IDE

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-19 Thread Dimitrios Christodoulakis
Primarily for the sake of learning the inner mechanics of the struts2 framework, and unit testing, I took some time to study and experiment with the code published at: http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/ When testing (junit 4) an action

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-19 Thread Wes Wannemacher
On Sunday 19 July 2009 10:16:59 pm Dimitrios Christodoulakis wrote: 2) If one with general knowledge of servlets jsp wants to dive into the struts2 source code, to get better understanding of the basic mechanics, what would be the starting point? So should I start lets say with the

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-17 Thread Paweł Wielgus
Hi all, while i do selenium tests and i do prefer it for integration tests, i'm feeling obligated to point out one disadvantage, while being very easy and fun to write or record, they tend to take a lot more time to run in comparison to unit tests. My case is tons of selenium tests which takes

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-17 Thread musomesa
the whole enchilada. Chris -Original Message- From: Wes Wannemacher w...@wantii.com To: Struts Users Mailing List user@struts.apache.org Sent: Fri, Jul 17, 2009 10:59 am Subject: Re: unit testing Struts2 application (with Spring and Hibernate) On Thursday 16 July 2009 07:14:30 pm Dave

RE: unit testing Struts2 application (with Spring and Hibernate)

2009-07-17 Thread Andy
Couldn't agree more. From: w...@wantii.com To: user@struts.apache.org Subject: Re: unit testing Struts2 application (with Spring and Hibernate) Date: Thu, 16 Jul 2009 21:59:35 -0400 On Thursday 16 July 2009 07:14:30 pm Dave Newton wrote: IMO that's outside the purview of unit testing

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-17 Thread Greg Lindholm
IMO that's outside the purview of unit testing, though--by definition this describes integration testing: the testing of an action along with the framework. There's nothing *wrong* with doing that testing, I just don't think it's the same thing as unit testing: independently

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-17 Thread Wes Wannemacher
On Fri, Jul 17, 2009 at 2:00 PM, Greg Lindholmgreg.lindh...@gmail.com wrote: Not to pick on anyone but this isn't really a popularity contest. Different situations have different needs and there is no reason to suggest that one solution will work best for everyone. Greg, I didn't want it to

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-17 Thread Dimitrios Christodoulakis
Of course you're right Greg, it's not a contest... no right or wrong here. I am glad to hear all the views coming from everyone and commiters too. Well, my original motivation was to learn how to do this kind of tip-to-tail, all inclusive testing, with the interceptor stack involved. For example

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-17 Thread Wes Wannemacher
On Fri, Jul 17, 2009 at 2:28 PM, Dimitrios Christodoulakisdimi@gmail.com wrote: [snip] Just a quick question to Wes: In your upcoming book, which is in the MEAP phase, there is an appendix titled Unit testing with JUnit and TestNG . Is there any plan to include some examples describing the

unit testing Struts2 application (with Spring and Hibernate)

2009-07-16 Thread Dimitrios Christodoulakis
Hello, I was hoping to hear the community's views about unit testing a Struts2 application which is integrated with Spring and Hibernate. My plan is to unit test the actions with the framework's interceptors running, rather than each action class in a stand-alone isolated fashion. What approach

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-16 Thread Wes Wannemacher
I have a few thoughts on this, but I am somewhat opinionated when it comes to unit testing. Personally, I don't think it's necessary to test your actions with the interceptors. If you want to make sure that your actions fit into the struts flow of things, then unit testing is probably not the

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-16 Thread Musachy Barroso
+1 for what Wes said. Plus, I would say, the junits become so complex (when you do integration test from them), that from my experience, when they break, people don't want to fix them (because we have to admit, we are lazy). musachy On Thu, Jul 16, 2009 at 8:28 AM, Wes Wannemacherw...@wantii.com

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-16 Thread Greg Lindholm
Well everyone has an opinion so here mine: I want to unit test my Struts actions in the full Struts context which includes the interceptor stack and validation. This way I know my actions and results are configured correctly since I test them. I also know my declarative validations are working

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-16 Thread Dimitrios Christodoulakis
Thanks everyone for their opinions. I was indeed hoping to hear both sides of this matter, with both bringing valid arguments and make good points. I was wondering with popular frameworks like struts, spring and hibernate integrated together and the increasing adoption of test driven, and agile

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-16 Thread Haroon Rafique
On Today at 1:19pm, GL=Greg Lindholm greg.lindh...@gmail.com wrote: GL Well everyone has an opinion so here mine: GL GL I want to unit test my Struts actions in the full Struts context which GL includes the interceptor stack and validation. This way I know my GL actions and results are

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-16 Thread Nils-Helge Garli Hegvik
If it's integration testing you want to do, I've had success embedding Jetty and doing full in-container integration testing. Embedding Jetty is really easy, and it's pretty fast too. Although not Struts 2 specific, take a look at this article:

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-16 Thread Dave Newton
Haroon Rafique wrote: We like to test against the complete struts context include the relevant interceptor stack. This gives us the ability to test for all kinds of combinations of compelte and partially incomplete input. IMO that's outside the purview of unit testing, though--by definition

Re: unit testing Struts2 application (with Spring and Hibernate)

2009-07-16 Thread Wes Wannemacher
On Thursday 16 July 2009 07:14:30 pm Dave Newton wrote: IMO that's outside the purview of unit testing, though--by definition this describes integration testing: the testing of an action along with the framework. There's nothing *wrong* with doing that testing, I just don't think it's the