Skip to content

MFTF 2.3.6 - Merge to master #221

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 18 commits into from
Sep 5, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
7610008
MQE-1118: Handle XML merge failures gracefully (#202)
aljcalandra Aug 16, 2018
19effcc
MQE-1088: If stepKey is in a selector, incorrect generation occurs
Clendenin Aug 17, 2018
ba061e6
MQE-1161: Extended Tests With No Parents Are Skipped (#204)
aljcalandra Aug 20, 2018
487a9c0
Merge pull request #206 from magento/master
okolesnyk Aug 24, 2018
5d6d254
MQE-1157: Add readiness bypass to test actions (#207)
aljcalandra Aug 28, 2018
dc102e7
MQE-1184: Describe which entity reference fails in generate:tests
KevinBKozan Aug 28, 2018
00e78f8
MQE-1123: Impossible remove data created in preconditions from test s…
KevinBKozan Aug 29, 2018
ed94ab4
MQE-1189: Suite Generation - Precondition body must always get and re…
jilu1 Aug 29, 2018
268c9ff
MQE-1168: magentoCLI action not working properly if URL to magento co…
jilu1 Aug 29, 2018
33743fa
MQE-1009: Generated Suites Are Not Cleaned Up When Regenerating
jilu1 Aug 30, 2018
e187c33
Merge pull request #212 from magento/MQE-1189
jilu1 Aug 30, 2018
4328833
Removed PHP_BINARY usage from command.php as it will not work with PH…
nathanjosiah Aug 30, 2018
928c5b8
Merge pull request #217 from magento-trigger/fpm-compatibility
KevinBKozan Aug 31, 2018
652b599
Merge pull request #215 from magento/MQE-1009
jilu1 Aug 31, 2018
8c80ca8
Merge pull request #213 from magento/MQE-1168
jilu1 Aug 31, 2018
9acb400
MQE-1236: Allure Does Not Show Results For Tests With Duplicate Title…
KevinBKozan Aug 31, 2018
607418f
MFTF 2.3.6 - CHANGELOG.md
KevinBKozan Sep 4, 2018
31ddcc8
MQE-1242: Commit proper version in MFTF composer.json
KevinBKozan Sep 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
MQE-1009: Generated Suites Are Not Cleaned Up When Regenerating
- bug fix
  • Loading branch information
jilu1 committed Aug 30, 2018
commit 33743faf92cf6f02e82732d8488d58f773f40ce6
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php
// @codingStandardsIgnoreFile
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types = 1);

namespace Magento\FunctionalTestingFramework\Console;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Magento\FunctionalTestingFramework\Util\Filesystem\DirSetupUtil;
use Magento\FunctionalTestingFramework\Util\TestGenerator;

class BaseGenerateCommand extends Command
{
/**
* Configures the base command.
*
* @return void
*/
protected function configure()
{
$this->addOption(
'remove',
'r',
InputOption::VALUE_NONE,
'remove previous generated suites and tests'
);
}

/**
* Remove GENERATED_DIR if exists when running generate:tests.
*
* @param OutputInterface $output
* @param bool $verbose
* @return void
*/
protected function removeGeneratedDirectory(OutputInterface $output, bool $verbose)
{
$generatedDirectory = TESTS_MODULE_PATH . DIRECTORY_SEPARATOR . TestGenerator::GENERATED_DIR;

if (file_exists($generatedDirectory)) {
DirSetupUtil::rmdirRecursive($generatedDirectory);
if ($verbose) {
$output->writeln("removed files and directory $generatedDirectory");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
namespace Magento\FunctionalTestingFramework\Console;

use Magento\FunctionalTestingFramework\Suite\SuiteGenerator;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class GenerateSuiteCommand extends Command
class GenerateSuiteCommand extends BaseGenerateCommand
{
/**
* Configures the current command.
Expand All @@ -29,6 +28,8 @@ protected function configure()
InputArgument::IS_ARRAY | InputArgument::REQUIRED,
'argument which indicates suite names for generation (separated by space)'
);

parent::configure();
}

/**
Expand All @@ -41,6 +42,13 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$remove = $input->getOption('remove');

// Remove previous GENERATED_DIR if --remove option is used
if ($remove) {
$this->removeGeneratedDirectory($output, $output->isVerbose());
}

$suites = $input->getArgument('suites');

foreach ($suites as $suite) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@
use Magento\FunctionalTestingFramework\Util\Manifest\ParallelTestManifest;
use Magento\FunctionalTestingFramework\Util\Manifest\TestManifestFactory;
use Magento\FunctionalTestingFramework\Util\TestGenerator;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class GenerateTestsCommand extends Command
class GenerateTestsCommand extends BaseGenerateCommand
{
/**
* Configures the current command.
Expand Down Expand Up @@ -52,7 +51,14 @@ protected function configure()
't',
InputOption::VALUE_REQUIRED,
'A parameter accepting a JSON string used to determine the test configuration'
)->addOption('debug', 'd', InputOption::VALUE_NONE, 'run extra validation when generating tests');
)->addOption(
'debug',
'd',
InputOption::VALUE_NONE,
'run extra validation when generating tests'
);

parent::configure();
}

/**
Expand All @@ -73,6 +79,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$force = $input->getOption('force');
$time = $input->getOption('time') * 60 * 1000; // convert from minutes to milliseconds
$debug = $input->getOption('debug');
$remove = $input->getOption('remove');

$verbose = $output->isVerbose();

if ($json !== null && !json_decode($json)) {
Expand All @@ -85,6 +93,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
throw new TestFrameworkException("time option cannot be less than or equal to 0");
}

// Remove previous GENERATED_DIR if --remove option is used
if ($remove) {
$this->removeGeneratedDirectory($output, $verbose || $debug);
}

$testConfiguration = $this->createTestConfiguration($json, $tests, $force, $debug, $verbose);

// create our manifest file here
Expand Down Expand Up @@ -153,7 +166,6 @@ private function createTestConfiguration($json, array $tests, bool $force, bool
*
* @param string $json
* @param array $testConfiguration
* @throws TestFrameworkException
* @return array
*/
private function parseTestsConfigJson($json, array $testConfiguration)
Expand Down
18 changes: 14 additions & 4 deletions src/Magento/FunctionalTestingFramework/Console/RunTestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@

namespace Magento\FunctionalTestingFramework\Console;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Process\Process;
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;

class RunTestCommand extends Command
class RunTestCommand extends BaseGenerateCommand
{
/**
* Configures the current command.
Expand All @@ -38,6 +37,8 @@ protected function configure()
InputOption::VALUE_NONE,
'force generation of tests regardless of Magento Instance Configuration'
);

parent::configure();
}

/**
Expand All @@ -55,6 +56,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
$tests = $input->getArgument('name');
$skipGeneration = $input->getOption('skip-generate');
$force = $input->getOption('force');
$remove = $input->getOption('remove');

if ($skipGeneration and $remove) {
// "skip-generate" and "remove" options cannot be used at the same time
throw new TestFrameworkException(
"\"skip-generate\" and \"remove\" options can not be used at the same time."
);
}

if (!$skipGeneration) {
$command = $this->getApplication()->find('generate:tests');
Expand All @@ -63,7 +72,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
'tests' => $tests,
'suites' => null
]),
'--force' => $force
'--force' => $force,
'--remove' => $remove
];
$command->run(new ArrayInput($args), $output);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
use Magento\FunctionalTestingFramework\Suite\Handlers\SuiteObjectHandler;
use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig;
use Magento\FunctionalTestingFramework\Test\Handlers\TestObjectHandler;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Process\Process;
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;

class RunTestGroupCommand extends Command
class RunTestGroupCommand extends BaseGenerateCommand
{
/**
* Configures the current command.
Expand All @@ -44,6 +44,8 @@ protected function configure()
InputArgument::IS_ARRAY | InputArgument::REQUIRED,
'group names to be executed via codeception'
);

parent::configure();
}

/**
Expand All @@ -61,6 +63,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
$skipGeneration = $input->getOption('skip-generate');
$force = $input->getOption('force');
$groups = $input->getArgument('groups');
$remove = $input->getOption('remove');

if ($skipGeneration and $remove) {
// "skip-generate" and "remove" options cannot be used at the same time
throw new TestFrameworkException(
"\"skip-generate\" and \"remove\" options can not be used at the same time."
);
}

// Create Mftf Configuration
MftfApplicationConfig::create(
Expand All @@ -75,7 +85,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$command = $this->getApplication()->find('generate:tests');
$args = [
'--tests' => $testConfiguration,
'--force' => $force
'--force' => $force,
'--remove' => $remove
];

$command->run(new ArrayInput($args), $output);
Expand Down