Skip to content

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

Merged
merged 5 commits into from
Aug 26, 2019

Conversation

soumyau
Copy link
Contributor

@soumyau soumyau commented Aug 20, 2019

  • MC-1331
    updated code to run only tests specified in run command

Description

Fixed Issues (if relevant)

  1. magento/magento2-functional-testing-framework#<issue_number>: Issue title
  2. ...

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/verification tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)
  • Changes to Framework doesn't have backward incompatible changes for tests or have related Pull Request with fixes to tests

updated code to run only tests specified in run command
@coveralls
Copy link

coveralls commented Aug 20, 2019

Coverage Status

Coverage remained the same at 52.176% when pulling 9006361 on MQE-1331 into 8f54cbb on develop.

Copy link
Contributor

@KevinBKozan KevinBKozan left a 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 .
Copy link
Contributor

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

Copy link
Contributor Author

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.

$process = new Process($codeceptionCommand);
$testGroup = TestGenerator::DEFAULT_DIR . DIRECTORY_SEPARATOR;
$testName = $test . 'Cest.php';
$fullCommand = $codeceptionCommand . $testsDirectory . $testGroup . $testName . ' --verbose --steps';
Copy link
Contributor

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

Copy link
Contributor Author

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.

@soumyau soumyau merged commit ee12a62 into develop Aug 26, 2019
@jilu1 jilu1 deleted the MQE-1331 branch February 6, 2020 16:55
magento-devops-reposync-svc pushed a commit that referenced this pull request Jan 7, 2025
ACQE-7278: Add support for chrome 131
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants