Help for JSFUnit
by Anil Langote
Hi All,
I am using JSFUnit to testing in my product. I want to get the requested
URL for eg
(http://localhost:8000/Facelets_R4/ServletTestRunner?suite=com.test.MyJS
FUnitTest&xsl=cactus-report.xsl)
I want this URL to do decide whether it is an JSFUnit request or other
request.
I tried same through FacesContext object like
String reqPath =
FacesContext.getCurrentInstance().getExternalContext().getRequestServlet
Path();
I am getting different string is there any way to get the following
string
"ServletTestRunner suite=com.test.MyJSFUnitTest&xsl=cactus-report.xsl"
Any thoughts?
Thanks
Anil
16 years, 2 months
session cookies
by Christian Achilli
Hallo,
I trying to test my webapp running on websphere 6.1. The application
requires form authentication.
The issue is that I cannot refer to the faces context from the jsfunit
session. In the log i see the message:
*
SessionContext.getIHttpSession: id ERIqL_LOZbBuMJRLxbpTVCE failed length
check against 27*
This message make me think that another session cookie is generated after
the WebConversationFactory.makeWebClient call and this one is not added to
the list.
My client test code is as follow:
public void testInitialPage() throws IOException, SAXException
{
WebClientSpec wcSpec = new
WebClientSpec("/homePage.faces",BrowserVersion.INTERNET_EXPLORER_7_0);
wcSpec.getWebClient().setThrowExceptionOnScriptError(false);
FormAuthenticationStrategy formAuth = new
FormAuthenticationStrategy("appl2", "appl2");
formAuth.setSubmitComponent("login_button");
wcSpec.setInitialRequestStrategy(formAuth);
JSFSession jsfSession = new JSFSession(wcSpec);
wcSpec.addCookie("JSESSIONID", session.getId());
WebWindow currentWindow =
jsfSession.getWebClient().getCurrentWindow();// sono in chooseRole
System.out.println("Pagina corrente: "+currentWindow.getName());
JSFClientSession client = jsfSession.getJSFClientSession();
System.out.println(client.getPageAsText());
JSFServerSession *server *= jsfSession.getJSFServerSession();
}
Either clientIDs and currentFacesContext are null in *server* object.
Any idea? Thanks.
Christian
16 years, 2 months