Skip to content

Commit dd35d9d

Browse files
committed
MQE-1331: MFTF Run:Test Will Run All Tests That Are Already Generated
updated code to run only tests specified in run command
1 parent 3a73b31 commit dd35d9d

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

src/Magento/FunctionalTestingFramework/Console/RunTestCommand.php

Lines changed: 26 additions & 11 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;
@@ -88,18 +89,32 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8889
$command->run(new ArrayInput($args), $output);
8990
}
9091

91-
// we only generate relevant tests here so we can execute "all tests"
92-
$codeceptionCommand = realpath(PROJECT_ROOT . '/vendor/bin/codecept') . " run functional --verbose --steps";
92+
$returnCode = 0;
93+
//execute only tests specified as arguments in run command
94+
foreach ($tests as $test) {
95+
$codeceptionCommand = realpath(PROJECT_ROOT . '/vendor/bin/codecept') . ' run functional ';
96+
$test = TESTS_MODULE_PATH .
97+
DIRECTORY_SEPARATOR .
98+
TestGenerator::GENERATED_DIR .
99+
DIRECTORY_SEPARATOR .
100+
TestGenerator::DEFAULT_DIR .
101+
DIRECTORY_SEPARATOR .
102+
$test .
103+
'Cest.php';
104+
$codeceptionCommand .= $test;
105+
$codeceptionCommand .= ' --verbose --steps';
93106

94-
$process = new Process($codeceptionCommand);
95-
$process->setWorkingDirectory(TESTS_BP);
96-
$process->setIdleTimeout(600);
97-
$process->setTimeout(0);
107+
$process = new Process($codeceptionCommand);
108+
$process->setWorkingDirectory(TESTS_BP);
109+
$process->setIdleTimeout(600);
110+
$process->setTimeout(0);
98111

99-
return $process->run(
100-
function ($type, $buffer) use ($output) {
101-
$output->write($buffer);
102-
}
103-
);
112+
$returnCode = max($returnCode, $process->run(
113+
function ($type, $buffer) use ($output) {
114+
$output->write($buffer);
115+
}
116+
));
117+
}
118+
return $returnCode;
104119
}
105120
}

0 commit comments

Comments
 (0)