栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何在Robot Framework中编写if语句的多个条件

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何在Robot Framework中编写if语句的多个条件

您应该使用小写字母“ or”和“ and”,而不是OR和AND。

并且要注意关键字和参数之间的空格/制表符(您至少需要两个空格)。

这是一个代码示例,您的三个关键字运行良好:

这是文件

ts.txt

  *** test cases ***  mytest    ${color} =  set variable  Red    Run Keyword If  '${color}' == 'Red'  log to console  nexecuted with single condition    Run Keyword If  '${color}' == 'Red' or '${color}' == 'Blue' or '${color}' == 'Pink'  log to console  nexecuted with multiple or    ${color} =  set variable  Blue    ${Size} =  set variable  Small    ${Simple} =  set variable  Simple    ${Design} =  set variable  Simple    Run Keyword If  '${color}' == 'Blue' and '${Size}' == 'Small' and '${Design}' != '${Simple}'  log to console  nexecuted with multiple and    ${Size} =  set variable  XL    ${Design} =  set variable  Complicated    Run Keyword Unless  '${color}' == 'Black' or '${Size}' == 'Small' or '${Design}' == 'Simple'  log to console  nexecuted with unless and multiple or

这是我执行它时得到的:

$ pybot ts.txt==============================================================================Ts==============================================================================mytest         .executed with single conditionexecuted with multiple orexecuted with unless and multiple ormytest         | PASS |------------------------------------------------------------------------------


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/633121.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号