Yes, all my junit tests (including cactus) depend on a db-load task that uses DBUnit. As far as logging in before running your test (the j_security_check) that should work - at least it sounds like it should.
You can check out my build.xml file (http://tinyurl.com/pwqt) for AppFuse or download the whole project (http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuse) to see how I'm doing it. Matt -----Original Message----- From: Mick Knutson [mailto:[EMAIL PROTECTED] Sent: Monday, October 06, 2003 11:56 AM To: Struts Users Mailing List Subject: Re: Help with StrutsTestCase examples and usage. So, do you kick off DBUnit at the beginning and end of your testing? I am running ant for my junit, and am trying to set my tests up correctly. I also saw the j_security_check example on your site. Can I just run that check as the init() of my tests with CactusTestCases? --- Thanks Mick Knutson The world is a playground...Play Hard, Play Smart. Visit http://www.YourSoS.com to learn how our "Personal Emergency Alert & Contact System" can help you Play Smart. +00 1 (877) SoS-9119 +00 1 (708) 570-2772 Fax --- ----- Original Message ----- From: "Matt Raible" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Sent: Monday, October 06, 2003 10:45 AM Subject: RE: Help with StrutsTestCase examples and usage. > I use DBUnit to ensure that the database is in a repeatable state. Cactus > does support container managed authentication, but I don't think it's in a > released version yet. > > Here's my tests that prove it works: > > public void beginFormAuthentication(WebRequest theRequest) { > theRequest.setRedirectorName("ServletRedirectorSecure"); > theRequest.setAuthentication(new FormAuthentication(rb.getString( > "username"), rb.getString("password"))); > } > > /** > * Test logging in as user a user > */ > public void testFormAuthentication() { > assertEquals(rb.getString("username"), > request.getUserPrincipal().getName()); > assertEquals(rb.getString("username"), request.getRemoteUser()); > assertTrue("User not in '" + rb.getString("role") + "' role", > request.isUserInRole(rb.getString("role"))); > } > > Where "rb" is a properties file for my test. > > HTH, > > Matt > -----Original Message----- > From: Mick Knutson [mailto:[EMAIL PROTECTED] > Sent: Monday, October 06, 2003 11:45 AM > To: Struts Users Mailing List > Subject: Re: Help with StrutsTestCase examples and usage. > > > How do you handle Database updates with these type of tests? > I have MySql and do not have inoDB support yet. So I need to ensure the DATA > is in a repeatable state. This is why I was starting with Mock tests > instead. > > Not to mention, I use JAAS Container authentication, so wouldn't that > interfere with the tests? I thought that Cactus did not yet support testing > through container managed security, and my actions are all in a secured area > requiring authentication. > > > --- > Thanks > Mick Knutson > > The world is a playground...Play Hard, Play Smart. > Visit http://www.YourSoS.com to learn how our "Personal Emergency Alert & > Contact System" can help you Play Smart. > > > +00 1 (877) SoS-9119 > +00 1 (708) 570-2772 Fax > --- > > ----- Original Message ----- > From: "Matt Raible" <[EMAIL PROTECTED]> > To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> > Sent: Monday, October 06, 2003 10:29 AM > Subject: RE: Help with StrutsTestCase examples and usage. > > > > Here's an in-container StrutsTestCase: > > > > http://tinyurl.com/pwkp > > > > HTH, > > > > Matt > > > > -----Original Message----- > > From: Mick Knutson [mailto:[EMAIL PROTECTED] > > Sent: Monday, October 06, 2003 11:29 AM > > To: struts > > Subject: Help with StrutsTestCase examples and usage. > > > > > > I am having issues with getting StrutsTestCase to work. I have several > > actions that I am checking for a given ActionForward, but the Forward is > not > > what was expected. However, it does not tell me what Forward was received. > > > > Also, when there is an error returned, I keep getting "Error was returned, > > but no message was found". I am using message keys, and checking for them, > > but none exist. And I am not told what error type was thrown, and why > there > > are no messages, or if there were any other messages. > > > > So, if anyone has any Mock examples other than login examples, I would > love > > to see how others are testing there Actions. > > > > --- > > Thanks > > Mick Knutson > > > > The world is a playground...Play Hard, Play Smart. > > Visit http://www.YourSoS.com to learn how our "Personal Emergency Alert & > > Contact System" can help you Play Smart. > > > > > > +00 1 (877) SoS-9119 > > +00 1 (708) 570-2772 Fax > > --- > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]