magento2-functional-testing-framework icon indicating copy to clipboard operation
magento2-functional-testing-framework copied to clipboard

Bug: Parallel run executes Suite's <before> and <after> in each process

Open lbajsarowicz opened this issue 4 years ago • 3 comments

Preconditions

  1. Generate parallel tests
  2. Execute them with vendor/bin/codecept run -cdev/tests/acceptance/codeception.yml VertexCompleteSuite_0

Parallel tests expected (1)

Steps to reproduce

N/A

Expected result

As described on the diagram:

  1. Only one process should be responsible for running <before> (the first one that reached that point)
  2. Only one process should be responsible for running <after> (the last that finished tests)
  3. Tests should share the exit code (0 for success / 1 for failure)

Actual result

  1. When one process finish it's work, it runs <after> section destroying the test environment for other workers.

lbajsarowicz avatar Mar 24 '20 12:03 lbajsarowicz

Hi @lbajsarowicz! Are you noticing this with a specific version of codeception? I am working with codeception 4.1.4 and I think I see this problem with suite runs in parallel, codeception 2.4.5 didnt seem to have this issue.

soumyau avatar Apr 04 '20 14:04 soumyau

@soumyau I've noticed that issue on 2.4.5.

lbajsarowicz avatar Apr 04 '20 22:04 lbajsarowicz

Not sure if this is related, but if 2 tests run in parallel, and one finishes before the other, then the one that is still running crashes immediately with:

/******** Beginning execution of Suite1 suite after block ********/
LAST TEST IN SUITE FAILED, TEST AFTER MAY NOT BE SUCCESSFUL
No active session with ID 7b81e380a9c165325f08a3063d08ba57
In WebDriverException.php line 107:

  [Facebook\WebDriver\Exception\InvalidSessionIdException]
  No active session with ID 7b81e380a9c165325f08a3063d08ba57


Exception trace:
  at /www/magento2_1/vendor/php-webdriver/webdriver/lib/Exception/WebDriverException.php:107
 Facebook\WebDriver\Exception\WebDriverException::throwException() at /www/magento2_1/vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php:370
 Facebook\WebDriver\Remote\HttpCommandExecutor->execute() at /www/magento2_1/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php:590
 Facebook\WebDriver\Remote\RemoteWebDriver->execute() at /www/magento2_1/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php:315
 Facebook\WebDriver\Remote\RemoteWebDriver->quit() at /www/magento2_1/vendor/codeception/module-webdriver/src/Codeception/Module/WebDriver.php:1558
 Codeception\Module\WebDriver->_closeSession() at /www/magento2_1/vendor/codeception/module-webdriver/src/Codeception/Module/WebDriver.php:659
 Codeception\Module\WebDriver->stopAllSessions() at /www/magento2_1/vendor/codeception/module-webdriver/src/Codeception/Module/WebDriver.php:653
 Codeception\Module\WebDriver->_afterSuite() at /www/magento2_1/vendor/codeception/codeception/src/Codeception/Subscriber/Module.php:45
 Codeception\Subscriber\Module->afterSuite() at /www/magento2_1/vendor/symfony/event-dispatcher/EventDispatcher.php:264
 Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() at /www/magento2_1/vendor/symfony/event-dispatcher/EventDispatcher.php:239
 Symfony\Component\EventDispatcher\EventDispatcher->callListeners() at /www/magento2_1/vendor/symfony/event-dispatcher/EventDispatcher.php:73
 Symfony\Component\EventDispatcher\EventDispatcher->dispatch() at /www/magento2_1/vendor/codeception/codeception/src/Codeception/Event/DispatcherWrapper.php:25
 Codeception\SuiteManager->dispatch() at /www/magento2_1/vendor/codeception/codeception/src/Codeception/SuiteManager.php:163
 Codeception\SuiteManager->run() at /www/magento2_1/vendor/codeception/codeception/src/Codeception/Codecept.php:208
 Codeception\Codecept->runSuite() at /www/magento2_1/vendor/codeception/codeception/src/Codeception/Codecept.php:162
 Codeception\Codecept->run() at /www/magento2_1/vendor/codeception/codeception/src/Codeception/Command/Run.php:511
 Codeception\Command\Run->runSuites() at /www/magento2_1/vendor/codeception/codeception/src/Codeception/Command/Run.php:405
 Codeception\Command\Run->execute() at /www/magento2_1/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /www/magento2_1/vendor/symfony/console/Application.php:1009
 Symfony\Component\Console\Application->doRunCommand() at /www/magento2_1/vendor/symfony/console/Application.php:273
 Symfony\Component\Console\Application->doRun() at /www/magento2_1/vendor/symfony/console/Application.php:149
 Symfony\Component\Console\Application->run() at /www/magento2_1/vendor/codeception/codeception/src/Codeception/Application.php:117
 Codeception\Application->run() at /www/magento2_1/vendor/codeception/codeception/app.php:46
 {closure}() at /www/magento2_1/vendor/codeception/codeception/app.php:47
 require() at /www/magento2_1/vendor/codeception/codeception/codecept:7

snez avatar Apr 16 '21 13:04 snez