Skip to content

Commit c9120e0

Browse files
authored
Merge branch 'develop' into MQE-1055
2 parents 49c9649 + ee12a62 commit c9120e0

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
lines changed

src/Magento/FunctionalTestingFramework/Console/GenerateTestsCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
123123
* @throws \Magento\FunctionalTestingFramework\Exceptions\XmlException
124124
*/
125125
private function createTestConfiguration(
126-
string $json,
126+
$json,
127127
array $tests,
128128
bool $force,
129129
string $debug,

src/Magento/FunctionalTestingFramework/Console/RunTestCommand.php

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\FunctionalTestingFramework\Console;
99

1010
use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig;
11+
use Magento\FunctionalTestingFramework\Util\TestGenerator;
1112
use Symfony\Component\Console\Input\ArrayInput;
1213
use Symfony\Component\Console\Input\InputArgument;
1314
use Symfony\Component\Console\Input\InputInterface;
@@ -77,18 +78,30 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7778
$command->run(new ArrayInput($args), $output);
7879
}
7980

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+
);
9192
}
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;
93106
}
94107
}

0 commit comments

Comments
 (0)