Re: Wicket tester and jquery-ui dialog
Hello All, With the help of Sebastien I was able to create POC [1] [2] and was able to test wicket-jquery-ui dialog using wicket tester Hope this will be useful :) [1] https://github.com/apache/openmeetings/blob/3.2.x/ openmeetings-web/src/test/java/org/apache/openmeetings/ test/AbstractWicketTester.java#L64 [2] https://github.com/apache/openmeetings/blob/3.2.x/ openmeetings-web/src/test/java/org/apache/openmeetings/ test/web/LoginUI.java#L70 On Mon, Jan 23, 2017 at 5:28 PM, Sebastienwrote: > Hi Maxim, > > The only related thread I found is a mail entitled "WicketTester and > Wicket jQuery UI" on d...@openmeetings.apache.org (from 14/09/2013). I > cannot find the markmail archive however... > There is no crucial information though. I will forward it to you directly > to not spam users@wicket. Please tell me if/when you ended with something > useful! :) > > Thanks & best regards, > Sebastien. > > > On Mon, Jan 23, 2017 at 4:54 AM, Maxim Solodovnik > wrote: > >> Hello Sebastien, >> >> I do remember were there some questions on the topic, but unfortunately I >> was unable to find the discussion, >> Could you please tell me or maybe send a link to the example on how >> wickek-jquery-ui dialog can be pressed using wicket tester? >> >> Thanks in advance! >> >> -- >> WBR >> Maxim aka solomax >> > > -- WBR Maxim aka solomax
Re: Wicket tester and jquery-ui dialog
Hi Maxim, The only related thread I found is a mail entitled "WicketTester and Wicket jQuery UI" on d...@openmeetings.apache.org (from 14/09/2013). I cannot find the markmail archive however... There is no crucial information though. I will forward it to you directly to not spam users@wicket. Please tell me if/when you ended with something useful! :) Thanks & best regards, Sebastien. On Mon, Jan 23, 2017 at 4:54 AM, Maxim Solodovnikwrote: > Hello Sebastien, > > I do remember were there some questions on the topic, but unfortunately I > was unable to find the discussion, > Could you please tell me or maybe send a link to the example on how > wickek-jquery-ui dialog can be pressed using wicket tester? > > Thanks in advance! > > -- > WBR > Maxim aka solomax >
Re: Wicket tester and mounted resources
Hi, On Aug 9, 2016 10:45 AM, "giacomolm"wrote: > > Hi Martin, > thanks for your reply. As you confirmed, mounted resources are available to > the wicket tester instance. > > What if I want to expose again those endpoints outside the tester > application? > > It would be great if wicket tester can re-expose such resources: on this way > I can interact with them using ajax requests. Of course an URL must exists > for each mount point. You could the correct url with lastRenderedPage.urlFor(TheResRef.class, pageParameters). Then you can make a request with tester.executeUrl(...). Is this what you need? > > -- > View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-tester-and-mounted-resources-tp4675288p4675290.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org >
Re: Wicket tester and mounted resources
Hi Martin, thanks for your reply. As you confirmed, mounted resources are available to the wicket tester instance. What if I want to expose again those endpoints outside the tester application? It would be great if wicket tester can re-expose such resources: on this way I can interact with them using ajax requests. Of course an URL must exists for each mount point. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-tester-and-mounted-resources-tp4675288p4675290.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket tester and mounted resources
Hi, If you use YourApplication when creating the WicketTester then those resources are already mounted for all your tests. If you use (the default) MockApplication then you'll need to mount those resource references with tester.getApplication().mountResource(...) when needed. Then you can use tester.startResourceReference(...) to make requests to them. On Aug 9, 2016 12:34 AM, "giacomolm"wrote: > Hi, > I created a wicket application with some resources mounted during > initialization. When I deploy the application in Tomcat, I can easily reach > those endpoints. > > Now i'm creating some tests and I'm using wicket tester. When I run those > tests, is there a way to reach those endpoints? > > From my understanding wicket tester doesn't need to deploy that > application, > but I need to reach some endpoints from a frontend application. > > -- > View this message in context: http://apache-wicket.1842946. > n4.nabble.com/Wicket-tester-and-mounted-resources-tp4675288.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: Wicket Tester with BookmarkablePageLink
Thanks mate. Works fine now :) -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Tester-with-BookmarkablePageLink-tp4656921p4657091.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket Tester with BookmarkablePageLink
Hi Vineet, tried it out. My setup() method now looks like this: @Before public void setUp() { MockitoAnnotations.initMocks(this); app = new StartApplication() { @Override public ServletContext getServletContext() { ServletContext servletContext = super.getServletContext(); ApplicationContextMock appctx = new ApplicationContextMock(); Service service = Mockito.mock(Service.class); appctx.putBean(service); WebApplication application = new MockApplication(); WicketTester tester = new WicketTester(application); SpringComponentInjector componentInjector = new SpringComponentInjector( tester.getApplication(), appctx, false); tester.getApplication().getComponentInstantiationListeners() .add(componentInjector); return servletContext; } }; org.apache.log4j.Logger logger = org.apache.log4j.Logger .getLogger(org.apache.wicket.util.tester); logger.setLevel(Level.DEBUG); tester = new WicketTester(app); } But when I run the test, I get: java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered? at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:90) at org.apache.wicket.spring.injection.annot.SpringComponentInjector.init(SpringComponentInjector.java:81) at com.index.StartApplication.init(StartApplication.java:16) at org.apache.wicket.Application.initApplication(Application.java:818) at org.apache.wicket.util.tester.BaseWicketTester.init(BaseWicketTester.java:287) at org.apache.wicket.util.tester.BaseWicketTester.init(BaseWicketTester.java:231) at org.apache.wicket.util.tester.WicketTester.init(WicketTester.java:184) at com.customer.web.AbstractBasePageTester.setUp(AbstractBasePageTester.java:71) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.mockito.internal.runners.JUnit45AndHigherRunnerImpl.run(JUnit45AndHigherRunnerImpl.java:37) at org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Tester-with-BookmarkablePageLink-tp4656921p4657053.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket Tester with BookmarkablePageLink
Sure, this is the test code: public class AbstractBasePageTester { private WicketTester tester; private StartApplication app; @Mock private CustomerService aService; @Before public void setUp() { MockitoAnnotations.initMocks(this); app = new StartApplication() { @Override public ServletContext getServletContext() { ServletContext servletContext = super.getServletContext(); XmlWebApplicationContext applicationContext = new XmlWebApplicationContext(); applicationContext .setConfigLocation(classpath:applicationContext.xml); applicationContext.setServletContext(servletContext); // applicationContext.refresh(); servletContext .setAttribute( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, applicationContext); return servletContext; } }; org.apache.log4j.Logger logger = org.apache.log4j.Logger .getLogger(org.apache.wicket.util.tester); logger.setLevel(Level.DEBUG); tester = new WicketTester(app); } @Test public void homepageRendersSuccessfully() { // start and render the test page tester.startPage(Start.class); tester.assertRenderedPage(Start.class); tester.assertNoErrorMessage(); tester.debugComponentTrees(); tester.assertComponent(createCustomerLink, BookmarkablePageLink.class); tester.assertComponent(showCustomersLink, BookmarkablePageLink.class); tester.clickLink(createCustomerLink); } } And this the normal code: public class Start extends WebPage { public Start() { BookmarkablePageLinkCreateCustomer customerLink = new BookmarkablePageLinkCreateCustomer( createCustomerLink, CreateCustomer.class); customerLink.add(new Label(createCustomerLabel, getString(createCustomerLabel))); add(customerLink); BookmarkablePageLinkShowCustomers showCustomersLink = new BookmarkablePageLinkShowCustomers( showCustomersLink, ShowCustomers.class); showCustomersLink.add(new Label(showCustomersLabel, getString(showCustomersLabel))); add(showCustomersLink); } } public class StartApplication extends WebApplication { @Override public ClassStart getHomePage() { return Start.class; } @Override protected void init() { super.init(); SpringComponentInjector springComponentInjector = new SpringComponentInjector( this); getComponentInstantiationListeners().add(springComponentInjector); } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Tester-with-BookmarkablePageLink-tp4656921p4656954.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket tester failing in CI but not locally
Someone seems to change this, but i dodn't found an example how to solve it correctly until now. Kim had the problem some days ago to. Seems that yoiu have to add ComponentInstListener to TestApplication to. Why this was working before and not anymore - i don't know. Here is what he wrote Okay, Got my test green:-) Here it is: package be.thomascook.ui.pages.admin; import be.thomascook.wicket.component.WicketFilter; import org.apache.wicket.spring.injection.annot.SpringComponentInjector; import org.apache.wicket.util.tester.WicketTester; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; import org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests; import org.springframework.transaction.annotation.Transactional; import org.testng.annotations.Test; /** * @author Compi * @since 10-mei-2010 */ @ContextConfiguration(locations = { /applicationContext-dao.xml, /applicationContext-service.xml, /applicationContext-database.xml}) @Transactional public class UserListPageTest extends AbstractTransactionalTestNGSpringContextTests { @Autowired private ApplicationContext applicationContext; @Autowired protected WicketFilter wicketApplication; @Test public void labelContainsHelloWorld() { WicketTester tester=new WicketTester(); tester.getApplication().addComponentInstantiationListener(new SpringComponentInjector(tester.getApplication(), applicationContext, true )); tester.startPage(UserListPage.class); tester.assertNoErrorMessage(); tester.assertLabel(title, Users List); } } Kind regards, Kim - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket tester failing in CI but not locally
I'm not using spring. Would I still use that injector? I'm using guice.. D/ On May 18, 2010, at 1:46 AM, Per Newgro wrote: Someone seems to change this, but i dodn't found an example how to solve it correctly until now. Kim had the problem some days ago to. Seems that yoiu have to add ComponentInstListener to TestApplication to. Why this was working before and not anymore - i don't know. Here is what he wrote Okay, Got my test green:-) Here it is: package be.thomascook.ui.pages.admin; import be.thomascook.wicket.component.WicketFilter; import org.apache.wicket.spring.injection.annot.SpringComponentInjector; import org.apache.wicket.util.tester.WicketTester; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; import org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests; import org.springframework.transaction.annotation.Transactional; import org.testng.annotations.Test; /** * @author Compi * @since 10-mei-2010 */ @ContextConfiguration(locations = { /applicationContext-dao.xml, /applicationContext-service.xml, /applicationContext-database.xml}) @Transactional public class UserListPageTest extends AbstractTransactionalTestNGSpringContextTests { @Autowired private ApplicationContext applicationContext; @Autowired protected WicketFilter wicketApplication; @Test public void labelContainsHelloWorld() { WicketTester tester=new WicketTester(); tester.getApplication().addComponentInstantiationListener(new SpringComponentInjector(tester.getApplication(), applicationContext, true )); tester.startPage(UserListPage.class); tester.assertNoErrorMessage(); tester.assertLabel(title, Users List); } } Kind regards, Kim - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket tester failing in CI but not locally
I just did this: tester.getApplication().addComponentInstantiationListener(new GuiceComponentInjector(tester.getApplication())); On May 18, 2010, at 2:01 AM, Douglas Ferguson wrote: I'm not using spring. Would I still use that injector? I'm using guice.. D/ On May 18, 2010, at 1:46 AM, Per Newgro wrote: Someone seems to change this, but i dodn't found an example how to solve it correctly until now. Kim had the problem some days ago to. Seems that yoiu have to add ComponentInstListener to TestApplication to. Why this was working before and not anymore - i don't know. Here is what he wrote Okay, Got my test green:-) Here it is: package be.thomascook.ui.pages.admin; import be.thomascook.wicket.component.WicketFilter; import org.apache.wicket.spring.injection.annot.SpringComponentInjector; import org.apache.wicket.util.tester.WicketTester; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; import org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests; import org.springframework.transaction.annotation.Transactional; import org.testng.annotations.Test; /** * @author Compi * @since 10-mei-2010 */ @ContextConfiguration(locations = { /applicationContext-dao.xml, /applicationContext-service.xml, /applicationContext-database.xml}) @Transactional public class UserListPageTest extends AbstractTransactionalTestNGSpringContextTests { @Autowired private ApplicationContext applicationContext; @Autowired protected WicketFilter wicketApplication; @Test public void labelContainsHelloWorld() { WicketTester tester=new WicketTester(); tester.getApplication().addComponentInstantiationListener(new SpringComponentInjector(tester.getApplication(), applicationContext, true )); tester.startPage(UserListPage.class); tester.assertNoErrorMessage(); tester.assertLabel(title, Users List); } } Kind regards, Kim - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket tester failing in CI but not locally
Upps, sorry. Didn't recognized guice. I would try to add it appropriatly to this way public class MyApplicationextends WebApplication{ protected void init() { addComponentInstantiationListener( new GuiceComponentInjector(this, getModule()) ); } private Module getModule() { return new Module() { public void configure(Binder binder) { binder.bind(IService.class).to(Service.class); } }; } } Cheers Per
Re: wicket tester failing in CI but not locally
Is it the working solution? Cheers Per - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket tester failing in CI but not locally
No.. I realized that the tests are running in parallel on hudson but from eclipse. Since the application is bound to a thread local, then it fails. D/ On May 18, 2010, at 2:18 AM, Per Newgro wrote: Is it the working solution? Cheers Per - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket tester failing in CI but not locally
Sorry but more i can't do. Im not an hudson user. Cheers Per - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket tester failing in CI but not locally
The problem is not a hudson problem. The problem is that wicket tester tests do not want to be run in parallel. D/ On May 18, 2010, at 2:38 AM, Per Newgro wrote: Sorry but more i can't do. Im not an hudson user. Cheers Per - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket tester failing in CI but not locally
if you want the tests to run in parallel you have to create a wicket tester inside every test method instead of just once per class. that way the threadlocal is set into every thread. -igor On Tue, May 18, 2010 at 1:49 AM, Douglas Ferguson doug...@douglasferguson.us wrote: The problem is not a hudson problem. The problem is that wicket tester tests do not want to be run in parallel. D/ On May 18, 2010, at 2:38 AM, Per Newgro wrote: Sorry but more i can't do. Im not an hudson user. Cheers Per - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket Tester
Hi! You must create wickettester with your application. wickettester = new WicketTester(new MyApplication()); 2010/3/31 Svante Reutland svantepo...@hotmail.com: Hi!im trying to run wicket tester on my application. but I cannot get it to work.this is what I have done so far: WicketTester tester = new WicketTester(); tester.startPage(Login.class); FormTester formTester = tester.newFormTester(loginForm); formTester.setValue(username, admin); formTester.setValue(password, password); formTester.submit(); and it gives me an error: cant instantiate constructor and org.apache.wicket.protocol.http.WebSession cannot be cast to se.project.ui.MySession anyone have any experience with Wicket tester? Best RegardsSvante _ Mejla på krogen! Hotmail i mobilen. http://new.windowslivemobile.msn.com/SE-SE/windows-live-hotmail/default.aspx - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket Tester
lol why didnt I see that. must be the lack of coffe ;) Thanks for your help! -- View this message in context: http://old.nabble.com/Wicket-Tester-tp28094649p28094705.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket tester forms
Report in jira 2010/1/6 Douglas Ferguson doug...@douglasferguson.us: I just found an issue in wicket tester. If you submit a form with hidden fields it will attempt to set the models on those hidden fields. My app depends on this. D/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket tester forms
With quickstart example that can reproduce the problem 2010/1/6 Martin Makundi martin.maku...@koodaripalvelut.com: Report in jira 2010/1/6 Douglas Ferguson doug...@douglasferguson.us: I just found an issue in wicket tester. If you submit a form with hidden fields it will attempt to set the models on those hidden fields. My app depends on this. D/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket tester forms
I found more such problems. All described here: http://paulszulc.wordpress.com/2009/08/03/wicket-testing-pitfalls-and-api-issues/ On Wed, Jan 6, 2010 at 7:28 AM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: With quickstart example that can reproduce the problem 2010/1/6 Martin Makundi martin.maku...@koodaripalvelut.com: Report in jira 2010/1/6 Douglas Ferguson doug...@douglasferguson.us: I just found an issue in wicket tester. If you submit a form with hidden fields it will attempt to set the models on those hidden fields. My app depends on this. D/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Best regards, Paul Szulc http://paulszulc.wordpress.com
Re: Wicket tester login pages
Hi! Depends on your login but ofcourse wicket is a whitebox so you can inject any credentials you want. But visit the login page first to create session. ** Martin 2010/1/4 Pierre Goupil goupilpie...@gmail.com: Hello all, Is there a way to access directly a page in Wicket tester? I mean: by-passing the login page in order not to execute the whole workflow leading to a certain page. We use, of course, @AuthorizedInstantiation-based login. We've found examples where people provide directly the credentials to the login form and then browse to the desired page, but I was wondering whether something more direct existed. Regards, Pierre -- Ad augusta per angusta Des résultats grandioses par des voies étroites - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket tester login pages
We use @AuthorizedInstantiation. But what we're looking for is not a way to inject the credentials but rather a way to access directly a protected page in unit tests. We know how to provide credentials and browse to the page but find it dangerous: what if the credentials change, what if the Website layout changes... ? Regards, Pierre On Mon, Jan 4, 2010 at 12:36 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: Hi! Depends on your login but ofcourse wicket is a whitebox so you can inject any credentials you want. But visit the login page first to create session. ** Martin 2010/1/4 Pierre Goupil goupilpie...@gmail.com: Hello all, Is there a way to access directly a page in Wicket tester? I mean: by-passing the login page in order not to execute the whole workflow leading to a certain page. We use, of course, @AuthorizedInstantiation-based login. We've found examples where people provide directly the credentials to the login form and then browse to the desired page, but I was wondering whether something more direct existed. Regards, Pierre -- Ad augusta per angusta Des résultats grandioses par des voies étroites - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Ad augusta per angusta Des résultats grandioses par des voies étroites
Re: Wicket tester login pages
You probably store the credentials (or isAuthenticated() == true) in the session. Just set the credentials *on* your session during testing. Martijn On Mon, Jan 4, 2010 at 12:32 PM, Pierre Goupil goupilpie...@gmail.com wrote: Hello all, Is there a way to access directly a page in Wicket tester? I mean: by-passing the login page in order not to execute the whole workflow leading to a certain page. We use, of course, @AuthorizedInstantiation-based login. We've found examples where people provide directly the credentials to the login form and then browse to the desired page, but I was wondering whether something more direct existed. Regards, Pierre -- Ad augusta per angusta Des résultats grandioses par des voies étroites -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.4 increases type safety for web applications Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket tester test coverage
If the element is not in a loop, just specify the HTML ID in the template. If it is in a loop, use xpath. oh. Thanks :$ I thought wicket id were incremeting on request, meaning that even without loop the same page loaded twice would end up with a different id (with an incremented number). I should test it ! zedros wrote: on a broader picture, my main question was about the way you proceed, Do you test every page, including every validator or.. ? If doing so, for pages that quite often are then not touched much, i would fear the time needed for proper testing quite hard to justify. Am i wrong here ? I test my code based on risk. If it is the code that is frequently use, has a high impact if it breaks, or is likely to contain bugs, I'll test it more thoroughly. ok, thanks for this explanation :) have a good day zedros - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket tester test coverage
zedros wrote: I saw it, but we're using guice (when, it wouldn't be a show stopper in the end). Still, on the technical side, there's also this issue with selenium using mostly id, whereas wicket'ids change with each request... How do you solve this issue ? If the element is not in a loop, just specify the HTML ID in the template. If it is in a loop, use xpath. zedros wrote: on a broader picture, my main question was about the way you proceed, Do you test every page, including every validator or.. ? If doing so, for pages that quite often are then not touched much, i would fear the time needed for proper testing quite hard to justify. Am i wrong here ? I test my code based on risk. If it is the code that is frequently use, has a high impact if it breaks, or is likely to contain bugs, I'll test it more thoroughly. - -- Kent Tong Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net) -- View this message in context: http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26541425.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket tester test coverage
I use it, and what I'm looking for is a mean to ensure my test coverage. On Wed, Nov 25, 2009 at 6:13 AM, Kent Tong k...@cpttm.org.mo wrote: Pierre Goupil wrote: So I'm looking for a way to list all Page instances in a Wicket app, which could then allow me to be sure that they are all covered by a test. And when it's done maybe I could use the same system in order to ensure that Selenium (the automated functional testing tool) has covered all my pages as well (more deeply). What you need is TDD. Once you adopt TDD, you will have every page tested. - -- Kent Tong Better way to unit test Wicket pages ( http://wicketpagetest.sourceforge.net) -- View this message in context: http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26507647.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Rien de grand ne s'est accompli dans le monde sans passion. (G.W.F. Hegel, philosophe allemand)
Re: Wicket tester test coverage
Hi Kent On Wed, Nov 25, 2009 at 6:13 AM, Kent Tong k...@cpttm.org.mo wrote: What you need is TDD. Once you adopt TDD, you will have every page tested. I was under the assumption that unit testing isn't valuable for GUI, esp. web gui, since the effort is too important... I think I even read uncle bob saying so. How do you suggest to write/do TDD for web pages ? thanks in advance ++ zedros - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket tester test coverage
Use Cobertura or similar. It will work for both your use cases and provide you with coverage metrics. -- Jeremy Thomerson http://www.wickettraining.com On Wed, Nov 25, 2009 at 2:23 AM, Pierre Goupil goupilpie...@gmail.comwrote: I use it, and what I'm looking for is a mean to ensure my test coverage. On Wed, Nov 25, 2009 at 6:13 AM, Kent Tong k...@cpttm.org.mo wrote: Pierre Goupil wrote: So I'm looking for a way to list all Page instances in a Wicket app, which could then allow me to be sure that they are all covered by a test. And when it's done maybe I could use the same system in order to ensure that Selenium (the automated functional testing tool) has covered all my pages as well (more deeply). What you need is TDD. Once you adopt TDD, you will have every page tested. - -- Kent Tong Better way to unit test Wicket pages ( http://wicketpagetest.sourceforge.net) -- View this message in context: http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26507647.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Rien de grand ne s'est accompli dans le monde sans passion. (G.W.F. Hegel, philosophe allemand)
Re: Wicket tester test coverage
Hi, What you can do is scan all Page classes (or Panel classes, etc) on the class-path and check if there are tests for them. Put this code in a unit test. Fail the test if you find a class without accompanying test. You can use this example to get started with the class path scanning: http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup Regards, Daan van Etten On Wed, 2009-11-25 at 09:23 +0100, Pierre Goupil wrote: I use it, and what I'm looking for is a mean to ensure my test coverage. On Wed, Nov 25, 2009 at 6:13 AM, Kent Tong k...@cpttm.org.mo wrote: Pierre Goupil wrote: So I'm looking for a way to list all Page instances in a Wicket app, which could then allow me to be sure that they are all covered by a test. And when it's done maybe I could use the same system in order to ensure that Selenium (the automated functional testing tool) has covered all my pages as well (more deeply). What you need is TDD. Once you adopt TDD, you will have every page tested. - -- Kent Tong Better way to unit test Wicket pages ( http://wicketpagetest.sourceforge.net) -- View this message in context: http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26507647.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket tester test coverage
Spring has a classpath scanner which you can copy and adapt to scan for pages and then try to instantiate them. The problem is often that pages don't have a default constructor, which is a problem if you want to instantiate them automagically. Martijn On Wed, Nov 25, 2009 at 12:57 AM, Pierre Goupil goupilpie...@gmail.com wrote: Guys, One thing that I like regarding Wicket tester is that it easily allows one to check a Page under design for any exception that it could throw at creation-time. Actually, doing such a basic test is for me essential, so as it takes only two lines of code, I systematically check all my pages this way. You know, the: // start and render the test page this.tester.startPage(HomePage.class); // assert rendered page class this.tester.assertRenderedPage(HomePage.class); thing. What I like so much with it is that any error which would occur when you load the page in FF / IE... occurs without leaving Eclipse and immediately. When the workflow to find the page in the browser is long and repetitive, it's a relief! BUT, when the number of pages grow, two related problems emerge: -you have to duplicate these two lines of code everytime, which is a (small) pain in itself -and you have no guarantee that you didn't forget any page, which is worst. So I'm looking for a way to list all Page instances in a Wicket app, which could then allow me to be sure that they are all covered by a test. And when it's done maybe I could use the same system in order to ensure that Selenium (the automated functional testing tool) has covered all my pages as well (more deeply). I could use a test coverage tool, but 1) it wouldn't work with Selenium 2) I don't want to generate a report, I want the test suit to fail if a Page is not covered by my test class. Could anyone suggest where to start, please? Regards, Pierre -- Rien de grand ne s'est accompli dans le monde sans passion. (G.W.F. Hegel, philosophe allemand) -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.4 increases type safety for web applications Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.0 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket tester test coverage
zedros wrote: I was under the assumption that unit testing isn't valuable for GUI, esp. web gui, since the effort is too important... I think I even read uncle bob saying so. How do you suggest to write/do TDD for web pages ? Without reference to his article, I can only guess that it may be pointless to test the position or the color of a button in automated tests. On the other hand, functionality of GUI can definitely be tested. For example, I am writing a Wicket application with TDD (sort of) with the library shown in my signature. It is working very well. - -- Kent Tong Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net) -- View this message in context: http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26509652.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket tester test coverage
In my other post I gave a link to a full-fledged example which scans for Panel classes with the default constructor and instantiates them. http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup This has almost no value (in my opinion) for reporting unit testing coverage. It only checks for exceptions and if the code matches the markup at instantiation. An exception could easily be thrown when replacing panels, clicking on a link or submitting a form. This is not tested. Regards, Daan van Etten On Wed, 2009-11-25 at 10:06 +0100, Martijn Dashorst wrote: Spring has a classpath scanner which you can copy and adapt to scan for pages and then try to instantiate them. The problem is often that pages don't have a default constructor, which is a problem if you want to instantiate them automagically. Martijn On Wed, Nov 25, 2009 at 12:57 AM, Pierre Goupil goupilpie...@gmail.com wrote: Guys, One thing that I like regarding Wicket tester is that it easily allows one to check a Page under design for any exception that it could throw at creation-time. Actually, doing such a basic test is for me essential, so as it takes only two lines of code, I systematically check all my pages this way. You know, the: // start and render the test page this.tester.startPage(HomePage.class); // assert rendered page class this.tester.assertRenderedPage(HomePage.class); thing. What I like so much with it is that any error which would occur when you load the page in FF / IE... occurs without leaving Eclipse and immediately. When the workflow to find the page in the browser is long and repetitive, it's a relief! BUT, when the number of pages grow, two related problems emerge: -you have to duplicate these two lines of code everytime, which is a (small) pain in itself -and you have no guarantee that you didn't forget any page, which is worst. So I'm looking for a way to list all Page instances in a Wicket app, which could then allow me to be sure that they are all covered by a test. And when it's done maybe I could use the same system in order to ensure that Selenium (the automated functional testing tool) has covered all my pages as well (more deeply). I could use a test coverage tool, but 1) it wouldn't work with Selenium 2) I don't want to generate a report, I want the test suit to fail if a Page is not covered by my test class. Could anyone suggest where to start, please? Regards, Pierre -- Rien de grand ne s'est accompli dans le monde sans passion. (G.W.F. Hegel, philosophe allemand) - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket tester test coverage
Ouch! It's exactly what my first point was trying to achieve. Thanx a lot! Now, I'll have to adapt it to Selenium. I'll try post it on your blog, Daan. Who said TDD?. I know that not so much is tested in this way be it's so exhaustive (regarding the total number of Pages / Components to check) plus it provide so fast feedback that I find it mandatory for whom wishes to do TDD in Wicket. Regards, Pierre On Wed, Nov 25, 2009 at 10:06 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: Spring has a classpath scanner which you can copy and adapt to scan for pages and then try to instantiate them. The problem is often that pages don't have a default constructor, which is a problem if you want to instantiate them automagically. Martijn On Wed, Nov 25, 2009 at 12:57 AM, Pierre Goupil goupilpie...@gmail.com wrote: Guys, One thing that I like regarding Wicket tester is that it easily allows one to check a Page under design for any exception that it could throw at creation-time. Actually, doing such a basic test is for me essential, so as it takes only two lines of code, I systematically check all my pages this way. You know, the: // start and render the test page this.tester.startPage(HomePage.class); // assert rendered page class this.tester.assertRenderedPage(HomePage.class); thing. What I like so much with it is that any error which would occur when you load the page in FF / IE... occurs without leaving Eclipse and immediately. When the workflow to find the page in the browser is long and repetitive, it's a relief! BUT, when the number of pages grow, two related problems emerge: -you have to duplicate these two lines of code everytime, which is a (small) pain in itself -and you have no guarantee that you didn't forget any page, which is worst. So I'm looking for a way to list all Page instances in a Wicket app, which could then allow me to be sure that they are all covered by a test. And when it's done maybe I could use the same system in order to ensure that Selenium (the automated functional testing tool) has covered all my pages as well (more deeply). I could use a test coverage tool, but 1) it wouldn't work with Selenium 2) I don't want to generate a report, I want the test suit to fail if a Page is not covered by my test class. Could anyone suggest where to start, please? Regards, Pierre -- Rien de grand ne s'est accompli dans le monde sans passion. (G.W.F. Hegel, philosophe allemand) -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.4 increases type safety for web applications Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.0 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Rien de grand ne s'est accompli dans le monde sans passion. (G.W.F. Hegel, philosophe allemand)
Re: Wicket tester test coverage
Pierre Goupil wrote: I use it, and what I'm looking for is a mean to ensure my test coverage. If you're using TDD, you will have developed the page and the unit test for that page at the same time and by definition you won't have a page that is not tested. - -- Kent Tong Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net) -- View this message in context: http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26509669.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket tester test coverage
Sure. But from the beginning, I was looking for a way not to write the famous 2 lines of code (see above) for each page and component. I'll have a look for sure at your lib, the Selenium integration is promising. :-) On Wed, Nov 25, 2009 at 10:25 AM, Kent Tong k...@cpttm.org.mo wrote: Pierre Goupil wrote: I use it, and what I'm looking for is a mean to ensure my test coverage. If you're using TDD, you will have developed the page and the unit test for that page at the same time and by definition you won't have a page that is not tested. - -- Kent Tong Better way to unit test Wicket pages ( http://wicketpagetest.sourceforge.net) -- View this message in context: http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26509669.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Rien de grand ne s'est accompli dans le monde sans passion. (G.W.F. Hegel, philosophe allemand)
Re: Wicket tester test coverage
Yeah, test coverage is a big word here. But as I said I was not looking for a way to generate a report, just a mean to have my test suit fail if 1) a page throws an exception at instantiation 2) a page has not been so tested. That's exactly what you did and I'm not surprised not to be the first one to wonder how to achieve this. Of course this test is pretty basic, but as it's totally automated, that's no big deal. You just have to know what is does and what its limits are. Reading your blog, I see that I made the same assumptions than you regarding that matter and that the need was the very same. On Wed, Nov 25, 2009 at 10:24 AM, Daan van Etten d...@stuq.nl wrote: In my other post I gave a link to a full-fledged example which scans for Panel classes with the default constructor and instantiates them. http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup This has almost no value (in my opinion) for reporting unit testing coverage. It only checks for exceptions and if the code matches the markup at instantiation. An exception could easily be thrown when replacing panels, clicking on a link or submitting a form. This is not tested. Regards, Daan van Etten On Wed, 2009-11-25 at 10:06 +0100, Martijn Dashorst wrote: Spring has a classpath scanner which you can copy and adapt to scan for pages and then try to instantiate them. The problem is often that pages don't have a default constructor, which is a problem if you want to instantiate them automagically. Martijn On Wed, Nov 25, 2009 at 12:57 AM, Pierre Goupil goupilpie...@gmail.com wrote: Guys, One thing that I like regarding Wicket tester is that it easily allows one to check a Page under design for any exception that it could throw at creation-time. Actually, doing such a basic test is for me essential, so as it takes only two lines of code, I systematically check all my pages this way. You know, the: // start and render the test page this.tester.startPage(HomePage.class); // assert rendered page class this.tester.assertRenderedPage(HomePage.class); thing. What I like so much with it is that any error which would occur when you load the page in FF / IE... occurs without leaving Eclipse and immediately. When the workflow to find the page in the browser is long and repetitive, it's a relief! BUT, when the number of pages grow, two related problems emerge: -you have to duplicate these two lines of code everytime, which is a (small) pain in itself -and you have no guarantee that you didn't forget any page, which is worst. So I'm looking for a way to list all Page instances in a Wicket app, which could then allow me to be sure that they are all covered by a test. And when it's done maybe I could use the same system in order to ensure that Selenium (the automated functional testing tool) has covered all my pages as well (more deeply). I could use a test coverage tool, but 1) it wouldn't work with Selenium 2) I don't want to generate a report, I want the test suit to fail if a Page is not covered by my test class. Could anyone suggest where to start, please? Regards, Pierre -- Rien de grand ne s'est accompli dans le monde sans passion. (G.W.F. Hegel, philosophe allemand) - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Rien de grand ne s'est accompli dans le monde sans passion. (G.W.F. Hegel, philosophe allemand)
Re: Wicket tester test coverage
Item 2 (fail if a page has not been tested) is not in my solution, but I'm glad I could help :-) Regards, Daan van Etten On Wed, 2009-11-25 at 10:32 +0100, Pierre Goupil wrote: Yeah, test coverage is a big word here. But as I said I was not looking for a way to generate a report, just a mean to have my test suit fail if 1) a page throws an exception at instantiation 2) a page has not been so tested. That's exactly what you did and I'm not surprised not to be the first one to wonder how to achieve this. Of course this test is pretty basic, but as it's totally automated, that's no big deal. You just have to know what is does and what its limits are. Reading your blog, I see that I made the same assumptions than you regarding that matter and that the need was the very same. On Wed, Nov 25, 2009 at 10:24 AM, Daan van Etten d...@stuq.nl wrote: In my other post I gave a link to a full-fledged example which scans for Panel classes with the default constructor and instantiates them. http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup This has almost no value (in my opinion) for reporting unit testing coverage. It only checks for exceptions and if the code matches the markup at instantiation. An exception could easily be thrown when replacing panels, clicking on a link or submitting a form. This is not tested. Regards, Daan van Etten On Wed, 2009-11-25 at 10:06 +0100, Martijn Dashorst wrote: Spring has a classpath scanner which you can copy and adapt to scan for pages and then try to instantiate them. The problem is often that pages don't have a default constructor, which is a problem if you want to instantiate them automagically. Martijn On Wed, Nov 25, 2009 at 12:57 AM, Pierre Goupil goupilpie...@gmail.com wrote: Guys, One thing that I like regarding Wicket tester is that it easily allows one to check a Page under design for any exception that it could throw at creation-time. Actually, doing such a basic test is for me essential, so as it takes only two lines of code, I systematically check all my pages this way. You know, the: // start and render the test page this.tester.startPage(HomePage.class); // assert rendered page class this.tester.assertRenderedPage(HomePage.class); thing. What I like so much with it is that any error which would occur when you load the page in FF / IE... occurs without leaving Eclipse and immediately. When the workflow to find the page in the browser is long and repetitive, it's a relief! BUT, when the number of pages grow, two related problems emerge: -you have to duplicate these two lines of code everytime, which is a (small) pain in itself -and you have no guarantee that you didn't forget any page, which is worst. So I'm looking for a way to list all Page instances in a Wicket app, which could then allow me to be sure that they are all covered by a test. And when it's done maybe I could use the same system in order to ensure that Selenium (the automated functional testing tool) has covered all my pages as well (more deeply). I could use a test coverage tool, but 1) it wouldn't work with Selenium 2) I don't want to generate a report, I want the test suit to fail if a Page is not covered by my test class. Could anyone suggest where to start, please? Regards, Pierre -- Rien de grand ne s'est accompli dans le monde sans passion. (G.W.F. Hegel, philosophe allemand) - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket tester test coverage
No, it isn't but: -with your solution, no test has to be written especially for each Component / Page (if one just want to check for exception) -so we are assured that no Page / Component is forgotten (in the check for exception process)) :-) On Wed, Nov 25, 2009 at 10:40 AM, Daan van Etten d...@stuq.nl wrote: Item 2 (fail if a page has not been tested) is not in my solution, but I'm glad I could help :-) Regards, Daan van Etten On Wed, 2009-11-25 at 10:32 +0100, Pierre Goupil wrote: Yeah, test coverage is a big word here. But as I said I was not looking for a way to generate a report, just a mean to have my test suit fail if 1) a page throws an exception at instantiation 2) a page has not been so tested. That's exactly what you did and I'm not surprised not to be the first one to wonder how to achieve this. Of course this test is pretty basic, but as it's totally automated, that's no big deal. You just have to know what is does and what its limits are. Reading your blog, I see that I made the same assumptions than you regarding that matter and that the need was the very same. On Wed, Nov 25, 2009 at 10:24 AM, Daan van Etten d...@stuq.nl wrote: In my other post I gave a link to a full-fledged example which scans for Panel classes with the default constructor and instantiates them. http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup This has almost no value (in my opinion) for reporting unit testing coverage. It only checks for exceptions and if the code matches the markup at instantiation. An exception could easily be thrown when replacing panels, clicking on a link or submitting a form. This is not tested. Regards, Daan van Etten On Wed, 2009-11-25 at 10:06 +0100, Martijn Dashorst wrote: Spring has a classpath scanner which you can copy and adapt to scan for pages and then try to instantiate them. The problem is often that pages don't have a default constructor, which is a problem if you want to instantiate them automagically. Martijn On Wed, Nov 25, 2009 at 12:57 AM, Pierre Goupil goupilpie...@gmail.com wrote: Guys, One thing that I like regarding Wicket tester is that it easily allows one to check a Page under design for any exception that it could throw at creation-time. Actually, doing such a basic test is for me essential, so as it takes only two lines of code, I systematically check all my pages this way. You know, the: // start and render the test page this.tester.startPage(HomePage.class); // assert rendered page class this.tester.assertRenderedPage(HomePage.class); thing. What I like so much with it is that any error which would occur when you load the page in FF / IE... occurs without leaving Eclipse and immediately. When the workflow to find the page in the browser is long and repetitive, it's a relief! BUT, when the number of pages grow, two related problems emerge: -you have to duplicate these two lines of code everytime, which is a (small) pain in itself -and you have no guarantee that you didn't forget any page, which is worst. So I'm looking for a way to list all Page instances in a Wicket app, which could then allow me to be sure that they are all covered by a test. And when it's done maybe I could use the same system in order to ensure that Selenium (the automated functional testing tool) has covered all my pages as well (more deeply). I could use a test coverage tool, but 1) it wouldn't work with Selenium 2) I don't want to generate a report, I want the test suit to fail if a Page is not covered by my test class. Could anyone suggest where to start, please? Regards, Pierre -- Rien de grand ne s'est accompli dans le monde sans passion. (G.W.F. Hegel, philosophe allemand) - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Rien de grand ne s'est accompli dans le monde sans passion. (G.W.F. Hegel, philosophe allemand)
Re: Wicket tester test coverage
Without reference to his article, I can only guess that it may be pointless to test the position or the color of a button in automated tests. I think it was this one : http://www.infoq.com/news/2009/11/uncle-bob-tdd-applicability but in fact uncle bob mainly says it's pointless to do TDD when not knowing where it'll end, but still one should then write the tests afterwards. On the other hand, functionality of GUI can definitely be tested. For example, I am writing a Wicket application with TDD (sort of) with the library shown in my signature. It is working very well. I saw it, but we're using guice (when, it wouldn't be a show stopper in the end). Still, on the technical side, there's also this issue with selenium using mostly id, whereas wicket'ids change with each request... How do you solve this issue ? on a broader picture, my main question was about the way you proceed, Do you test every page, including every validator or.. ? If doing so, for pages that quite often are then not touched much, i would fear the time needed for proper testing quite hard to justify. Am i wrong here ? bye zedros - -- Kent Tong Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net) -- View this message in context: http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26509652.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket tester test coverage
Pierre Goupil wrote: So I'm looking for a way to list all Page instances in a Wicket app, which could then allow me to be sure that they are all covered by a test. And when it's done maybe I could use the same system in order to ensure that Selenium (the automated functional testing tool) has covered all my pages as well (more deeply). What you need is TDD. Once you adopt TDD, you will have every page tested. - -- Kent Tong Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net) -- View this message in context: http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26507647.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket tester mock server name
you can create your own subclass of mockhttpservletrequest and return whatever you want. hooking it into wickettester should not be that bad... if it is we can see if we can make it easier. -igor On Wed, Nov 4, 2009 at 8:27 AM, Ted Vinke tvi...@first8.nl wrote: Hi! Seems a bit dumb I can't seem to get the following working. In my application I have to so something special based on the domain the app is running on. I ask for that domain in the following manner: String serverName = getWebRequestCycle().getWebRequest().getHttpServletRequest().getServerName(); // serverName is e.g. 'www.somedomain.com' The problem: when testing in the Wicket tester serverName results in 'localhost'. How can I set / mock getWebRequestCycle().getWebRequest().getHttpServletRequest().getServerName() to return a preset value, such as 'www.somedomain.com', when accessing my page in my unit test? Any tips or hints to examples are greatly appreciated!! Kind regards, Ted - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket tester form submission problem
FormTester ft = tester.newFormTester(form); ft.submit(); Did you also check for any validation errors? Martijn On Tue, Apr 21, 2009 at 6:03 PM, Chiradeep Chhaya cbchh...@gmail.com wrote: I have a form that contains an indicating ajax button which when clicked performs some calculations and calls setResponsePage. In the test I have tried form.submit on the button and also executing onSubmit ajax event but nothing works. Any suggestions? Thanks -- Sent from my mobile device -Chiradeep - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.3.5 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket tester form submission problem
Martijn, That's exactly what I am doing (I think form.submit earlier was confusing - apologies). The button has setDefaultFormProcessing to true (but is used to setResponsePage) - although this works fine functionally, could that be an issue with the test? I will debug the tree to see if validation components contain any errors - there were none in the test logs though. Thanks! Martijn Dashorst wrote: FormTester ft = tester.newFormTester(form); ft.submit(); Did you also check for any validation errors? Martijn On Tue, Apr 21, 2009 at 6:03 PM, Chiradeep Chhaya cbchh...@gmail.com wrote: I have a form that contains an indicating ajax button which when clicked performs some calculations and calls setResponsePage. In the test I have tried form.submit on the button and also executing onSubmit ajax event but nothing works. Any suggestions? Thanks -- Sent from my mobile device -Chiradeep - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.3.5 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://www.nabble.com/Wicket-tester-form-submission-problem-tp23159433p23166322.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket Tester
The links are very usefull. Thank you very much for your help. Regards karthic -- View this message in context: http://www.nabble.com/Wicket-Tester-tp21537981p21539882.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket Tester
http://www.google.com/search?q=testing+wicket http://www.google.com/search?q=how+to+use+wicket+tester http://cwiki.apache.org/WICKET/testing-pages.html http://cwiki.apache.org/WICKET/unit-test.html On Mon, Jan 19, 2009 at 1:21 AM, PSkarthic kart...@touchpointindia.comwrote: Hi I have came to know that wicket has tester, from its features. I don't know how to use it anybody has knowledge about that please guide me. It will be very helpfull to me. Thank you Karthic -- View this message in context: http://www.nabble.com/Wicket-Tester-tp21537981p21537981.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Jeremy Thomerson http://www.wickettraining.com
Re: Wicket tester calling load twice in loadableDetachableModel
On Wed, Apr 23, 2008 at 10:06 PM, Ned Collyer [EMAIL PROTECTED] wrote: Hi I have the following, and its resulting in 2x calls to the load on my model - which confuses me. My panel has the following in its constructor. setModel(new CompoundPropertyModel(new LoadableDetachableModel() { protected Object load() { return featureService.get(docRef); } })); In my test I have: expect(mockFeatureService.get(testFeature.getDocRef())).andReturn(testFeature); replay(mockFeatureService); applicationContext.putBean(featureService, mockFeatureService); wicketTester.startPanel(new TestPanelSource() { public Panel getTestPanel(String panelId) { return new TestFeatureShowPanel(panelId, testFeature.getDocRef()); } }); wicketTester.assertLabel(panel:title, testFeature.getTitle()); verify(mockFeatureService); When I run this through a jetty server I get 1 call to the load method of my TestFeature model. When I run the test I get 2 calls to the load method. The 2nd seems to be triggered from the assertLabel call. If I have many assertLabel calls - then its still called only twice. Ie, more assertLabels do no call load again. Any ideas why? The first call to load happens during rendering. When rendering is done, your model is detached. Then, the call to assertLabel() forces the model to be loaded again. Then, subsequent calls to assertLabel() would not require a load because the model hasn't been detached. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wicket tester calling load twice in loadableDetachableModel
On Thu, Apr 24, 2008 at 6:56 AM, James Carman [EMAIL PROTECTED] wrote: On Wed, Apr 23, 2008 at 10:06 PM, Ned Collyer [EMAIL PROTECTED] wrote: Hi I have the following, and its resulting in 2x calls to the load on my model - which confuses me. My panel has the following in its constructor. setModel(new CompoundPropertyModel(new LoadableDetachableModel() { protected Object load() { return featureService.get(docRef); } })); In my test I have: expect(mockFeatureService.get(testFeature.getDocRef())).andReturn(testFeature); replay(mockFeatureService); applicationContext.putBean(featureService, mockFeatureService); wicketTester.startPanel(new TestPanelSource() { public Panel getTestPanel(String panelId) { return new TestFeatureShowPanel(panelId, testFeature.getDocRef()); } }); wicketTester.assertLabel(panel:title, testFeature.getTitle()); verify(mockFeatureService); Can you move the verify stuff up above the assertLabel? Would that help? The verification you're looking for is to verify that stuff is called correctly during rendering. The assertions don't need to go on within the context of the replay of the mocks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wicket tester calling load twice in loadableDetachableModel
Thanks for the feedback - an interesting work around :) Generally I'd put my general service expectations in the setUp() and my verifies in the tearDown(), but I think I'm comfortable moving the verify in this circumstance. Rgds Ned On Thu, Apr 24, 2008 at 8:58 PM, James Carman [EMAIL PROTECTED] wrote: Can you move the verify stuff up above the assertLabel? Would that help? The verification you're looking for is to verify that stuff is called correctly during rendering. The assertions don't need to go on within the context of the replay of the mocks.
Re: Wicket Tester And OpenSessionInView
One thing is to run each test in a single transaction. This way the session will remain open. I tend to use Spring for this (see http://static.springframework.org/spring/docs/2.5.x/reference/testing.html#testcontext-tx. ). If you are not using Spring you could start a transaction yourself. Hop this helps. Lars On Sun, Mar 2, 2008 at 10:34 PM, carloc [EMAIL PROTECTED] wrote: Hi , I seem to be getting this Exception when I run integration tests using WicketTester... I use lazy objects through the opensessioninviewfilter. How can I get WicketTester to use this filter? Is there anyway that this could be resolved? org.hibernate.LazyInitializationException: could not initialize proxy - no Session -- View this message in context: http://www.nabble.com/Wicket-Tester-And-OpenSessionInView-tp15793421p15793421.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wicket Tester And Code Output
wickettester.getServletResponse().getDocument() Maurice On Wed, Feb 27, 2008 at 9:43 PM, carloc [EMAIL PROTECTED] wrote: Hi, I'm using Wicket Tester to render my pages, is there a way by which I can see the code that is rendered? For example I have, wicketTester.startPage(new HomePage()); assertRenderedPage(HomePage.class); I want to be able to see the html contents being printed in the console.. like html body HOme Page /body /html -- View this message in context: http://www.nabble.com/Wicket-Tester-And-Code-Output-tp15722731p15722731.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: wicket tester / tester.assertResultPage(clazz, filename);
I should also mentioned that Im testing by doing this: WicketTester.assertResultPage(this.getClass(), filename); Nino Saturnino Martinez Vazquez Wael wrote: Hi Im trying to create a test that renders a page and then compares it to the expected result. Currently I keep getting diff errors although I just copied the contents of the html file from the tester.dumpPage() and placed it in the expected result file. I guess its just a matter of spaces thats wrong, but not matter how I change them they dont seem to add up apparently. As it can be somewhat a task guessing how the contents of a wicket page might look, I thought this was the most simple approach to doing this but I might be wrong? regards Nino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: wicket tester / tester.assertResultPage(clazz, filename);
Fidling around with the spaces, I've now boiled it down to this error only: ERROR - DiffUtil - === It's not that descriptive though:( Cant really see whats wrong.. regards Nino Nino Saturnino Martinez Vazquez Wael wrote: I should also mentioned that Im testing by doing this: WicketTester.assertResultPage(this.getClass(), filename); Nino Saturnino Martinez Vazquez Wael wrote: Hi Im trying to create a test that renders a page and then compares it to the expected result. Currently I keep getting diff errors although I just copied the contents of the html file from the tester.dumpPage() and placed it in the expected result file. I guess its just a matter of spaces thats wrong, but not matter how I change them they dont seem to add up apparently. As it can be somewhat a task guessing how the contents of a wicket page might look, I thought this was the most simple approach to doing this but I might be wrong? regards Nino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: wicket tester / tester.assertResultPage(clazz, filename);
looking at the sourcefile I saw this option: -Dwicket.replace.expected.results=true could this be what I was looking for to genereate the expected results? I think so:) regards Nino Nino Saturnino Martinez Vazquez Wael wrote: Fidling around with the spaces, I've now boiled it down to this error only: ERROR - DiffUtil - === It's not that descriptive though:( Cant really see whats wrong.. regards Nino Nino Saturnino Martinez Vazquez Wael wrote: I should also mentioned that Im testing by doing this: WicketTester.assertResultPage(this.getClass(), filename); Nino Saturnino Martinez Vazquez Wael wrote: Hi Im trying to create a test that renders a page and then compares it to the expected result. Currently I keep getting diff errors although I just copied the contents of the html file from the tester.dumpPage() and placed it in the expected result file. I guess its just a matter of spaces thats wrong, but not matter how I change them they dont seem to add up apparently. As it can be somewhat a task guessing how the contents of a wicket page might look, I thought this was the most simple approach to doing this but I might be wrong? regards Nino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]