# How to execute tests in sequential order in robot framework?

**URL:** <https://forum.robotframework.org/t/how-to-execute-tests-in-sequential-order-in-robot-framework/5880>\
**Category:** Robot Framework\
**Created:** [27 June 2023 11:02 UTC](https://forum.robotframework.org/t/how-to-execute-tests-in-sequential-order-in-robot-framework/5880 "2023-06-27T11:02:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![SubhaRobot](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@SubhaRobot](https://forum.robotframework.org/u/SubhaRobot)\
**Post date:** [27 June 2023 11:02 UTC](https://forum.robotframework.org/t/how-to-execute-tests-in-sequential-order-in-robot-framework/5880/1 "2023-06-27T11:02:42Z")

</div>

Hi,

Is there a way to execute tests present inside a test suite in a certain order?  
while using gird, for certain tests we don’t want the tests to be picked up by different machines and get executed in parallel.  
Any way we can mark a suite/tests to run in sequential order instead of executing in parallel.

Thanks!

---

<div class="post-metadata">

**Author:** ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)\
**Post date:** [27 June 2023 14:39 UTC](https://forum.robotframework.org/t/how-to-execute-tests-in-sequential-order-in-robot-framework/5880/2 "2023-06-27T14:39:23Z")

</div>

You can rename files, folders and test names to be prefixed with numbers and \_.

For example:  
`Test Number One` → `01_Test Number One`  
`Test Suite One` → `01_Test Suite One`  
`Test Suite One/Test Number Two.robot` → `01_Test Suite One/02_Test Number Two.robot`

This is a feature since the beginning of Robot Framework, and if you use RIDE, the numbers are omitted from the view of test suites.

---

<div class="post-metadata">

**Author:** ![SubhaRobot](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@SubhaRobot](https://forum.robotframework.org/u/SubhaRobot)\
**Post date:** [28 June 2023 12:45 UTC](https://forum.robotframework.org/t/how-to-execute-tests-in-sequential-order-in-robot-framework/5880/3 "2023-06-28T12:45:58Z")

</div>

Thanks @HelioGuilherme66  
will try this.

---

<div class="post-metadata">

**Author:** ![Prashanth149](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@Prashanth149](https://forum.robotframework.org/u/Prashanth149)\
**Post date:** [17 April 2024 18:06 UTC](https://forum.robotframework.org/t/how-to-execute-tests-in-sequential-order-in-robot-framework/5880/5 "2024-04-17T18:06:43Z")

</div>

Hi,

I have at least ten test suites each having at least 10 test cases. I would like to know if there is a way to run selected tests from each of the suites in an order I would like.

For example, with the following test folder structure:

|--------Tests  
|—Suite 1  
|-------Test 1  
|-------Test 2  
|-------Test 3  
|—Suite 2  
|-------Test 1  
|-------Test 2  
|-------Test 3  
|—Suite 3  
|-------Test 1  
|-------Test 2  
|-------Test 3  
Now I want to run the tests in the order for example as below,

```
1. Suite 1 - Test Case 3
2. Suite 2 - Test Case 2
3. Suite 1 - Test Case 2
4. Suite 3 - Test Case 3

```

Please note that the tests are not in any random order, it fulfills specific requirement for us. Likewise, there are multiple sequences that testcases has to be executed therefore I cannot rename suites or testcases.

Thanks!

---

<div class="post-metadata">

**Author:** ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)\
**Post date:** [17 April 2024 21:18 UTC](https://forum.robotframework.org/t/how-to-execute-tests-in-sequential-order-in-robot-framework/5880/6 "2024-04-17T21:18:29Z")

</div>

You can prepare the arguments to Robot Framework, based on the documentation:

```plaintext
-t --test name * Select tests by name or by long name containing also
                          parent suite name like `Parent.Test`. Name is case
                          and space insensitive and it can also be a simple
                          pattern where `*` matches anything, `?` matches any
                          single character, and `[chars]` matches one character
                          in brackets.
    --task name * Alias to --test. Especially applicable with --rpa.
 -s --suite name * Select suites by name. When this option is used with
                          --test, --include or --exclude, only tests in
                          matching suites and also matching other filtering
                          criteria are selected. Name can be a simple pattern
                          similarly as with --test and it can contain parent
                          name separated with a dot. For example, `-s X.Y`
                          selects suite `Y` only if its parent is `X`.

```

So for your example, it would be:

```shell
robot -t Suite_1.Test_Case_3 -t Suite_2.Test_Case_2 -t Suite_1.Test_Case_2 -t Suite_3.Test_Case_3 ./Tests

```

You can also have those arguments in an Argument file, for example `arguments.txt`:

```plaintext
-t Suite_1.Test_Case_3
-t Suite_2.Test_Case_2
-t Suite_1.Test_Case_2
-t Suite_3.Test_Case_3

```

And then use:

```shell
robot -A arguments.txt ./Tests

```

This is the option:

```plaintext
 -A --argumentfile path * Text file to read more arguments from. Use special
                          path `STDIN` to read contents from the standard input
                          stream. File can have both options and input files
                          or directories, one per line. Contents do not need to
                          be escaped but spaces in the beginning and end of
                          lines are removed. Empty lines and lines starting
                          with a hash character (#) are ignored.
                          Example file:
                          | --include regression
                          | --name Regression Tests
                          | # This is a comment line
                          | tests.robot
                          | path/to/test/directory/
                          Examples:
                          --argumentfile argfile.txt --argumentfile STDIN

```

---

<div class="post-metadata">

**Author:** ![Prashanth149](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@Prashanth149](https://forum.robotframework.org/u/Prashanth149)\
**Post date:** [29 April 2024 09:37 UTC](https://forum.robotframework.org/t/how-to-execute-tests-in-sequential-order-in-robot-framework/5880/7 "2024-04-29T09:37:32Z")

</div>

Hi Helio,

Thanks for the reply. I tried solution given by you. Unfortunately, Framework is unable to find the test cases.

Regards,  
Prashanth

---

<div class="post-metadata">

**Author:** ![bastiaan](https://avatars.discourse-cdn.com/v4/letter/b/c57346/32.png) [@bastiaan](https://forum.robotframework.org/u/bastiaan)\
**Post date:** [15 November 2024 08:33 UTC](https://forum.robotframework.org/t/how-to-execute-tests-in-sequential-order-in-robot-framework/5880/8 "2024-11-15T08:33:56Z")

</div>

Hi Hélio,

Thanks for the example, this works to get the order right. But I cannot get the numbers to be ommited yet. How can I use this “RIDE” you mentioned?

---

<div class="post-metadata">

**Author:** ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)\
**Post date:** [15 November 2024 10:04 UTC](https://forum.robotframework.org/t/how-to-execute-tests-in-sequential-order-in-robot-framework/5880/9 "2024-11-15T10:04:16Z")

</div>

> [@bastiaan](#):
>
> But I cannot get the numbers to be ommited yet.

“Omitted” where? If they are prefixes of files or test cases, they will show in the `log.html`.  
I was mentioning that they are not visualized in RIDE GUI.

NOTE: The prefixes must be in the format: ##\_\_ where ## are numbers and \_\_ two underscores.  
Then they don’t show in Log and Report.

You can install RIDE with `pip install robotframework-ride`

> **[robotframework-ride](https://pypi.org/project/robotframework-ride/)**
>
> RIDE :: Robot Framework Test Data Editor

You should see the project page at, [GitHub - robotframework/RIDE: Test data editor for Robot Framework](https://github.com/robotframework/RIDE/)
