Is there a way to run cucumber scenarios in parallel - ruby

I am using Ruby and cucumber to run my end-to end tests . I have lots of tests which take longer time to run . I am using 'parallel_tests' to run my 'features' in parallel which has minimised the execution time significantly .But I wanted to know if there is a way to run 'scenarios' in parallel

Yes! There is.
Using the cukeforker library you can run either features or scenarios in parallel.
https://github.com/jarib/cukeforker
# parallelize per scenario, with one JUnit XML file per scenario.
CukeForker::Runner.run CukeForker::Scenarios.tagged(%W[#edition ~#wip])
:extra_args => %W[-f CukeForker::Formatters::JunitScenarioFormatter --out results/junit]

Related

karate dsl - running parallel features and scenarios

in new release(0.9.0),I saw that karatedsl able to run parallel tests in scenario level (each feature will be breakdown into scenarios and run as 1 scenario per thread)..
so for example, I have 4 features, for feature 1 and 2 I want to run parallel tests in scenario level and for feature 3 and 4 in feature level(because of some case I have to do these things)..
so, are there any solution or suggestion for me how can I do it ??
For Feature you don't want to run on scenario level you can add parallel=false tag to your feature.
#parallel=false
Feature:
Refer karate documentation for suppressing parallel execution in scenario level

Running Cucumber Scenarios in Parallel of Single Feature File

I have 2 feature file that include multiple scenarios, I want to run the scenarios of each feature file in parallel.
For example:
example1.feature has 2 scenarios
example2.feature has 3 scenarios
How to run the five scenarios in parallel ?
Thanks All :)

How to fail fast only specific rspec test script?

I have a test suite of rspec tests which are divided into different files.
Every file represents one test scenario with some number of test steps.
Now, on some particular tests, it can happen that specific step fails but it is too time consuming and not needed to run rest of the steps in that scenario.
I know there is an option --fail-fast in rspec but if I'm running tests like: rspec spec/* that will mean that when first step fails in any script, it will abort complete execution.
I'm just looking for mechanism to abort execution of that specific test scenario (test script) when failure happens but to continue execution of other test scenarios.
Thanks for the help,
Bakir
Use the RSpec-instafail gem.
According to its documentation, it:
Show failing specs instantly. Show passing spec as green dots as usual.

How to run Jasmine tests in serial

I use jasmine to test my server side code and i need to run tests in serial, not in parallel.
My tests need to make CRUD operation in database. If test are executed in parallel i can't ensure that the database is in a good context for my test
Unless you explicitly choose to create asynchronous tests in Jasmine, everything in Jasmine happens sequentially, in the sense that one test runs only after its preceding test has finished. And if you do write asynchronous tests, then parts of your single test may run in parallel, but you still have the constraint that one test runs only after its preceding test has finished.
However, there are a couple caveats to be aware of:
In an async test if your code exceeds Jasmine's timeout period, you might still have code running when Jasmine decides to give up on that test and proceed to the next. (Thanks to #Gregg for this tip; see this answer.)
"JavaScript is usually considered to have a single thread of execution... however, in reality this isn't quite true, in sneaky nasty ways." I am quoting #bobince from this answer.

How to measure execution time of a cucumber step

I'm looking for a way to measure the execution time of my cucumber steps. Using the junit format I managed to get some data about the execution time of the features and scenarios, but I would like to see the times of the steps inside the scenarios as well.
cucumber --format usage
"Prints where step definitions are used. The slowest step definitions (with duration) are listed first."
"-Dcucumber.options= -p usage"
This sorts the Step Definitions by their average execution time.

Resources