Testing Tapestry pages and components with JUnit
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.