You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Anil Agrawal <a....@popnet.co.in> on 2003/04/30 14:28:04 UTC

Session management in testcase

I want to maintain session in all my testcases.
When I call my first testcase I put "authorization" object in session.
When I call second testcase cactus creates new sesssion. Why?
What is solution.

I want that When my testcase completes execution still session 
Should be maintained.

With regards
anil

TestSuite suite =
            new TestSuite("WSC TESTS");

        // Functional tests
 
//suite.addTest(com.csam.wsc.sync.junit.cactus.TestServletTestCase_Sync.
suite());
 
//suite.addTest(com.csam.wsc.auth.junit.cactus.TestServletEJB_Auth.suite
());
        
        // Functional tests
        
 
suite.addTest(com.csam.wsc.admin.junit.cactus.TestTagAuthenticate.suite(
));
 
suite.addTest(com.csam.wsc.auth.junit.cactus.TestTagCreateGroup.suite())
;
 
suite.addTest(com.csam.wsc.auth.junit.cactus.TestTagDeleteGroup.suite())
;
 
suite.addTest(com.csam.wsc.auth.junit.cactus.TestTagAddServiceToGroup.su
ite());
 
suite.addTest(com.csam.wsc.auth.junit.cactus.TestTagRemoveServiceFromGro
up.suite());
 
suite.addTest(com.csam.wsc.auth.junit.cactus.TestTagRegisterComponent.su
ite());
        

RE: Session management in testcase

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Anil,

Here's the new FAQ I have added:

    <section title="How do I maintain a Session between 2 Cactus test?">

      <section title="Question">
        <p>
          I would like to use the same HTTP Session between several
Cactus 
          tests. How can I do that?
        </p>
      </section>
      <section title="Solution">
        <p>
          Cactus is a unit testing framework and not a functional
testing 
          framework. Each test <em>must</em> be independent of the
others.
          There are several reasons for this: tests become very brittle,
          test order is not guaranteed by the JVM, etc. Thus, before
each
          test you must set the fixture. This can be factorized in the
          <code>setUp()</code> method or in the Cactus
<code>begin()</code>
          method.
        </p>
      </section>
	</section>

Hope it helps,
-Vincent

> -----Original Message-----
> From: Anil Agrawal [mailto:a.agrawal@popnet.co.in]
> Sent: 30 April 2003 14:28
> To: cactus-user@jakarta.apache.org
> Subject: Session management in testcase
> 
> I want to maintain session in all my testcases.
> When I call my first testcase I put "authorization" object in session.
> When I call second testcase cactus creates new sesssion. Why?
> What is solution.
> 
> I want that When my testcase completes execution still session
> Should be maintained.
> 
> With regards
> anil
> 
> TestSuite suite =
>             new TestSuite("WSC TESTS");
> 
>         // Functional tests
> 
>
//suite.addTest(com.csam.wsc.sync.junit.cactus.TestServletTestCase_Sync.
> suite());
> 
>
//suite.addTest(com.csam.wsc.auth.junit.cactus.TestServletEJB_Auth.suite
> ());
> 
>         // Functional tests
> 
> 
>
suite.addTest(com.csam.wsc.admin.junit.cactus.TestTagAuthenticate.suite(
> ));
> 
>
suite.addTest(com.csam.wsc.auth.junit.cactus.TestTagCreateGroup.suite())
> ;
> 
>
suite.addTest(com.csam.wsc.auth.junit.cactus.TestTagDeleteGroup.suite())
> ;
> 
>
suite.addTest(com.csam.wsc.auth.junit.cactus.TestTagAddServiceToGroup.su
> ite());
> 
>
suite.addTest(com.csam.wsc.auth.junit.cactus.TestTagRemoveServiceFromGro
> up.suite());
> 
>
suite.addTest(com.csam.wsc.auth.junit.cactus.TestTagRegisterComponent.su
> ite());
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org