You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Gustavo Henrique <gu...@gmail.com> on 2010/06/05 15:57:31 UTC

Testing wicket pages in project with maven structure

Hi!
I'm trying using WicketTester but I got an error:
org.apache.wicket.markup.MarkupNotFoundException: Markup of type 'html' for
component 'br.com.ecommerce.wicket.pages.ContactPage' not found.

I changed the html dir using the trick with PathStripperLocator class and
this works. But the test not found the html pages.
My WicketApplication class:
@Override
    protected void init() {
        super.init();
        IResourceSettings resourceSettings = getResourceSettings();
        resourceSettings.addResourceFolder("/WEB-INF/html");
        resourceSettings.setResourceStreamLocator(new
PathStripperLocator());
    }

My simple test page in src/test/java:

public class ContactPageTest extends TestCase {
       private WicketTester tester;
       public void setUp() {
          tester = new WicketTester(new WicketApplication());
       }

       public void testMyPageBasicRender() {
          tester.startPage(ContactPage.class);
          tester.assertRenderedPage(ContactPage.class);
       }
}

So how do I test a wicket page?

thanks!

Re: Testing wicket pages in project with maven structure

Posted by ali <sa...@hotmail.com>.
Hi,

I am also having the same problem. My wicket pages (.java files and .html
files) are in the same package e.g.  se.myapp.web.pages  etc.  And I don't
have any   src/main/webapp/WEB-INF/html   Directory in my workspace. 
Please help me to fix this problem.

Thanks
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Testing-wicket-pages-in-project-with-maven-structure-tp2244245p3005633.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Testing wicket pages in project with maven structure

Posted by Gustavo Henrique <gu...@gmail.com>.
I already tried that but failed. Only pass an instance of application class
to the tester don't work. Is need configure the pom.xml too or put the html
dir on build path.

I resolved configuring the pom.xml as:

           <resource>
                <filtering>false</filtering>
                <directory>src/main/webapp/WEB-INF/html</directory>
                <includes>
                    <include>**</include>
                </includes>
            </resource>

Thanks!

Re: Testing wicket pages in project with maven structure

Posted by Igor Vaynberg <ig...@gmail.com>.
pass an instance of your application class to the tester

-igor

On Sat, Jun 5, 2010 at 6:57 AM, Gustavo Henrique <gu...@gmail.com> wrote:
> Hi!
> I'm trying using WicketTester but I got an error:
> org.apache.wicket.markup.MarkupNotFoundException: Markup of type 'html' for
> component 'br.com.ecommerce.wicket.pages.ContactPage' not found.
>
> I changed the html dir using the trick with PathStripperLocator class and
> this works. But the test not found the html pages.
> My WicketApplication class:
> @Override
>    protected void init() {
>        super.init();
>        IResourceSettings resourceSettings = getResourceSettings();
>        resourceSettings.addResourceFolder("/WEB-INF/html");
>        resourceSettings.setResourceStreamLocator(new
> PathStripperLocator());
>    }
>
> My simple test page in src/test/java:
>
> public class ContactPageTest extends TestCase {
>       private WicketTester tester;
>       public void setUp() {
>          tester = new WicketTester(new WicketApplication());
>       }
>
>       public void testMyPageBasicRender() {
>          tester.startPage(ContactPage.class);
>          tester.assertRenderedPage(ContactPage.class);
>       }
> }
>
> So how do I test a wicket page?
>
> thanks!
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org