How do I run tests in parallel on same browser / platform? - intern

There is a config option called "maxConcurrency" which can be used to run same set of tests concurrently on different browser environments, but it's not the same as running tests in parallel.
Is this even possible? Based on Intern homepage, in comparison section, it says Intern supports "Runs tests in parallel for improved performance", which seems total invalid if this is not the case.
Update: I got it confirmed that Intern cannot run tests in parallel on same environment.

Related

How to run multiple feature files in selenium+nodejs?

How to run multiple feature files in selenium+nodejs + cucumberjs ?
As per your query it looks like you want to know something about the parallel execution of your code
It majorly depends on your framework and also build tool you use in your project, which will help you to manage the threads running in your project and tests.
Jasmine is one of the modules in node which can be used in cucumber and selenium to achieve parallel execution.
To run multiple features at the same time you must have proper entry in your protractor config file:
capabilities: {
maxInstances: 3
},
This will run 3 features at the same time in a separate browser instances.

In what order are Jest tests running?

I am having some problems with the order used by Jest to run tests.
Let's imagine that I have two tests:
module1.spec.ts
module2.spec.ts
Each of those modules use a common database. At the beginning of each file, I have a beforeEach call that drops the database and recreates fresh data.
If I launch module1.spec.ts, everything works fine. If I launch module2.spec.ts, everything works fine.
When I try to use the jest global command to launch all of my tests, it does not work.
My theory is that module1.spec.ts and module2.spec.ts are running in a different thread or at least are run kind of "at the same time".
The problem with that approach is that the two tests have to run one after the other because module1.spec.ts and module2.spec.ts are both dropping the database and creating data during their test.
Is it something I am missing concerning testing an application with a database?
Is their a Jest option to run the tests one after the other?
I encounterd this problem. By now my method is to export the test cases in module1.spec.js and module2.spec.js, and require them in a third file like index.spec.js, and custom the test cases running order in index.spec.js. I don't use --runInBand because I want other test files run parallelly with index.spec.js.

Is it possible to run Cucumber tests concurrently in Saucelabs?

I've managed to get concurrent JUnit based tests running in Saucelabs using the Sauce ConcurrentParameterized JUnit runner (As described at https://wiki.saucelabs.com/display/DOCS/Java+Test+Setup+Example#JavaTestSetupExample-RunningTestsinParallel).
I'm wondering if there is a runner that achieves the same thing for Cucumber based tests?
I don't there is such a runner.
The Cucumber runner is, as far as I know, single threaded and doesn't execute tests in parallel. But executing in parallel is just half of your problem, the other half is connecting to Saucelabs. And that is not supported by Cucumber.
My current approach if I wanted to execute on Saucelabs would be to use JUnit and live with the fact that I'm lacking the nice scenarios that Cucumber bring to the table. This doesn't mean that the JUnit tests couldn't use the same helpers as the Cucumber steps does.

Browserstack runs does not update its capabilities

I was wondering if anyone else knows a good way to start individual browser stack tests sequentially using Capybara/Browserstack/Cucumber.
I'm having issues with using Capybara in the sense that browserstack doesn't get updated with my new capabilities for every run, even when I shut down my browser, i.e: The two test runs are started sequentually in Browserstack, but with the same browser and OS-settings.
Abstract Scenario: Run login tests
Given that I want to test x website with capabilities og
Examples:
|browser|browser_version| os |os_version|resolution|
|IE| 11.0 | Windows |8.1 |1024x768 |
|Firefox| 45.0 | Windows |10 |1024x768 |
I've checked that every value successfully gets sent through to the next step, but it seems like Browserstack doesn't update its new capabilities that I'm trying to set.
I know I can probably manage to do parallell runs setting capabilities through settings instead, but we have a limit to how many parallell runs using Browserstack's license. That's why I want to run them sequantually and figured this could be a way to do it.
As per my experience, BrowserStack initiates a test on a particular OS/browser capability that it receives from your tests. Thus, it seems your setup is sending the same capability for both the runs of the test.
I believe you want to run tests sequentially and on different OS/browser combinations. In that case you can refer to the BrowserStack's documentation for configuring Parallel Cucumber tests using Rake file in the "Parallel tests" section. After creating all the files, you can run the following command to run tests sequentially:
rake BS_USERNAME=<username> BS_AUTHKEY=<access_key> nodes=1

Are the built-in integration tests run concurrently or sequentially?

I am writing integration tests to work with a database. In the start of each test, I clear the storage and create some data.
I want my tests to run sequentially to ensure that I am working with an empty database. But it seems that integration tests are run concurrently because sometimes I get existing documents after cleaning the database.
I checked the database and found that the documents created in different tests have approximately the same creation time, even when I'm adding a delay for each test (with std::thread::sleep_ms(10000)).
Can you clarify how the integration tests are run and is it possible run them in order?
The built-in testing framework runs concurrently by default. It is designed to offer useful but simple support for testing, that covers many needs, and a lot of functionality can/should be tested with each test independent of the others. (Being independent means they can be run in parallel.)
That said, it does listen to the RUST_TEST_THREADS environment variable, e.g. RUST_TEST_THREADS=1 cargo test will run tests on a single thread. However, if you want this functionality for your tests always, you may be interested in not using #[test], or, at least, not directly.
The most flexible way is via cargo's support for tests that completely define their own framework, via something like the following in your Cargo.toml:
[[test]]
name = "foo"
harness = false
With that, cargo test will compile and run tests/foo.rs as a binary. This can then ensure that operations are sequenced/reset appropriately.
Alternatively, maybe a framework like stainless has the functionality you need. (I've not used it so I'm not sure.)
An alternative to an env var is the --test-threads flag. Set it to a single thread to run your tests sequentially.
cargo test -- --test-threads 1

Resources