I usually try to minimize testing with Selenium and maximize the usage of plain old back-end testing (JUnit, mocking). With Tapestry I am finding it hard to test pages and components in the latter way due to the "magic" that occurs with the callback functions.
Have you been able to solve this? Or are you just using Selenium for the whole web layer (pages, components)?
According to the Tapestry documentation using PageTester is the appropriate way to do unit testing of Pages and Components: https://tapestry.apache.org/unit-testing-pages-or-components.html
But this seems similar to HtmlUnit style web testing as the interaction happens through a web browser like interface and not through the interface of the Page or Component.
Edit
I just tried a simple unit test for pages and it works quite well :
public class FooPageTest extends AbstractServiceTest{
@Autobuild
@Inject
private FooPage fooPage;
@Test
public void setupRender(){
fooPage.setupRender();
}
}
AbstractServiceTest provides a test runner which provides the Tapestry dependency injection to the unit test class. With Autobuild you get the @Inject dependencies of the FooPage satisfied and for the component injections and @Property annotated elements you will need to figure out something else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With