Skip to content

Instantly share code, notes, and snippets.

@yashLadha
Last active May 14, 2020 13:00
Show Gist options
  • Save yashLadha/b117aa5b8c1b5e1acdbddb8bd5b14d01 to your computer and use it in GitHub Desktop.
Save yashLadha/b117aa5b8c1b5e1acdbddb8bd5b14d01 to your computer and use it in GitHub Desktop.
Splitting each test

Installing the BrowserStack fork of TestCafe

You can use the browserstack fork of testcafe by executing the following command.

yarn add "https://github.com/browserstack/testcafe.git#session_test_mapping"

Then try running the following command to see if browserstack-provider is present or not.

./node_modules/.bin/testcafe -b browserstack

If the error is something like unable to find the specified browser provider. Then try installing the provider using the following command.

yarn add "https://github.com/browserstack/testcafe-browser-provider-browserstack.git#devexpress_master_step_logs"

About the feature.

If one wants to enable test level scheduling in the testcafe core library. This can be enabled through the flag --test-scheduling. This flag will enable the test level scheduling and will spawn a new test in a new Cloud Session.

Example for the flag use would be:

testcafe '<browser-combination>' simple_fixture.testcafe.js --test-scheduling

This flag can also be used with concurrency and multiple browser combinations.

# With concurrency
testcafe -c 2 '<browser-combination>' simple_fixture.testcafe.js --test-scheduling

# With multiple browser combination.
testcafe -c 3 '<browser-combination>,<browser-combination>,...' simple_fixture.testcafe.js --test-scheduling

This will create every test('<test-name>', callback) in a new session.

Using default behavior

This scheduling is being controlled through --test-scheduling flag, if one doesn't use the flag in the command, default behavior of TestCafe will be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment