写web自动化Case相关的东西。
首先注意:Excel保存的case仅仅支持.xlsx格式,因为是openpyxl库读取的。
执行sheet中Title名称:
Step\Behavior\OperationPage\Description\ObjectName\PositioningExpression\InputValue\OutputValue\ExpectedResult\WaitTime\Enabled\IgnoreErr\LoopCnt\remark\BehaviorType
其中remark\BehaviorType可不写。
Step:用例步骤;
Behavior:浏览器操作行为,如:click\input\;
Description:步骤描述;
ObjectName:操作控件的对象名;
PositioningExpression:定位表达式,可以输入或引用;
InputValue:输入的内容;
OutputValue:输出的变量;
ExpectedResul:预期结果;
WaitTime:等待时间;
Enabled:是否启用该用例;
IgnoreErr:是否忽略错误。
图示1;
1、staff.json文件内容引用:{"StaffId":"ascadmin","Password":"0000abc!"}
a.先在Behavior 输入input,在PositioningExpression 里面输入定位的表达式,在InputValue输入:staff.json||StaffId,能够获取值:ascadmin。
b.在OutputValue 输入:StaffId,在下个InputValue可以输入:${StaffId} ,这样可以引用到ascadmin。
2、InputValue输入值的引用:
a.Behavior 输入input,在PositioningExpression 里面输入定位的表达式,
b.还需要在InputValue输入:999999,在OutputValue取个别名叫做: StaffIderror,可以在下个InputValue中引用,写作${StaffIderror},可以取到999999的这个值。
在appium中 InputValue 输入code=53,53,34 利用键盘方法 press_keycode 为英文字母 yyf
53,53,34 为 driver.press_keycode(value) 方法的值:可以写成这样:参考Appium自动化测试<三>
3、断言
方式一:根据xpath定位表达式来获取断言内容:
a.在Behavior里面输入check
(检查),在PositioningExpress