Robotframework 如何强制robot框架按顺序拾取robot文件?
我在文件夹(测试)中有robot文件,如下所示:Robotframework 如何强制robot框架按顺序拾取robot文件?,robotframework,Robotframework,我在文件夹(测试)中有robot文件,如下所示: tests 1_robotfile1.robot 2_robotfile2.robot 3_robotfile3.robot 4_robotfile4.robot 5_robotfile5.robot 6_robotfile6.robot 7_robotfile7.robot 8_robotfile8.robot 9_robotfile9.robot 10_robotfile10.rob
tests
1_robotfile1.robot
2_robotfile2.robot
3_robotfile3.robot
4_robotfile4.robot
5_robotfile5.robot
6_robotfile6.robot
7_robotfile7.robot
8_robotfile8.robot
9_robotfile9.robot
10_robotfile10.robot
11_robotfile11.robot
现在,如果我执行'/root/users1/power$pybot root/user1/tests'
命令,robot文件将按以下顺序运行:
tests
1_robotfile1.robot
10_robotfile10.robot
11_robotfile11.robot
2_robotfile2.robot
3_robotfile3.robot
4_robotfile4.robot
5_robotfile5.robot
6_robotfile6.robot
7_robotfile7.robot
8_robotfile8.robot
9_robotfile9.robot
我想强制robot_框架按顺序拾取robot文件,如1,2,3,4,5
我们有任何选项吗?将测试标记为foo和bar,以便您可以单独运行每个测试:
pybot -i foo tests
或
然后决定你想要的顺序
pybot -i bar tests || pybot -i foo tests
在@Emna answer之后,RF docs()提供了一些解决方案 那么你能做些什么:
祝你好运;) 如果您可以选择重命名文件,只需确保前缀可排序即可。对于数字,这意味着它们都应该有相同的位数 我建议将测试用例重命名为前缀为三或四位数:
001_robotfile1.robot
002_robotfile2.robot
003_robotfile3.robot
004_robotfile4.robot
005_robotfile5.robot
006_robotfile6.robot
007_robotfile7.robot
008_robotfile8.robot
009_robotfile9.robot
010_robotfile10.robot
011_robotfile11.robot
...
这样,它们将按照您期望的顺序进行排序。问题是,我有100多个robot文件,这些robot文件中有800多个测试用例。我认为,添加标签将是一项耗时的工作。你有能力重命名你的测试吗?给他们三个数字前缀:001_robotfile1.robot,002_robotfile2.robot,010_robotfile10.robot,…@BryanOakley谢谢。重命名文件后,它将按预期工作。
001_robotfile1.robot
002_robotfile2.robot
003_robotfile3.robot
004_robotfile4.robot
005_robotfile5.robot
006_robotfile6.robot
007_robotfile7.robot
008_robotfile8.robot
009_robotfile9.robot
010_robotfile10.robot
011_robotfile11.robot
...