Re: Where do I put code to be executed only once for entire testclass

Shay Thompson <[email protected]>
Newsgroups gmane.comp.jakarta.cactus.user
Message-ID <[email protected]>
For JUnit I do the following.. I think it would work with Cactus.. not 
positive as I haven't tried it.  There's probably something similar if not.

    public static Test suite() {

        TestSuite suite = new TestSuite();
        suite.addTestSuite(MyTestClass.class);

        TestSetup wrapper = new TestSetup(suite) {

            public void setUp() throws Exception {
                init();
            }

            public void tearDown() throws Exception {
                cleanUp();
            }
        };

        return wrapper;
    }

Then in your init() you do the authentication.


Tejaswini Yardi wrote:
> Hi
>
> I need to put a code to authenticate the user into the application which
> loads user cache and should be executed only once for the entire testclass
> instead of executing once for each testcase. Can anyone tell me where can i
> put this code in my test class. 
> Please let me know this as soon as possible.
>   

-- 

If you apply Ohms Law, e=mc2, to the hypotenuse and add to that a catalyst consisting of a set of struts and a gigahertz, you will theoretically arrive at an answer yesterday...

Shay Thompson - Lead Computer Scientist
Adobe Systems, Inc. - Titan Core QE 
Voice: x34728 or 612.251.5415
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.