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

are there any feature to support parallel run at scenario level? #53

Open
hemanta8841 opened this issue Feb 22, 2019 · 14 comments
Open
Labels

Comments

@hemanta8841
Copy link

Are there any feature to support parallel run at scenario level?
Currently cucumberjs has the support to run parallel <NUMBER_OF_SLAVES>
this will run parallel at scenario level.
If there are no feature available for jest-cucumber as of now, is there any plan in near future to add this one ? Appreciate your response

@bencompton
Copy link
Owner

bencompton commented Feb 22, 2019

Scenarios end up being Jest tests, and Jest already runs tests in parallel by default unless runInBand is used.

@hemanta8841
Copy link
Author

@bencompton let me specific what I am asking : is test.concurrent is supported in jest-cucumber ?

@bencompton
Copy link
Owner

bencompton commented Feb 22, 2019

Okay, I see what you're asking now. I have actually never used test.concurrent. Looks like Jest executes test suites in parallel by default, and test.concurrent forces parallel execution per scenario.

test.concurrent is not supported at the moment, but it would be worth adding support for the other aliases, like test.only, test.skip as well.

@bencompton bencompton reopened this Feb 22, 2019
@bencompton bencompton added the enhancement New feature or request label Feb 22, 2019
@bencompton
Copy link
Owner

It was a quick change, so I went ahead and implemented test.only, test.skip, and test.concurrent and published a beta package to NPM v2.0.7.

@hemanta8841
Copy link
Author

ok, Fantastic , so quick , appreciate .

@sibyldawn
Copy link

Hi I would love any documentation to explain how to use test.concurrent in the jest-cucumber context.

@sibyldawn
Copy link

Regular Test
Screen Shot 2019-06-11 at 9 50 53 AM

Used Test.Concurrent
Screen Shot 2019-06-11 at 9 51 27 AM
This is the current behavior when I use test.concurrent. Compared to the regular test the run time is the similar.

@bencompton bencompton added the in preview This feature is in preview and is not considered completely stable label Sep 26, 2019
@MetaMmodern
Copy link

Hey, Heey) One year passed) Is there any progress with this?

@bencompton
Copy link
Owner

bencompton commented Apr 8, 2021

This is working as expected as far as I know, and ends up running your scenarios with Jest's test.concurrent API. That being said, the Jest docs say that test.concurrent is still considered experimental. In addition, I would add that there are a lot of variables with parallelization in general, and depending on a number of factors, performance gains may not be as linear as one might expect. Jest already runs test suites (i.e., tests from different files) in parallel, and test.concurrent just allows specific tests within single suites to run in parallel as well.

Since test.concurrent is still experimental in Jest, it is likewise still experimental in Jest Cucumber. It may be worth playing around with it to see if you can improve your test runtimes, but YMMV, and I would also suggest having a look at the known issues.

It's probably worth adding this info to the docs at this point and then closing this issue.

@bencompton bencompton added needs documentation and removed enhancement New feature or request in preview This feature is in preview and is not considered completely stable labels Apr 8, 2021
@MetaMmodern
Copy link

MetaMmodern commented Apr 8, 2021

This is working as expected as far as I know, and ends up running your scenarios with Jest's test.concurrent API. That being said, the Jest docs say that test.concurrent is still considered experimental. In addition, I would add that there are a lot of variables with parallelization in general, and depending on a number of factors, performance gains may not be as linear as one might expect. Jest already runs test suites (i.e., tests from different files) in parallel, and test.concurrent just allows specific tests within single suites to run in parallel as well.

Since test.concurrent is still experimental in Jest, it is likewise still experimental in Jest Cucumber. It may be worth playing around with it to see if you can improve your test runtimes, but YMMV, and I would also suggest having a look at the known issues.

It's probably worth adding this info to the docs at this point and then closing this issue.

Hello there and thanks for fast response. As far as I know jest runs only suites in parrallel, and with that said there is another fact. Only files are considered as suites by Jest. By writing "describe" you cannot achieve the same result, as with seperate files, it just doesn't work and Jest team still did not fix their documentation about it. So it is almost untrue for this project that tests run in parrallel. Except you made an extraordinary tweak iside your code to make jest think, that blocks of code are suites. But I'm browsing the source and can't find it. What do you think about that?

@bencompton
Copy link
Owner

So it is almost untrue for this project that tests run in parrallel. Except you made an extraordinary tweak iside your code to make jest think, that blocks of code are suites. But I'm browsing the source and can't find it. What do you think about that?

Outside of autoBindSteps, each step definition file is matched separately by Jest and is seen as a separate test suite, which can be verified by running the examples and noting that there is more than one test suite. However, in the case of autoBindSteps where there is a single file being matched by Jest that binds all steps, then it would indeed be a single suite. There is currently no magic going on in Jest Cucumber to add parallelism in this case. One way to work around that at the moment would be to have multiple files matched by Jest that run autoBindSteps on a subset of feature files, which should then create multiple test suites. test.concurrent may also be more effective in this case as well since there is not already parallelism from multiple test suites.

I would be curious if there is something in the Jest API outside of describe blocks to allow more manual definition of test suites that autoBindSteps could leverage, or perhaps there is some sort of improvement that could be made to autoBindSteps itself such that each feature file ends up as a separate test suite.

@MetaMmodern
Copy link

'each feature file is as a seperate test suite'. This is definitely the thing that I'm trying to implement.

@bencompton
Copy link
Owner

'each feature file is as a seperate test suite'. This is definitely the thing that I'm trying to implement.

That may or may not be possible, but one easy solution would be to have a flag in autoBindSteps that makes it use test.concurrent instead of test. This would still be considered experimental, but experimental would be better than nothing I suppose.

@bencompton bencompton added this to the autoBindSteps Gaps milestone Apr 10, 2021
@bencompton bencompton added the enhancement New feature or request label Apr 10, 2021
@siva-natarajan
Copy link

siva-natarajan commented Jan 10, 2022

@bencompton - raised this PR #147 to implement a flag for concurrent execution

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

No branches or pull requests

5 participants