Skip to content

Commit b6bcab4

Browse files
committed
MQE-982: Verification Test around Suite Generation
- Moved _suite to verification - Removed check to discard manifest.txt - Updated funcitonalSuiteHooks and corresponding resource file - Added mock to bootstrap to set file paths
1 parent 94e9124 commit b6bcab4

File tree

5 files changed

+30
-10
lines changed

5 files changed

+30
-10
lines changed

dev/tests/_bootstrap.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,27 @@
6262
require($unitUtilFile);
6363
}
6464

65+
66+
// Mocks suite files location getter return to get files in verification/_suite Directory
67+
// This mocks the paths of the suite files but still parses the xml files
68+
$suiteDirectory = TESTS_BP . DIRECTORY_SEPARATOR . "verification" . DIRECTORY_SEPARATOR . "_suite";
69+
70+
$paths = [
71+
$suiteDirectory . DIRECTORY_SEPARATOR . 'functionalSuite.xml',
72+
$suiteDirectory . DIRECTORY_SEPARATOR . 'functionalSuiteHooks.xml'
73+
];
74+
75+
// create and return the iterator for these file paths
76+
$iterator = new Magento\FunctionalTestingFramework\Util\Iterator\File($paths);
77+
try {
78+
AspectMock\Test::double(
79+
Magento\FunctionalTestingFramework\Config\FileResolver\Root::class,
80+
['get' => $iterator]
81+
)->make();
82+
} catch (Exception $e) {
83+
echo "Suite directory not mocked.";
84+
}
85+
6586
function sortInterfaces($files)
6687
{
6788
$bottom = [];

dev/tests/verification/Resources/functionalSuiteHooks.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class functionalSuiteHooks extends \Codeception\GroupObject
5454
// initialize the webdriver session
5555
$webDriver->_initializeSession();
5656
$webDriver->amOnPage("some.url");
57-
$createFields['someKey'] = ;
57+
$createFields['someKey'] = "dataHere";
5858
$createThis = DataObjectHandler::getInstance()->getObject("createThis");
5959
$this->create = new DataPersistenceHandler($createThis, [], $createFields);
6060
$this->create->createEntity();

dev/tests/verification/Tests/SuiteGenerationTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@
66

77
namespace tests\verification\Tests;
88

9+
use AspectMock\Test as AspectMock;
910
use Magento\Framework\Module\Dir;
11+
use Magento\FunctionalTestingFramework\Config\FileResolver\Root;
1012
use Magento\FunctionalTestingFramework\Suite\SuiteGenerator;
1113
use Magento\FunctionalTestingFramework\Util\Filesystem\DirSetupUtil;
14+
use Magento\FunctionalTestingFramework\Util\Iterator\File;
1215
use Magento\FunctionalTestingFramework\Util\Manifest\ParallelTestManifest;
1316
use Magento\FunctionalTestingFramework\Util\Manifest\TestManifestFactory;
1417
use Symfony\Component\Yaml\Yaml;
1518
use tests\util\MftfTestCase;
1619

1720
class SuiteGenerationTest extends MftfTestCase
1821
{
22+
const TESTS_BP = DIRECTORY_SEPARATOR;
1923
const RESOURCES_DIR = TESTS_BP . DIRECTORY_SEPARATOR . 'verification' . DIRECTORY_SEPARATOR . 'Resources';
2024
const CONFIG_YML_FILE = FW_BP . DIRECTORY_SEPARATOR . SuiteGenerator::YAML_CODECEPTION_CONFIG_FILENAME;
2125
const GENERATE_RESULT_DIR = TESTS_BP .
@@ -49,11 +53,6 @@ public static function setUpBeforeClass()
4953
return;
5054
}
5155

52-
// destroy manifest file if it exists
53-
if (file_exists(self::getManifestFilePath())) {
54-
unlink(self::getManifestFilePath());
55-
}
56-
5756
// destroy _generated if it exists
5857
if (file_exists(self::GENERATE_RESULT_DIR)) {
5958
DirSetupUtil::rmdirRecursive(self::GENERATE_RESULT_DIR);
@@ -68,7 +67,7 @@ public static function setUpBeforeClass()
6867
*/
6968
public function testSuiteGeneration1()
7069
{
71-
$groupName = 'functionalSuite1';
70+
$groupName = 'functionalSuite1';
7271

7372
$expectedContents = [
7473
'additionalTestCest.php',

dev/_suite/functionalSuite.xml renamed to dev/tests/verification/_suite/functionalSuite.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88

9-
<suites xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../src/Magento/FunctionalTestingFramework/Suite/etc/suiteSchema.xsd">
9+
<suites xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../src/Magento/FunctionalTestingFramework/Suite/etc/suiteSchema.xsd">
1010
<suite name="functionalSuite1">
1111
<include>
1212
<group name="include"/>

dev/_suite/functionalSuiteHooks.xml renamed to dev/tests/verification/_suite/functionalSuiteHooks.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
*/
77
-->
88

9-
<suites xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../src/Magento/FunctionalTestingFramework/Suite/etc/suiteSchema.xsd">
9+
<suites xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../src/Magento/FunctionalTestingFramework/Suite/etc/suiteSchema.xsd">
1010
<suite name="functionalSuiteHooks">
1111
<include>
1212
<test name="IncludeTest"/>
1313
</include>
1414
<before>
1515
<amOnPage url="some.url" stepKey="before"/>
1616
<createData entity="createThis" stepKey="create">
17-
<field key="someKey"/>
17+
<field key="someKey">dataHere</field>
1818
</createData>
1919
</before>
2020
<after>

0 commit comments

Comments
 (0)