Python Robot框架-将2个字符串与版本信息(x.x.x.x)进行比较
我正在为一个项目制作测试场景,面临一个问题,如果您有时间,请帮助我 我现在有两个字符串: ${cr_ver}=4.5.5 ${tobe_upgr_ver}=7.0.0 现在我想比较它们,使之类似:如果${cr\u ver}<${tobe\u upgr\u ver},那么测试停止 请给予支持。:)Python Robot框架-将2个字符串与版本信息(x.x.x.x)进行比较,python,robotframework,Python,Robotframework,我正在为一个项目制作测试场景,面临一个问题,如果您有时间,请帮助我 我现在有两个字符串: ${cr_ver}=4.5.5 ${tobe_upgr_ver}=7.0.0 现在我想比较它们,使之类似:如果${cr\u ver}
非常感谢。您可以从python比较字符串的方式中获益:
${cr_ver} Set Variable 4.5.5
${tobe_upgr_ver} Set Variable 7.0.0
Pass Execution If '${cr_ver}' < '${tobe_upgr_ver}' tobe_upgr_ver is greater than cr_ver, pass the test
Log cr_ver is greater than tobe_upgr_ver so let's continue the test
${cr\u ver}设置变量4.5.5
${tobe_upgr_ver}集变量7.0.0
通过执行如果“${cr\u ver}”<“${tobe\u upgr\u ver}”tobe\u upgr\u ver大于cr\u ver,则通过测试
Log cr\u ver大于tobe\u upgr\u ver,所以让我们继续测试
在以下情况下它将失败:“9.1”10.0”或“1.9”1.10”