-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Accept flag --parallel
to run spec files in parallel
#1690
Accept flag --parallel
to run spec files in parallel
#1690
Comments
--parallel
to run tests files in parallel--parallel
to run spec files in parallel
Would it be possible to add a simple and easy to use degree of parallelism flag? This will make it much easier for Cypress to utilise all resources on whatever system it's running on. But I still think it's important to have both options avilable to fit all use cases |
Hey @Toxicable, thank you for submitting feedback on our proposal! We really want to get this right. The proposal above as it is currently is missing a bit of context in terms of the Could you give us some more information on your use case? What does your project look like that you want to run tests on? How are you currently choosing which files are included in a run? |
@jennifer-shehane I don't see the usefulness of the We currently point Cypress at a single directory and expect that it'll run all spec files there. |
@Toxicable Cores here isn't really the problem, memory is likely the bottleneck. How much memory do your machines have? Also are they linux machines? Browsers behave differently when they are out a focus, and only a single browser can be in focus... but in linux with the use of Regardless though - I believe our implementation will work flawlessly for you. It's up to you to determine how many machines you want to run in parallel - and you can easily do this with a node script or even a bash command. const _ = require('lodash')
const os = require('os')
const cypress = require('cypress')
// kick off a bunch of cypress runs
const runs = _.times(os.cpus.length / 2, (i) => {
return cypress.run({ record: true, parallel: true }) // this is it
})
Promise.all(runs)
.then((resultsArray) => {
const totalFailed = _.map(resultsArray, "totalFailed")
process.exit(totalFailed)
}) This kicks off a bunch of That's why we generally suggest parallelizing at the OS level. For instance, you could take your beefy machine and cut it into a dozen docker containers running all at the same time. It would work the same way. In most CI providers, that's how it works - they are all isolated from each other. The The grouping as @jennifer-shehane suggested is only if you want to chunk your specs by a particular group and then manage / parallelize them differently. If you have a single group, then you don't do anything. EDIT: I just realized that spawning a bunch of Also, I think there may be an issue because we don't create dynamic user data dir profiles for chrome or electron. There's already an issue open with that, and that would enable chrome to be opened multiple times and prevent session clashing with cookies or localstorage. That's a really simple, easy fix. |
@brian-mann They are Linux servers with equivilent amounts of RAM, between 128GB - 512GB I believe. I must have misunderstood part of how the parallel flag works. If that is all the config needed, aside from app level stuff such as database config as you mentioned then I think you're right about it fitting out use case then. |
Yeah I think I was so concerned about covering the complicated edge cases in the proposal that I glanced over the standard use cases. I've updated it to hopefully be clearer that:
|
@Toxicable its not Cypress that eats up the memory - it is the browser. I would allocate at least 4gb per "instance". Sounds like you have plenty though, so it should be fine. Once we create new profiles for each Disregard my previous comment about needing to generate new |
What users want
To run spec files in parallel in order to speed up test runs (particularly when in CI)
How we will do this
Specs will have the option of running in parallel by specifying a
--parallel
flag incypress run
.Spec files will run in parallel when
--parallel
flag passed and when determined to be within the same homogeneous environment (determined by Cypress by determining the runsci-group
andgroup
).CI_BUILD_NUM
, it can also be specified by the flagci-group-id
if Cypress is unable to determine one). All this means is that a "run" in Cypress is the equivalent of a "run/build/workflow" in your CI provider. TLDR: Basically, you can't parallelize tests across different CI providers or different CI runs.ci-group
, it is determined by taking into account the uniqueness of the combination of OS name, OS version, browser name, browser version, and defined specs. Groups can be defined yourself and named, but this is optional. Groups will be figured out automatically by Cypress otherwise.We will automatically balance each group's specs by machine based on forecasting we have calculated based off of their previous run data:
Each machine will run at the same time and simply ask "for the next spec file". That means the work completes as fast as possible without needing to manually balance or tweak anything.
This will allow you to test files and have them parallelized within one run like:
my CI
.yml
fileCypress will parallelize all spec files within the project across all available machines.
This will allow me to test several apps (like a monorepo) within one run and group them like:
my CI
.yml
fileThis will allow me to test several environments within one run and group them like:
my CI
.yml
fileWhat you will see
Dashboard Service comps
The text was updated successfully, but these errors were encountered: