Where do you create your SessionHelper class? It's probably being instantiated for each testXXX call. Therefore, each time a beginXXX method is executed, you static session cookie inside the SessionHelper class is null.
Basically, you're right in that you need to grab the JSESSIONID in your first endXXX method, but when you assign it to the static object in your SessionHelper class it will not exist when Cactus invokes the next test method. Really, it doesn't make a difference if you keep the cookie static or not, since your test will create a SessionHelper each time on the client side. You will need to reload your JSESSIONID cookie and add it to each request. Charley -----Original Message----- From: Eric Garza [mailto:[EMAIL PROTECTED]] Sent: Friday, September 06, 2002 10:49 AM To: 'Cactus Users List' Subject: RE: WebSphere 4.0.3 JSESSIONID and Cactus I am doing exactly what you describe, I think you answered my question mentioning the generic begin and end methods. Could you explain further, or are you referring to the begin and end for every test? Thanks. -- Eric Garza iRise -----Original Message----- From: Charles Massey [mailto:[EMAIL PROTECTED]] Sent: Friday, September 06, 2002 10:33 AM To: 'Cactus Users List' Subject: RE: WebSphere 4.0.3 JSESSIONID and Cactus Eric, Keep in mind that the jsession id needs to be sent each time for every request in each beginXXX method, except in the case where you don't have a JESSIONID yet. On your first request, you don't send the JSESSIONID and the server will return you a JSESSIONID cookie. This will also happen if the JSESSIONID cookie has expired on the server. When I receive a JSESSIONID cookie in the response, my endXXX() method persists the cookie. I then load the serialized cookie from disk and add it to the request inside every beginXXX method after that. As a side note, this is a reason why Vincent added the generic begin() and end() methods - this way you can keep your logic in one place and it keeps you from having to duplicate the logic across each beginXXX and endXXX method. Charley -----Original Message----- From: Eric Garza [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 2:36 PM To: '[EMAIL PROTECTED]' Subject: WebSphere 4.0.3 JSESSIONID and Cactus I recently got Cactus setup with WebSphere 4.0.3. I had to capture the JSESISONID and add it as a cookie to each subsequent request. A few questions: 1) I wasn't sure where the best place to grab the JSESSIONID cookie was, so in my first test case in the endXXX method I grab the cookie and pass it to a SessionHelper class with a static Cookie object. I then add the JSESSIONID cookie to all other testcases in the beginXXX. Can I grab the JSESSIONID before my first test case executes maybe from my TestAll class? 2) I am getting an error the first time I run my tests after restarting my WebSphere application. Subsequent runs are fine. This may or may not be related to the cookie, here is the calling code: public void beginAPDSLogin(WebRequest theRequest) { debug("Existing session cookie: " + SessionHelper.getJSESSION().getValue()); theRequest.addCookie(SessionHelper.getJSESSION()); theRequest.addParameter("userName", "apds", theRequest.GET_METHOD); theRequest.addParameter("password", "apds", theRequest.GET_METHOD); } /** * Login to the APDS application. */ public void testAPDSLogin() throws ServletException, IOException { ServletContext context = config.getServletContext(); ServletContext sctx = context.getContext("/apds"); RequestDispatcher rd = sctx.getRequestDispatcher("/login.action"); rd.forward(request, response); String userName = request.getParameter("userName"); String password = request.getParameter("password"); context.log("userName = " + userName); context.log("password = " + password); assertEquals("apds", userName); assertEquals("apds", password); } Here is the stack trace: run.apds.cactus.test: prepare.test: apds.test: [junit] Running com.baxter.apds.test.cactus.TestAll [junit] Tests run: 2, Failures: 0, Errors: 1, Time elapsed: 1.902 sec [junit] Testsuite: com.baxter.apds.test.cactus.TestAll [junit] Tests run: 2, Failures: 0, Errors: 1, Time elapsed: 1.902 sec [junit] Testcase: testLoadAPDSLogin took 1.422 sec [junit] Testcase: testAPDSLogin took 0.45 sec [junit] Caused an ERROR [junit] Failed to get the test results. This is probably due to an error tha t happened on the server side when trying to execute the tests. Here is what was returned by the server : [ [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] <!-- begin templates._main_jsp_0 --> [junit] <html> [junit] <head> [junit] <title>APDS: SYS01001 Main Menu</title> [junit] <META http-equiv="Expires" content="0"> [junit] <link rel=stylesheet href="apds.css" type="text/css"> [junit] <script src="javaScript/disablePage.js"></script> [junit] <script language="JavaScript"> [junit] // Submits the form to the action specified. [junit] function submitMainForm( action, checkRequiredFields ) { [junit] mainForm.action = action; [junit] mainForm.submit(); [junit] disablePage(); [junit] } [junit] // This method is only called in the body.onload event. It simply [junit] // executes any commands that have been pushed onto the onLoadList. [junit] var onLoadList = new Array(); [junit] function runOnLoadList() { [junit] for( var i = 0; i < onLoadList.length; i++ ) { [junit] window.execScript( onLoadList[i] ); [junit] } [junit] } [junit] </script> [junit] </head> [junit] <body onload="runOnLoadList();"> [junit] <form name="mainForm" method="get"> [junit] <table border="0" cellpadding="0" cellspacing="0" height="100%"> [junit] <tr> [junit] <td rowspan="4" width="10px;" class="color1">   ;</td> [junit] <td height="40" valign="bottom" width="100%"> [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] <!-- begin templates._topPanel_jsp_0 --> [junit] <table width="100%" border="0" cellpadding="0" cellspacing="0"> [junit] <tr> [junit] <td class="logo">Automated Plasma Dispositioning System (APDS)</td> [junit] <td align="right" valign="bottom"> [junit] [junit] <a href="logout.action">Logout</a> [junit] [junit] </td> [junit] </tr> [junit] <tr> [junit] <td colspan="2" height="4px;" class="color2"></td> [junit] </tr> [junit] <tr> [junit] <td colspan="2" height="1px;"></td> [junit] </tr> [junit] <tr> [junit] <td colspan="2" height="2px;" class="color2"></td> [junit] </tr> [junit] </table> [junit] </td> [junit] </tr> [junit] <tr> [junit] <td valign="top"> [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] <!-- begin templates._systemMessages_jsp_0 --> [junit] <br><br> [junit] <table border="0" cellpadding="2" cellspacing="1" width="95%" class ="color2" align="center"> [junit] <tr> [junit] <th align="center" style="background-color:#CCCCCC;"><st rong>System Messages</strong></th> [junit] </tr> [junit] <tr> [junit] <td bgcolor="#FFFFFF"> [junit] <div style="height: 30px; overflow: auto;"> [junit] <ul> [junit] [junit] <li>Login successful for user name apds.</li> [junit] [junit] <li>Welcome APDS Test Us er.</li> [junit] [junit] <li>User Locale is en.</ li> [junit] [junit] </ul> [junit] </div> [junit] </td> [junit] </tr> [junit] </table> [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] <!-- begin views._SYS01001_jsp_0 --> [junit] <table width="100%" border="0" cellpadding="20" cellspacing="0"> [junit] <tr> [junit] <td valign="top"> [junit] <table border="0" cellpadding="0" cellsp acing="0" width="100%"> [junit] <tr> [junit] <td colspan="2"><h1>Main Menu</h1></td> [junit] </tr> [junit] <tr> [junit] <td colspan="2" height=" 2" class="color2"></td> [junit] </tr> [junit] </table> [junit] Welcome to the Baxter BioScience Automat ed Plasma Dispositioning System (APDS). Please begin by selecting one of the cho ices below.<br> [junit] <br> [junit] <table border="0" cellpadding="0" cellsp acing="0" align="center" width="50%"> [junit] <tr> [junit] <td valign="top"> [junit] <ul> [junit] [junit] <li><a href="REC00001.view">Receiving Menu</a></li> [junit] [junit] [junit] <li><a href="TST00001.view">Testing Menu</a></li> [junit] [junit] [junit] <li><a href="DSP00001.view">Dispositioning Menu</a></li> [junit] [junit] [junit] <li><a href="DEF00001.view">Deferral Menu</a></li> [junit] [junit] [junit] <li><a href="RPT00001.view">Reports Menu</a></li> [junit] [junit] [junit] <li><a href="CFG00001.view">Configuration Menu</a></li> [junit] [junit] [junit] <li><a href="UTL00001.view">Utility Menu</a></li> [junit] [junit] </ul> [junit] </td> [junit] </tr> [junit] </table> [junit] </td> [junit] </tr> [junit] </table> [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] <!-- begin templates._esig_jsp_0 --> [junit] </td> [junit] </tr> [junit] <tr> [junit] <td height="25" valign="bottom" width="100%"> [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] <!-- begin templates._bottomPanel_jsp_0 --> [junit] <table width="100%" border="0" cellpadding="0" cellspacing="0"> [junit] <tr> [junit] <td height="2px;" class="color2"></td> [junit] </tr> [junit] <tr> [junit] <td height="1px;"></td> [junit] </tr> [junit] <tr> [junit] <td height="4px;" class="color2"></td> [junit] </tr> [junit] <tr> [junit] <td height="2px;"></td> [junit] </tr> [junit] <tr> [junit] <td align="right"> [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] </td> [junit] </tr> [junit] </table> [junit] </td> [junit] </tr> [junit] <tr> [junit] <td height="50"><br></td> [junit] </tr> [junit] </table> [junit] </form> [junit] </body> [junit] </html> [junit] ] [junit] org.apache.cactus.util.ChainedRuntimeException: Failed to get the te st results. This is probably due to an error that happened on the server side wh en trying to execute the tests. Here is what was returned by the server : [ [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] <!-- begin templates._main_jsp_0 --> [junit] <html> [junit] <head> [junit] <title>APDS: SYS01001 Main Menu</title> [junit] <META http-equiv="Expires" content="0"> [junit] <link rel=stylesheet href="apds.css" type="text/css"> [junit] <script src="javaScript/disablePage.js"></script> [junit] <script language="JavaScript"> [junit] // Submits the form to the action specified. [junit] function submitMainForm( action, checkRequiredFields ) { [junit] mainForm.action = action; [junit] mainForm.submit(); [junit] disablePage(); [junit] } [junit] // This method is only called in the body.onload event. It simply [junit] // executes any commands that have been pushed onto the onLoadList. [junit] var onLoadList = new Array(); [junit] function runOnLoadList() { [junit] for( var i = 0; i < onLoadList.length; i++ ) { [junit] window.execScript( onLoadList[i] ); [junit] } [junit] } [junit] </script> [junit] </head> [junit] <body onload="runOnLoadList();"> [junit] <form name="mainForm" method="get"> [junit] <table border="0" cellpadding="0" cellspacing="0" height="100%"> [junit] <tr> [junit] <td rowspan="4" width="10px;" class="color1">   ;</td> [junit] <td height="40" valign="bottom" width="100%"> [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] <!-- begin templates._topPanel_jsp_0 --> [junit] <table width="100%" border="0" cellpadding="0" cellspacing="0"> [junit] <tr> [junit] <td class="logo">Automated Plasma Dispositioning System (APDS)</td> [junit] <td align="right" valign="bottom"> [junit] [junit] <a href="logout.action">Logout</a> [junit] [junit] </td> [junit] </tr> [junit] <tr> [junit] <td colspan="2" height="4px;" class="color2"></td> [junit] </tr> [junit] <tr> [junit] <td colspan="2" height="1px;"></td> [junit] </tr> [junit] <tr> [junit] <td colspan="2" height="2px;" class="color2"></td> [junit] </tr> [junit] </table> [junit] </td> [junit] </tr> [junit] <tr> [junit] <td valign="top"> [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] <!-- begin templates._systemMessages_jsp_0 --> [junit] <br><br> [junit] <table border="0" cellpadding="2" cellspacing="1" width="95%" class ="color2" align="center"> [junit] <tr> [junit] <th align="center" style="background-color:#CCCCCC;"><st rong>System Messages</strong></th> [junit] </tr> [junit] <tr> [junit] <td bgcolor="#FFFFFF"> [junit] <div style="height: 30px; overflow: auto;"> [junit] <ul> [junit] [junit] <li>Login successful for user name apds.</li> [junit] [junit] <li>Welcome APDS Test Us er.</li> [junit] [junit] <li>User Locale is en.</ li> [junit] [junit] </ul> [junit] </div> [junit] </td> [junit] </tr> [junit] </table> [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] <!-- begin views._SYS01001_jsp_0 --> [junit] <table width="100%" border="0" cellpadding="20" cellspacing="0"> [junit] <tr> [junit] <td valign="top"> [junit] <table border="0" cellpadding="0" cellsp acing="0" width="100%"> [junit] <tr> [junit] <td colspan="2"><h1>Main Menu</h1></td> [junit] </tr> [junit] <tr> [junit] <td colspan="2" height=" 2" class="color2"></td> [junit] </tr> [junit] </table> [junit] Welcome to the Baxter BioScience Automat ed Plasma Dispositioning System (APDS). Please begin by selecting one of the cho ices below.<br> [junit] <br> [junit] <table border="0" cellpadding="0" cellsp acing="0" align="center" width="50%"> [junit] <tr> [junit] <td valign="top"> [junit] <ul> [junit] [junit] <li><a href="REC00001.view">Receiving Menu</a></li> [junit] [junit] [junit] <li><a href="TST00001.view">Testing Menu</a></li> [junit] [junit] [junit] <li><a href="DSP00001.view">Dispositioning Menu</a></li> [junit] [junit] [junit] <li><a href="DEF00001.view">Deferral Menu</a></li> [junit] [junit] [junit] <li><a href="RPT00001.view">Reports Menu</a></li> [junit] [junit] [junit] <li><a href="CFG00001.view">Configuration Menu</a></li> [junit] [junit] [junit] <li><a href="UTL00001.view">Utility Menu</a></li> [junit] [junit] </ul> [junit] </td> [junit] </tr> [junit] </table> [junit] </td> [junit] </tr> [junit] </table> [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] <!-- begin templates._esig_jsp_0 --> [junit] </td> [junit] </tr> [junit] <tr> [junit] <td height="25" valign="bottom" width="100%"> [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] <!-- begin templates._bottomPanel_jsp_0 --> [junit] <table width="100%" border="0" cellpadding="0" cellspacing="0"> [junit] <tr> [junit] <td height="2px;" class="color2"></td> [junit] </tr> [junit] <tr> [junit] <td height="1px;"></td> [junit] </tr> [junit] <tr> [junit] <td height="4px;" class="color2"></td> [junit] </tr> [junit] <tr> [junit] <td height="2px;"></td> [junit] </tr> [junit] <tr> [junit] <td align="right"> [junit] [junit] [junit] [junit] [junit] [junit] [junit] [junit] </td> [junit] </tr> [junit] </table> [junit] </td> [junit] </tr> [junit] <tr> [junit] <td height="50"><br></td> [junit] </tr> [junit] </table> [junit] </form> [junit] </body> [junit] </html> [junit] ] [junit] at org.apache.cactus.client.AbstractHttpClient.dispatch2_doTest( LogAspect.aj(1k):120) [junit] at org.apache.cactus.client.AbstractHttpClient.around2_doTest(Lo gAspect.aj(1k):1218) [junit] at org.apache.cactus.client.AbstractHttpClient.doTest(LogAspect. aj(1k):104) [junit] at org.apache.cactus.AbstractWebTestCase.runGenericTest(Abstract WebTestCase.java:260) [junit] at org.apache.cactus.ServletTestCase.runTest(ServletTestCase.jav a:133) [junit] at org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.j ava:195) [junit] org.apache.cactus.client.ParsingException: Not a valid response [junit] at org.apache.cactus.client.WebTestResultParser.readRootElement( LogAspect.aj(1k):140) [junit] at org.apache.cactus.client.WebTestResultParser.dispatch29_parse (LogAspect.aj(1k):101) [junit] at org.apache.cactus.client.WebTestResultParser.around29_parse(L ogAspect.aj(1k):1218) [junit] at org.apache.cactus.client.WebTestResultParser.parse(LogAspect. aj(1k):96) [junit] at org.apache.cactus.client.AbstractHttpClient.callGetResult(Log Aspect.aj(1k):230) [junit] at org.apache.cactus.client.AbstractHttpClient.dispatch2_doTest( LogAspect.aj(1k):114) [junit] at org.apache.cactus.client.AbstractHttpClient.around2_doTest(Lo gAspect.aj(1k):1218) [junit] at org.apache.cactus.client.AbstractHttpClient.doTest(LogAspect. aj(1k):104) [junit] at org.apache.cactus.AbstractWebTestCase.runGenericTest(Abstract WebTestCase.java:260) [junit] at org.apache.cactus.ServletTestCase.runTest(ServletTestCase.jav a:133) [junit] at org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.j ava:195) [junit] Testcase: testAPDSLogin BUILD FAILED file:C:/workingprojects/Baxter/APDS/cactustest/src/client/bin/build.xml:477: Tes t com.baxter.apds.test.cactus.TestAll failed -- Eric Garza [EMAIL PROTECTED] -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
