|
8 | 8 | namespace Magento\FunctionalTestingFramework\Console;
|
9 | 9 |
|
10 | 10 | use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig;
|
| 11 | +use Magento\FunctionalTestingFramework\Util\TestGenerator; |
11 | 12 | use Symfony\Component\Console\Input\ArrayInput;
|
12 | 13 | use Symfony\Component\Console\Input\InputArgument;
|
13 | 14 | use Symfony\Component\Console\Input\InputInterface;
|
@@ -77,18 +78,30 @@ protected function execute(InputInterface $input, OutputInterface $output): int
|
77 | 78 | $command->run(new ArrayInput($args), $output);
|
78 | 79 | }
|
79 | 80 |
|
80 |
| - // we only generate relevant tests here so we can execute "all tests" |
81 |
| - $codeceptionCommand = realpath(PROJECT_ROOT . '/vendor/bin/codecept') . " run functional --verbose --steps"; |
82 |
| - |
83 |
| - $process = new Process($codeceptionCommand); |
84 |
| - $process->setWorkingDirectory(TESTS_BP); |
85 |
| - $process->setIdleTimeout(600); |
86 |
| - $process->setTimeout(0); |
87 |
| - |
88 |
| - return $process->run( |
89 |
| - function ($type, $buffer) use ($output) { |
90 |
| - $output->write($buffer); |
| 81 | + $returnCode = 0; |
| 82 | + $codeceptionCommand = realpath(PROJECT_ROOT . '/vendor/bin/codecept') . ' run functional '; |
| 83 | + $testsDirectory = TESTS_MODULE_PATH . DIRECTORY_SEPARATOR . TestGenerator::GENERATED_DIR . DIRECTORY_SEPARATOR; |
| 84 | + //execute only tests specified as arguments in run command |
| 85 | + foreach ($tests as $test) { |
| 86 | + $testGroup = TestGenerator::DEFAULT_DIR . DIRECTORY_SEPARATOR; |
| 87 | + $testName = $test . 'Cest.php'; |
| 88 | + if (!realpath($testsDirectory . $testGroup . $testName)) { |
| 89 | + throw new TestFrameworkException( |
| 90 | + $testName . " is not available under " . $testsDirectory . $testGroup |
| 91 | + ); |
91 | 92 | }
|
92 |
| - ); |
| 93 | + $fullCommand = $codeceptionCommand . $testsDirectory . $testGroup . $testName . ' --verbose --steps'; |
| 94 | + $process = new Process($fullCommand); |
| 95 | + $process->setWorkingDirectory(TESTS_BP); |
| 96 | + $process->setIdleTimeout(600); |
| 97 | + $process->setTimeout(0); |
| 98 | + |
| 99 | + $returnCode = max($returnCode, $process->run( |
| 100 | + function ($type, $buffer) use ($output) { |
| 101 | + $output->write($buffer); |
| 102 | + } |
| 103 | + )); |
| 104 | + } |
| 105 | + return $returnCode; |
93 | 106 | }
|
94 | 107 | }
|
0 commit comments