How to force robot framework to pick robot files in sequential order?

robotframework

Solution

If you have the option of renaming your files, you just need to make sure that the prefix is sortable. For numbers, that means they should all have the same number of digits.

I recommend renaming your test cases to have three or four digits for the prefix:

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

With that, they will sort in the order that you expect.

Problem

I have robot files in a folder (tests) as shown below: ``` 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 ``` Now if I execute `'/root/users1/power$ pybot root/user1/tests'` command, robot files are running in following order: ``` 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 ``` I want to force robot_framework to pick robot files in sequential order, like 1,2,3,4,5.... Do we have any option for this?

Original source