This content has been marked as final.
Show 2 replies
-
1. Re: SeamTest - how to simulate a tabPanel´s click?
toddpi314 Nov 9, 2010 8:02 PM (in response to wolfenstein)I would suggest two approaches:
(1) Interact with components from FacesRequest as you do in EL
In the SeamTest, create a FacesRequest that references the intended view id.
@Test
public void callActionStuff() throws Exception {
new FacesRequest("/theView.xhtml") {
@Override
protected void invokeApplication() {
// Call your components and hit the methods you are binding to via Action attribute on your tabPanel
invokeMethod("#{tabPanelComponentName.onClick()}");
// test app state
}
}.run();
}
You can work against all of the seam contexts as if you are really running in the Application Container. But, as a warning, get to know the SeamTest abstract really well; I rarely find its default behavior acceptable for view testing.
Notice that the FacesRequest is a delegate that you must call .Run() at the end. This means in a given test you can make multiple requests. This is very helpful for Workflow transactions, and views that interact with Seam via Remoting or DWR.
(2) Web Driver
http://code.google.com/p/selenium/?redir=1
This allows you to do actual view testing against the dom. You can run the Selenium tests against support browsers by hosting on a VM of your choice.
We use this and, although it is a pain to configure, the tests can be used along-side the BootStrapped Seam test framework, which is super cool.
Hope that helps. -
2. Re: SeamTest - how to simulate a tabPanel´s click?
wolfenstein Nov 10, 2010 8:58 AM (in response to wolfenstein)Very nice, thank you!