-
Notifications
You must be signed in to change notification settings - Fork 132
MQE-1703: Implicit Suite Generation for Tests #434
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
fixing unit tests
fixing unit tests
fixing unit tests
fixing unit tests
fixing unit tests
fixing unit tests
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.
I had several smaller comments I was making as I was seeing code issues, but I condensed it down to one comment. Let me know if you need/want more info on it or want to pair program this, it's not a super straightforward problem.
fixing bug with test generation
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.
Minor code style changes but core functionality is working!
@@ -104,4 +111,27 @@ function ($type, $buffer) use ($output) { | |||
} | |||
return $returnCode; | |||
} | |||
|
|||
/** Get an array of tests with resolved suite references from $testConfiguration |
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.
Top of docblock needs empty line
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
); | ||
} | ||
// configuration for tests | ||
else $testConfiguration['tests'][] = $test; |
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.
Need to use multiline else formatting:
} else {
$testConfiguration['tests'][] = $test;
}
$testConfiguration['tests'] = null; | ||
$testConfiguration['suites'] = null; | ||
$testsReferencedInSuites = SuiteObjectHandler::getInstance()->getAllTestReferences(); | ||
$resolvedTests = []; |
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.
Very minor but rename this to $suiteToTestPair
, I thought at first this would hold either type of test but it only holds suite:test pairs
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.
changed.
foreach($tests as $test) { | ||
if (array_key_exists($test, $testsReferencedInSuites)) { | ||
$suites = $testsReferencedInSuites[$test]; | ||
$resolvedTests = array_merge( |
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.
Can we change this array_merge/map combo to something a little more simple?
foreach ($suites as $suite) {
$resolvedTests[] = "$suite:$test";
}
array_map/merge are both recursive loops at the language level (at least I know map is) so this alternative is either equal or actually faster (easier to read in either case)
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.
was trying to avoid nested loops as I didn't find many implementations of it in code, thought it was a style thing. Changed it.
$testArrayBuilder = []; | ||
|
||
foreach ($suitesArray as $suite => $tests) { | ||
$testArrayBuilder = array_merge( |
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.
See commend in BaseGenerateCommand, this can probably be simplified into one foreach
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.
changed
Style fixes
style fixes
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.
Updated as per review comments.
$testConfiguration['tests'] = null; | ||
$testConfiguration['suites'] = null; | ||
$testsReferencedInSuites = SuiteObjectHandler::getInstance()->getAllTestReferences(); | ||
$resolvedTests = []; |
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.
changed.
@@ -104,4 +111,27 @@ function ($type, $buffer) use ($output) { | |||
} | |||
return $returnCode; | |||
} | |||
|
|||
/** Get an array of tests with resolved suite references from $testConfiguration |
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
$testArrayBuilder = []; | ||
|
||
foreach ($suitesArray as $suite => $tests) { | ||
$testArrayBuilder = array_merge( |
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.
changed
foreach($tests as $test) { | ||
if (array_key_exists($test, $testsReferencedInSuites)) { | ||
$suites = $testsReferencedInSuites[$test]; | ||
$resolvedTests = array_merge( |
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.
was trying to avoid nested loops as I didn't find many implementations of it in code, thought it was a style thing. Changed it.
Description
Fixed Issues (if relevant)
Contribution checklist