How to run Cypress e2e tests with parallelization in Azure CI CD #24787
Unanswered
ShanikaWickramasinghe
asked this question in
Questions and Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using azure CI CD pipelines to run my cypress end to end (e2e) tests, As our test suite has now grown with spec count, need to integrate test parallelization to decrease test suite execution time.
My test suite structure has a grouping mechanism where we have few test groups. Each spec is under a specific group and we maintain a resource shared architecture inside the groups to create and delete test data.
eg :-
app-mgt-test-group1 >> create-common-test-data-for-app-mgt-test-group1.spec.ts, app-mgt-spec1.ts, app-mgt-spec2.ts, delete-common-test-data-for-app-mgt-test-group1.spec.ts
user-mgt-test-group2 >> create-common-test-data-for-user-mgt-test-group2.spec.ts, user-mgt-spec1.ts, user-mgt-spec2.ts, delete-common-test-data-for-user-mgt-test-group2.spec.ts
We are using this resource shared structure to stop recreating the same resources again and again. As per my research on Cypress parallelization [1] which is supported from cypress framework level it do not support running the tests in parallel by preassigned a test group to a agent. As cypress dashboard will randomly assign a spec to agent and as our specs are not independent within a group this is causing a problem.
Is there a way that we can predefine and assign a test groups to multiple agents running in parallel. So all the specs in group 1 will get execute against agent 1 sequentially and all the specs in group 2 will get execute against agent 2 sequentially, and agent 1 and agent 2 will run in parallel. If cypress framework doesn't support running tests in parallel with group wise can this requirement be achieved through azure pipeline level parallelization. Using a approach like matrix or parallel [2]. If we integrate this from azure pipeline level do we need to do any modification for the cypress test suite execution against azure. Do we need to change the commands or configs in cypress level. Currently we are using npm run test to run the whole test suite in 1 agent in azure.
Appreciate your inputs and some examples how this can be achieved.
[1]. https://docs.cypress.io/guides/guides/parallelization
[2]. https://learn.microsoft.com/en-us/azure/devops/pipelines/test/parallel-testing-any-test-runner?view=azure-devops&viewFallbackFrom=vsts
I have tried to use cypress parallelization with
cypress run --record --group 4x-electron --parallel
But -- group option seems not doing what I expected. It is used to display the test run results in cypress dashboard under one group name.
Beta Was this translation helpful? Give feedback.
All reactions