Introduction"

From Documentation
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{ZATSEssentialsPageHeader}}
 
{{ZATSEssentialsPageHeader}}
  
= Background =
 
  
In agile software development, developers modify their codes frequently for requirement change or refactoring, they therefore also perform unit tests frequently to ensure the software quality. In ZK-based applications, it is hard to execute an unit test on the composer which is tightly-coupled to ZUL because it is instantiated when a ZUL is requested by a browser. The same problem arises if you want to verify a ZUL's zkbind expression with ViewModel. Hence '''TDD''' (Test-Driven Development) cannot proceed under this situation.
+
'''ZK Application Test Suite''' is a collection of tools which can help users test their ZK-based application.  
  
In some cases, agile developers may deploy their web applications to a server and test it within a browser. However, writing an automation test to control a browser is an issue, and testing for different browsers is also a trouble. Not to mention that running a test in an application server is time-consuming and can be an agile developer's darkest moment. But, don't be depressed, let me enlighten your path with ''' ZATS (ZK Application Test Suite) Mimic '''.
+
Currently this suite has one module:
  
= No Server Test =
+
[[ZATS Essentials/Mimic Library| ZATS Mimic]], a unit-test library that can be used with any well-known unit test framework (e.g. JUnit and TestNG) to test your ZUL without an application server or a browser.
 
 
ZATS Mimic enables developers to test their composer '''without an application server''' and of course '''without a browser''' either. Through this library, testers can mimic user interactions to applications such as clicking or typing to verify composer's (controller layer) data and logic. All they have to do is to '''write a regular unit test case''' and use Mimic's utility class to interact components on ZUL and then, run the test case.
 
 
 
No deploying to server, no rendering on browser, the unit test case can be executed in a very short period of time - this is very helpful for frequent unit testing during a agile development process.
 
 
 
The concept is as follows:
 
 
 
[[File:Smalltalk-ZatsMimicConcept.png]]
 
 
 
Testers write test cases to simulate user action such as clicking or typing with operation agents. Operation agent communicates with server emulator and triggers the composer's event handlers to change the component's status. Testers  are able to check component's properties from the component agent to verify the result of user action. It might be a ''label'' changing its value or a ''listbox'' increased by one item. '''All behaviors that reflect on the component's properties can be verified.'''
 
 
 
== Limitation==
 
 
 
As this library focuses on testing the composer's logic on the server side, there are some limitations you should know:
 
 
 
* '''Functions dependent on the application server won't work. '''
 
*: Test cases run in simulated environment; all functions that require an application server do not work (e.g. JNDI, or JTA). If an AUT (Application Under Test) project adopts such container-provided services, it needs extra work to make them work normally out of a container, e.g. use Test Double like a fake object.
 
 
 
* '''Cannot test browser’s behavior.'''
 
*: In a ZK-based application, some behaviors are handled by a browser (JavaScript), e.g. popup menu or message dialog created at the client side. As server side is not aware of these behaviors, it cannot be verified.
 
 
 
* '''Cannot test visual effects.'''
 
*: It cannot verify any behaviors that doesn't reflect upon component's properties such as animations, or a component's visual effect.
 
  
 +
= Source Code =
 +
All source code mentioned in this book can be found in https://github.com/zkoss/zats/tree/master/zats-example.
  
 +
{{ZATSEssentialsPageHeader}}
 
{{ZATSEssentialsPageFooter}}
 
{{ZATSEssentialsPageFooter}}

Latest revision as of 07:38, 21 November 2014

Introduction




ZK Application Test Suite is a collection of tools which can help users test their ZK-based application.

Currently this suite has one module:

ZATS Mimic, a unit-test library that can be used with any well-known unit test framework (e.g. JUnit and TestNG) to test your ZUL without an application server or a browser.

Source Code

All source code mentioned in this book can be found in https://github.com/zkoss/zats/tree/master/zats-example.


Introduction




Last Update : 2014/11/21

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.