Robotframework 如何强制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

我在文件夹(测试)中有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.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-test.robot而不是1-test.robot)。这可能会中断对其他文件(资源)的任何内部引用,很难在其间添加测试,在需要更改执行顺序时容易出错
  • 您可以将其标记为Emna
  • 来自RF文档的想法-编写一个脚本来创建参数文件,该文件将以正确的方式保持顺序,并将其用作机器人执行的参数。对于1000多个文件,所需时间不应超过几秒钟
  • 尝试将测试设计为不依赖于执行顺序,而使用套件设置

  • 祝你好运;)

    如果您可以选择重命名文件,只需确保前缀可排序即可。对于数字,这意味着它们都应该有相同的位数

    我建议将测试用例重命名为前缀为三或四位数:

    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
    ...