Which of the following is the main benefit of running Selenium tests in parallel during Continuous Integration (CI)?
Think about how running multiple tests at the same time affects the overall testing process duration.
Parallelization allows multiple tests to run at once, which speeds up the total testing time. Other options describe benefits that are not guaranteed by parallelization.
Given the following TestNG XML configuration snippet for parallel test execution, what will be the total number of threads used?
<suite name="ParallelSuite" parallel="tests" thread-count="3"> <test name="Test1"> <classes> <class name="tests.LoginTest"/> </classes> </test> <test name="Test2"> <classes> <class name="tests.SearchTest"/> </classes> </test> <test name="Test3"> <classes> <class name="tests.CartTest"/> </classes> </test> </suite>
Look at the 'parallel' attribute and 'thread-count' in the suite tag.
Setting parallel="tests" with thread-count="3" means TestNG will run up to 3 tests in parallel, one thread per test.
In a Selenium test suite running in parallel on CI, tests intermittently fail with 'ElementNotInteractableException'. What is the most likely cause?
Consider what happens if multiple tests try to control the same browser session at once.
Sharing a single WebDriver instance across parallel tests causes conflicts and flaky failures. Each test should have its own WebDriver instance.
Which assertion correctly verifies that all parallel Selenium tests have completed successfully in a CI environment?
List<TestResult> results = testExecutor.getAllResults(); // Choose the correct assertion below
Think about how to check that every test result indicates success.
Option D checks that all test results are successful. Other options check for empty or null results, which are incorrect.
In a Selenium Java framework running tests in parallel on CI, which approach ensures thread-safe WebDriver usage?
Consider how to isolate WebDriver instances per test thread safely.
ThreadLocal allows each thread to have its own WebDriver instance, preventing conflicts in parallel runs. Sharing a static or global instance causes interference.