Home News (03/16/08)new Start Here Getting Started Downloads Documentation Tutorials Tablets Structure Deployment Web Studio (03/16/08)new Change Log References LGPL License Motivational Reading OpenL Apologia |
Table of Contents
Unit TestsThere is no need to describe here why Unit Tests are crucial to the system reliability and maintainability. OpenL Tablets provides a simple and convenient facility to create Unit Tests that are easy to create, modify and execute for either Business Users or Developers.
As you probably already know, OpenL Tablets project components are presented to the outside world as familiar to any
CS undergraduate class methods or attributes. Each OpenL Unit Test works on some OpenL Method using method parameters
as attributes of the Method Test Datatype. In addition to these parameters, the Datatype includes special attribute
To illustrate the approach let's consider a simple example (from Tutorial 3): In Step 1 we demonstrate a Decision Table that is used to convert AM/PM hour to an hour based on 24 hours scale
The table has a Method Signature
The test table for this table may look like this:
At this point you already should be familiar with Data Tables (if not, please do),
and you can see a striking similarity between Data Table and Testmethod table. The only difference is that instead of
the Data Type the Testmethod Table uses the Method Name, in this case Here is how a successful test result looks like in the Studio:
Unit Tests in Web StudioUnit Tests tables in the Web Studio are marked by the icon By clicking on this icon in the Project Tree Menu you can run all the project's tests
Test Result View shows the total number of tests, the number of Failed Tests, the total number of units(lines in Testmethod tables), the number of Failed Units, then all the test results with Failed Tests shown first. Failed Units are marked by the icon How to run a Single Unit Test
in the Table View
). Then click on Test icon
Can I use Unit Tests to test Java methods?Current implementation of Unit Tests allows only the testing of OpenL methods. To test Java methods you have to create a proxy OpenL method that would call the appropriate Java method and return the result. A Testmethod will point to the proxy method. The similar approach can be used if you want for example, to test an attribute value in some business object, that have been changed by some actions. You will create a proxy method that will call a Decision Table and return the value of the attribute. |