Sunday, March 11, 2012

Using ZTL (Zkoss testing language) framework and Concordion for integration testing



To use ZTL for integration testing we have to inherit org.zkoss.ztl.ZKClientTestCase. We should initialize some variables for testcase (for example in constructor)
            target = "http://localhost:8080/ZK-demo";
            browsers = getBrowsers("iexplore");
            _timeout=100;
To use Concordion we also have to inherit org.concordion.integration.junit3.ConcordionTestCase. But Java doesn’t allow us to use multiple inheritances. So we should replace one of inheritances to usage. I did it for ZKClientTestCase. All of the fields listed above are protected. I made class ZKIntegrationTestCase that inherits ZKClientTestCase. In that class I made public setters and getters for those fields. So we don’t need to use inheritance for ZTL
public class SpecTest extends ConcordionTestCase{
      private ZKIntegrationTestCase ZKFunctionalTestCase zk;

      public SpecTest() {
            zk = new ZKIntegrationTestCaseZKFunctionalTestCase();
            zk.setTarget("http://localhost:8080/ZK-demo");
            zk.setBrowsers(zk.makeListOfBrowsers("iexplore"));
            zk._setTimeout(100);
You may find patched ZTL library (ztl), sample project(ZK-demo) and sample test project(ztl-demo) here: https://github.com/crc83/ztl
Hope it help you make quick rampup.

All about Concordion you may find here: http://www.concordion.org/
Original ZTL you may also find at github: https://github.com/zkoss/ztl
And forum about ZTL issues is here: http://www.zkoss.org/forum/listComment/17556/1/20

No comments:

Post a Comment