-
Notifications
You must be signed in to change notification settings - Fork 132
MQE-1331: MFTF Run:Test Will Run All Tests That Are Already Generated #427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
updated code to run only tests specified in run command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small code structure suggestion, but otherwise this change works well 👍
//execute only tests specified as arguments in run command | ||
foreach ($tests as $test) { | ||
$codeceptionCommand = realpath(PROJECT_ROOT . '/vendor/bin/codecept') . ' run functional '; | ||
$test = TESTS_MODULE_PATH . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about restructuring this a little bit:
$returnCode = 0;
$codeceptionCommand = realpath(PROJECT_ROOT . '/vendor/bin/codecept') . ' run functional ';
$testsDirectory = TESTS_MODULE_PATH . DIRECTORY_SEPARATOR . TestGenerator::GENERATED_DIR . DIRECTORY_SEPARATOR;
//execute only tests specified as arguments in run command
foreach ($tests as $test) {
$testGroup = TestGenerator::DEFAULT_DIR . DIRECTORY_SEPARATOR;
$testName = $test . 'Cest.php';
$fullCommand = $codeceptionCommand . $testsDirectory . $testGroup . $testName . '--verbose --steps';
This sets up for easier refactor when we implement running a test in the suite context, since whoever touches it only needs to redefine $testGroup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restructured it this way. I like the part where we are moving static portions of the command outside of foreach
.
restructured command formation
$process = new Process($codeceptionCommand); | ||
$testGroup = TestGenerator::DEFAULT_DIR . DIRECTORY_SEPARATOR; | ||
$testName = $test . 'Cest.php'; | ||
$fullCommand = $codeceptionCommand . $testsDirectory . $testGroup . $testName . ' --verbose --steps'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you feel about adding in some explicit error checking:
if (!realpath($testsDirectory . $testGroup . $testName))
Right now if I try to reference a test that isn't generated I get a massive stack trace and an exception in Loader.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, looks like this is a pre-existing error. Good catch.
added error handling
ACQE-7278: Add support for chrome 131
updated code to run only tests specified in run command
Description
Fixed Issues (if relevant)
Contribution checklist