cucumber icon indicating copy to clipboard operation
cucumber copied to clipboard

Prevent parallel execution of examples

Open erichstuder opened this issue 7 months ago • 0 comments

I have a feature file like this:

# language: en

Feature: Persistency

    Scenario Outline: Persisted Parameters
        Given the communication to the device over RS232
        When the command is sent: 'store <parameter_name> <value_example>\n'
        And the command is sent: 'read <parameter_name>\n'
        Then the answer is: '<value_example>\n'

        Examples:
        | parameter            | parameter_name       | value_example   |
        | Wi-Fi SSID           | wifi_ssid            | this_is_an_ssid |
        | Wi-Fi Password       | wifi_password        | wifi_password   |

I found out that the different examples run in parallel. So step one runs twice, then step two runs twice, ... As I have a shared resource (UART) this causes strange behavior.

I would expect that for every example all steps are executed and then the next example is executed. Interestingly in cucumber-cpp I never had this problem. (Note: If I have only one example, everything works fine.)

Questions:

  • Is it a misunderstanding from my side and this should not happen at all?
  • Is there an option to force sequential execution?
  • Should I take sync measures to prevent this behavior in the step implementation? What would you suggest?

erichstuder avatar Jun 30 '24 05:06 erichstuder