Skip to content

feat: shuffle test suite order in run command #5051

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

Open
wants to merge 2 commits into
base: 3.x
Choose a base branch
from

Conversation

NivYarmus
Copy link

@NivYarmus NivYarmus commented Jul 24, 2025

Motivation/Description of the PR

Hello there.
Added an option to the run command that shuffles the order in which test suites are run.
Helpful if you want to make sure that your tests are not passing just because of a lucky side effect of a previous test.

Applicable helpers:

  • Playwright
  • Puppeteer
  • WebDriver
  • REST
  • FileHelper
  • Appium
  • TestCafe

Applicable plugins:

  • allure
  • autoDelay
  • autoLogin
  • customLocator
  • pauseOnFail
  • coverage
  • retryFailedStep
  • screenshotOnFail
  • selenoid
  • stepByStepReport
  • stepTimeout
  • wdio
  • subtitles

Type of change

  • 🔥 Breaking changes
  • 🚀 New functionality
  • 🐛 Bug fix
  • 🧹 Chore
  • 📋 Documentation changes/updates
  • ♨️ Hot fix
  • 🔨 Markdown files fix - not related to source code
  • 💅 Polish code

Checklist:

  • Tests have been added
  • Documentation has been added (Run npm run docs)
  • Lint checking (Run npm run lint)
  • Local tests are passed (Run npm test)

@kobenguyent kobenguyent requested a review from Copilot July 25, 2025 07:35
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new --shuffle option to the run command that randomizes the order in which test suites are executed. This helps identify tests that may be passing due to unintended dependencies on the execution order of previous tests.

  • Adds lodash.shuffle dependency for randomizing test order
  • Implements shuffle functionality in the Codecept class when the shuffle option is enabled

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
package.json Adds lodash.shuffle dependency for array shuffling functionality
lib/codecept.js Implements test file shuffling logic when shuffle option is enabled

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@kobenguyent
Copy link
Collaborator

I guess that'll be helpful to update docs as well -> https://github.com/codeceptjs/CodeceptJS/blob/3.x/docs/commands.md

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