Hi Omer,

Sorry for the delay in answering your question. I've no experience
testing portlets or Pluto for that matter.

Does it help to set the working form
(http://jwebunit.sourceforge.net/apidocs/net/sourceforge/jwebunit/WebTester.html#setWorkingForm(java.lang.String))
before issuing the submit?

I do have some remarks regarding your testcase:

I'd use the following naming / suite building conventions rather than
yours as it is more conforming to the junit way of doing things:

public static Test suite()
{
    TestSuite suite = new TestSuite();
    suite.addSuite(UserGroups.class);
    return suite;
}

public void testLinkUserGroups() throws Exception
{

  HttpUnitOptions.setExceptionsThrownOnScriptError(false);  
  beginAt("/");
  assertFormPresent("login");
  assertFormElementPresent("username");
  assertFormElementPresent("password");
  setFormElement("username","ben");
  setFormElement("password","password");
  submit(); 
  //assertFormNotPresent("login");
}


Omer Mahmood wrote:

>I am trying to test a portlet based web application (uses the Pluto
>portlet container) with jWebUnit. I have created a separate project in
>NetBeans that contains testing sources. In theory, if I have my web
>application running at:
>http://localhost:8080/intelligentsia/portal/Infoflow I should be able to
>supply this url as the base context of my WebTestCase. This works, but I
>can't seem to use jWebUnit to navigate/drive my web application. The
>following code might help to illustrate my problem better: 
>
>
>public void setUp() throws Exception
>{
> 
>getTestContext().setBaseUrl("http://localhost:8080/intelligentsia/portal
>/Infoflow");
>}
>    
>public static void main(String args[])
>{       
>  junit.textui.TestRunner.run(suite());
>}
>    
>public static Test suite()
>{
> TestSuite suite = new TestSuite();
> TestCase t1 = new UserGroups("linkUserGroups");
> suite.addTest(t1);   
> return suite;
>}
>    
>    
>public void linkUserGroups() throws Exception
>{
>  HttpUnitOptions.setExceptionsThrownOnScriptError(false);  
>  beginAt("/");
>  assertFormPresent("login");
>  assertFormElementPresent("username");
>  assertFormElementPresent("password");
>  setFormElement("username","ben");
>  setFormElement("password","password");
>  submit(); 
>  //assertFormNotPresent("login");  
>}
> 
>
>The testcase linkUserGroups() seems to work since no exceptions are
>thrown, i.e. my form and it's elements are present. However submitting
>this form should take the user to a new portlet views and hence
>different HTML source. When I dumpResponse(); I get the same HTML source
>before and after submitting the form, this would indicate the portlet
>views have not changed.
>
>I got the impression that jWebUnit could navigate through any web
>application/site, provided the base context url existed and could be
>connected to. Has anyone had experience testing a Pluto portlet based
>web application with jWebUnit or is there a more appropriate framework
>out there? I've looked at SourceForge PortletUnit but it's not as
>high-level and supposedly easy to use as jWebUnit. Any
>comments/suggestions would be greatly received!!
>
>Cheers,
>
>Omer.
>
>
>-------------------------------------------------------
>SF email is sponsored by - The IT Product Guide
>Read honest & candid reviews on hundreds of IT Products from real users.
>Discover which products truly live up to the hype. Start reading now.
>http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
>_______________________________________________
>Jwebunit-users mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/jwebunit-users
>
>  
>



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Jwebunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to