Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in /home3/zeenyxor/public_html/b2evolution1/inc/_core/_class_loader.funcs.php on line 55

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home3/zeenyxor/public_html/b2evolution1/inc/_core/_misc.funcs.php on line 5137

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home3/zeenyxor/public_html/b2evolution1/inc/_core/_misc.funcs.php on line 8521

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home3/zeenyxor/public_html/b2evolution1/inc/files/model/_file.funcs.php on line 1442

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home3/zeenyxor/public_html/b2evolution1/inc/files/model/_file.funcs.php on line 1447

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home3/zeenyxor/public_html/b2evolution1/inc/files/model/_file.funcs.php on line 1453

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home3/zeenyxor/public_html/b2evolution1/inc/files/model/_file.funcs.php on line 1460

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home3/zeenyxor/public_html/b2evolution1/inc/files/model/_file.funcs.php on line 1465

Deprecated: define(): Declaration of case-insensitive constants is deprecated in /home3/zeenyxor/public_html/b2evolution1/inc/_core/model/db/_db.class.php on line 49

Deprecated: define(): Declaration of case-insensitive constants is deprecated in /home3/zeenyxor/public_html/b2evolution1/inc/_core/model/db/_db.class.php on line 50

Deprecated: define(): Declaration of case-insensitive constants is deprecated in /home3/zeenyxor/public_html/b2evolution1/inc/_core/model/db/_db.class.php on line 51

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home3/zeenyxor/public_html/b2evolution1/inc/_core/_param.funcs.php on line 2112

Warning: Cannot modify header information - headers already sent by (output started at /home3/zeenyxor/public_html/b2evolution1/inc/_core/_class_loader.funcs.php:55) in /home3/zeenyxor/public_html/b2evolution1/inc/_core/_template.funcs.php on line 379

Deprecated: Function create_function() is deprecated in /home3/zeenyxor/public_html/b2evolution1/inc/_core/_url.funcs.php on line 817

Deprecated: Function create_function() is deprecated in /home3/zeenyxor/public_html/b2evolution1/inc/_core/_url.funcs.php on line 818

Warning: Cannot modify header information - headers already sent by (output started at /home3/zeenyxor/public_html/b2evolution1/inc/_core/_class_loader.funcs.php:55) in /home3/zeenyxor/public_html/b2evolution1/inc/_core/_template.funcs.php on line 40

Warning: Cannot modify header information - headers already sent by (output started at /home3/zeenyxor/public_html/b2evolution1/inc/_core/_class_loader.funcs.php:55) in /home3/zeenyxor/public_html/b2evolution1/inc/_core/_template.funcs.php on line 317

Warning: Cannot modify header information - headers already sent by (output started at /home3/zeenyxor/public_html/b2evolution1/inc/_core/_class_loader.funcs.php:55) in /home3/zeenyxor/public_html/b2evolution1/inc/_core/_template.funcs.php on line 318

Warning: Cannot modify header information - headers already sent by (output started at /home3/zeenyxor/public_html/b2evolution1/inc/_core/_class_loader.funcs.php:55) in /home3/zeenyxor/public_html/b2evolution1/inc/_core/_template.funcs.php on line 319

Warning: Cannot modify header information - headers already sent by (output started at /home3/zeenyxor/public_html/b2evolution1/inc/_core/_class_loader.funcs.php:55) in /home3/zeenyxor/public_html/b2evolution1/inc/_core/_template.funcs.php on line 320
Using Metadata
« Extending a class in Zee

Using Metadata

08/29/12

  02:33:00 pm, by   , 387 words  
Categories: Uncategorized

Using Metadata


Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home3/zeenyxor/public_html/b2evolution1/inc/plugins/model/_plugins_admin.class.php on line 1466

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home3/zeenyxor/public_html/b2evolution1/plugins/_auto_p.plugin.php on line 502

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home3/zeenyxor/public_html/b2evolution1/plugins/_auto_p.plugin.php on line 500

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home3/zeenyxor/public_html/b2evolution1/plugins/_auto_p.plugin.php on line 500

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home3/zeenyxor/public_html/b2evolution1/plugins/_texturize.plugin.php on line 116

 

Metadata is similar to annotations in java or attributes in C#. Metadata can be used to mark an object with a value that can be queried at runtime. For example, you can mark all of the app objects in your application with a required field attribute so that a generic test can read the value to determine whether or not to include it in a ‘required field’ test.

Metadata is implemented in Zee as a class. All custom metadata derives from the built-in class Metadata. To add metadata to an AppObject, first create a class as in the example below:

class  CustomData : Metadata   
String  System  
Integer Version

Then apply the metadata to your AppObjects and assign values as in the example below.  The order of the members inside the square brackets does not matter since field/value pairs are used:

WebPage MyPage   
WebTextField MyTextField    %CustomData[System="MySystem",Version=3]

In the previous example, each member of the metadata class was assigned using a field/value pair. An alternate way to assign metadata is to list the members in order as in the example below:

WebPage MyPage   

WebTextField MyTextField  %CustomData["MySystem",3]

To refer to metadata in functions and tests, use the % operator as in the example below:

String SystemName = MyPage.MyTextField.%CustomData.System

It is also possible to create a metadata class without member elements as in the example below. In this case the value of the metadata will be false if it is not assigned to an AppObject. Otherwise it will return true.

class ObsoleteIndicator : Metadata

WebPage MyPage

WebTextField MyTextField %ObsoleteIndicator  
WebTextField MyTextField2 


Print (MyPage.MyTextField.%ObsoleteIndicator)
//Prints  true

Print (MyPage.MyTextField2.%ObsoleteIndicator)
//Prints   false

Here are some notes to enhance your understanding of Metadata:

  • Metadata can not be inherited.
  • It is not necessary to assign all members of a metadata class to an AppObject. If a member that is not assigned a value is accessed at runtime, a null value will be returned.
  • If the members of the metadata class are assigned to an AppObject in order without using the name of the member, members must not be skipped, but it is not necessary to assign all members of the class.
  • The fields in a metadata class are constants. If they are listed in a metadata assignment, they must be provided with a value.
  • The following classes are supported for metadata member elements: Boolean, Date, DateTime, Enumerated Type, Flags, Integer, List, Number, Real, Record, String, Time and Type.
 Permalink
Deprecated: Function create_function() is deprecated in /home3/zeenyxor/public_html/b2evolution1/inc/_core/_url.funcs.php on line 817

Deprecated: Function create_function() is deprecated in /home3/zeenyxor/public_html/b2evolution1/inc/_core/_url.funcs.php on line 818

Deprecated: Function create_function() is deprecated in /home3/zeenyxor/public_html/b2evolution1/inc/_core/_url.funcs.php on line 817

Deprecated: Function create_function() is deprecated in /home3/zeenyxor/public_html/b2evolution1/inc/_core/_url.funcs.php on line 818

No feedback yet

Zeenyx Software is committed to providing a solution for manual and automated testing that will allow all members of the team to build effective tests faster than with traditional manual testing methods so that a positive Return on Investment is achieved the very first time tests are deployed.

Search

  XML Feeds

free blog software