The automated test case fragment written in Openexpressapp is so readable because it is possible to use Ruby's method_missing for method invocation:
01 打开模块 "部门管理"
02 # 1 新增部门, 编码:Test 名称:自动化测试
03 添加
04 输入 "编码","Test" #也可以用一般语句对象.动作(参数): 属性编辑 框("编码").输入("Test")
05 输入 "名称","自动化测试"
06
07 # 2 选择系统管理员再 加任意几个岗位后
08 按钮("选择岗位").弹出窗口("选择岗位管理")
09 列表.选择行("一审人 员")
10 按住Ctrl
11 列表.选择行(0)
12 列表.选择行(1)
13 释放Ctrl
14 关闭 窗口(:确认)
This article does not specifically introduce the test framework of the preparation, but want to introduce you to the use of method_missing.
Ruby method Call procedure
When you send a message to a Ruby object, the Ruby query is called with a method that has the same name as the message. There are two main ways Ruby makes a method call, Obj.method_name and Obj.send (: Method_name), which makes the method call procedure as follows:
1. Querying the instance method of the current object
2. Each module introduced by the class (after the introduction of the first lookup)
3. The parent class of the class and the modules introduced by the parent class
4. Until object class
5. If the method is not found when the method is looked up by the path above, call method_missing