Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an ID to each instance of behave #121

Merged
merged 2 commits into from
Sep 6, 2024

Conversation

JackHerRrer
Copy link

@JackHerRrer JackHerRrer commented Jan 9, 2024

Context of the Pull Request

The system I want to test can only be accessed by a single entity at a time. Therefore, to conduct tests in parallel, I need to have as many instances of my system as there are instances of Behave. Additionally, each instance of Behave must access a unique instance of the system. Otherwise, the test results will be random.

A simple solution to this problem is to assign a different instance of the system to each instance of Behave. However, this implies knowing, from the Python code of the tests, in which instance of Behave we are currently located.

Currently, the only way (that I have found) to distinguish Behave processes is by looking at the output file used by the Behave instance (E.g behave.log, stdout1.txt, stdout2.txt, ...). Not only is this approach inelegant, but it is also unreliable. For example, when invoking BehaveX with 2 processes, in some cases, the output files will be stdout1.txt, stdout2.txt, and in other cases, the output files will be stdout2.txt, stdout3.txt.

Goal of the Pull Request

The purpose of this pull request is to assign an ID to each instance of Behave. The ID is unique and ranges from 0 to the number of processes -1.
The ID is passed to each Behave instance through the '-D' parameter of Behave.
This ID is then accessible in the context of each instance.
E.g

id = context.config.userdata['worker_id']

Thank you for this great project. If you have any questions, do not hesitate to ask for more details

@JackHerRrer JackHerRrer changed the title Add a worker ID to each instance of behave Add an ID to each instance of behave Jan 9, 2024
@hrcorval hrcorval changed the base branch from master to release_3.2.1 July 29, 2024 21:55
@JackHerRrer
Copy link
Author

Hello, is it possible to have a feedback ? Is there a chance of this pull request to be reviewed ? Or even be integreted ? and when ?

@hrcorval hrcorval changed the base branch from release_3.2.1 to release_4.0.2 September 6, 2024 17:19
@hrcorval hrcorval changed the base branch from release_4.0.2 to release_4.0.3 September 6, 2024 21:10
@hrcorval hrcorval merged commit 8d7b405 into hrcorval:release_4.0.3 Sep 6, 2024
4 checks passed
@hrcorval
Copy link
Owner

hrcorval commented Sep 6, 2024

Hi @JackHerRrer, I have merged this code and it will be released as part of version 4.0.3: https://github.com/hrcorval/behavex/compare/release_4.0.3

Thanks a lot for your contribution!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants