This content has been marked as final.
Show 1 reply
-
1. Re: SeamTest - Using many small tests to integrate into a bigger test
toddpi314 Nov 10, 2010 1:29 PM (in response to wolfenstein)I would suggest creating well designed super-types for your test classes.
Unit Tests and Seam Tests work off of Annotations. The SeamTest base, or Db test extension, use the annotations to build up a bootstrap application server before/after methods/classes run.
Annotations are 'discovered' at runtime via Java Reflection. So, using types that have @BeforeClass, @BeforeMethod, and @Test annotations is totally different than the test container creating types with those annotations; in the latter scenario, reflection can discover the annotations and work with them.
You could do something like this:
public abstract class ActionTest extends SeamTest {
private static Log log = Logging.getLog(ActionTest.class);
@BeforeMethod(alwaysRun = true)
@Override
public void begin(java.lang.reflect.Method method) {
// your code here
super.begin(method);
// your code here
};
public void createInvoice(String name, String lastName)
{
.. impl.
}
}
@Test(description = "ProductCrud Test")
public class ProductCrudTest extends ActionTest {
@Test
public void doTest()
{
new FacesRequest("/yourViewId.xhtml") {
@Override
protected void invokeApplication() throws Exception {
// your test
createInvoice("john", "grue");
}
}.run();
}
}
@Test(description = "InvoiceCrud Test")
public class InvoiceCrudTest extends ActionTest {
@Test
public void doTest()
{
new FacesRequest("/yourViewId.xhtml") {
@Override
protected void invokeApplication() throws Exception {
// your test
createInvoice("john", "grue");
}
}.run();
}
}
Hope that helps.