Skip to content

Commit 0175b2e

Browse files
authored
Merge branch 'develop' into MQE-1185
2 parents 6cfe985 + 584082c commit 0175b2e

File tree

8 files changed

+148
-681
lines changed

8 files changed

+148
-681
lines changed

dev/tests/_bootstrap.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@
8282

8383
$paths = [
8484
$suiteDirectory . DIRECTORY_SEPARATOR . 'functionalSuite.xml',
85-
$suiteDirectory . DIRECTORY_SEPARATOR . 'functionalSuiteHooks.xml'
85+
$suiteDirectory . DIRECTORY_SEPARATOR . 'functionalSuiteHooks.xml',
86+
$suiteDirectory . DIRECTORY_SEPARATOR . 'functionalSuiteExtends.xml'
8687
];
8788

8889
// create and return the iterator for these file paths
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
namespace Magento\AcceptanceTest\_suiteExtends\Backend;
3+
4+
use Magento\FunctionalTestingFramework\AcceptanceTester;
5+
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\CredentialStore;
6+
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\PersistedObjectHandler;
7+
use \Codeception\Util\Locator;
8+
use Yandex\Allure\Adapter\Annotation\Features;
9+
use Yandex\Allure\Adapter\Annotation\Stories;
10+
use Yandex\Allure\Adapter\Annotation\Title;
11+
use Yandex\Allure\Adapter\Annotation\Description;
12+
use Yandex\Allure\Adapter\Annotation\Parameter;
13+
use Yandex\Allure\Adapter\Annotation\Severity;
14+
use Yandex\Allure\Adapter\Model\SeverityLevel;
15+
use Yandex\Allure\Adapter\Annotation\TestCaseId;
16+
17+
/**
18+
* @Title("[NO TESTCASEID]: ExtendedTestInSuiteChildTest")
19+
* @group ExtendedTestInSuiteChildTest
20+
*/
21+
class ExtendedTestInSuiteChildTestCest
22+
{
23+
/**
24+
* @param AcceptanceTester $I
25+
* @throws \Exception
26+
*/
27+
public function _before(AcceptanceTester $I)
28+
{
29+
$I->amOnPage("/beforeUrl");
30+
}
31+
32+
/**
33+
* @param AcceptanceTester $I
34+
* @throws \Exception
35+
*/
36+
public function _after(AcceptanceTester $I)
37+
{
38+
$I->amOnPage("/afterUrl");
39+
}
40+
41+
/**
42+
* @param AcceptanceTester $I
43+
* @throws \Exception
44+
*/
45+
public function _failed(AcceptanceTester $I)
46+
{
47+
$I->saveScreenshot();
48+
}
49+
50+
/**
51+
* @Severity(level = SeverityLevel::TRIVIAL)
52+
* @Features({"TestModule"})
53+
* @Stories({"ExtendedTestInSuiteChildTest"})
54+
* @Parameter(name = "AcceptanceTester", value="$I")
55+
* @param AcceptanceTester $I
56+
* @return void
57+
* @throws \Exception
58+
*/
59+
public function ExtendedTestInSuiteChildTest(AcceptanceTester $I)
60+
{
61+
$I->comment("Different Input");
62+
}
63+
}

dev/tests/verification/TestModule/Test/ExtendedFunctionalTest.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,32 @@
158158
</annotations>
159159
<comment userInput="child" stepKey="replaceMe"/>
160160
</test>
161+
162+
<test name="ExtendedTestInSuiteParentTest">
163+
<annotations>
164+
<severity value="AVERAGE"/>
165+
<title value="ExtendedTestInSuiteParentTest"/>
166+
<group value="ExtendedTestInSuite"/>
167+
<features value="ExtendedTestInSuite"/>
168+
<stories value="ExtendedTestInSuite"/>
169+
</annotations>
170+
<before>
171+
<amOnPage url="/beforeUrl" stepKey="beforeAmOnPageKey"/>
172+
</before>
173+
<after>
174+
<amOnPage url="/afterUrl" stepKey="afterAmOnPageKey"/>
175+
</after>
176+
<comment stepKey="basicCommentWithNoData" userInput="Parent Comment"/>
177+
</test>
178+
179+
<test name="ExtendedTestInSuiteChildTest" extends="ExtendedTestInSuiteParentTest">
180+
<annotations>
181+
<severity value="MINOR"/>
182+
<title value="ExtendedTestInSuiteChildTest"/>
183+
<group value="ExtendedTestInSuiteChildTest"/>
184+
<features value="ExtendedTestInSuiteChildTest"/>
185+
<stories value="ExtendedTestInSuiteChildTest"/>
186+
</annotations>
187+
<comment stepKey="basicCommentWithNoData" userInput="Different Input"/>
188+
</test>
161189
</tests>

dev/tests/verification/Tests/SuiteGenerationTest.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,45 @@ public function testSuiteGenerationSingleRun()
285285
$this->assertEquals($expectedManifest, file_get_contents(self::getManifestFilePath()));
286286
}
287287

288+
/**
289+
* Test extends tests generation in a suite
290+
*/
291+
public function testSuiteGenerationWithExtends()
292+
{
293+
$groupName = 'suiteExtends';
294+
295+
$expectedContents = [
296+
'ExtendedTestInSuiteChildTestCest.php'
297+
];
298+
299+
// Generate the Suite
300+
SuiteGenerator::getInstance()->generateSuite($groupName);
301+
302+
// Validate log message and add group name for later deletion
303+
TestLoggingUtil::getInstance()->validateMockLogStatement(
304+
'info',
305+
"suite generated",
306+
['suite' => $groupName, 'relative_path' => "_generated" . DIRECTORY_SEPARATOR . $groupName]
307+
);
308+
self::$TEST_GROUPS[] = $groupName;
309+
310+
// Validate Yaml file updated
311+
$yml = Yaml::parse(file_get_contents(self::CONFIG_YML_FILE));
312+
$this->assertArrayHasKey($groupName, $yml['groups']);
313+
314+
$suiteResultBaseDir = self::GENERATE_RESULT_DIR .
315+
DIRECTORY_SEPARATOR .
316+
$groupName .
317+
DIRECTORY_SEPARATOR;
318+
319+
// Validate tests have been generated
320+
$dirContents = array_diff(scandir($suiteResultBaseDir), ['..', '.']);
321+
322+
foreach ($expectedContents as $expectedFile) {
323+
$this->assertTrue(in_array($expectedFile, $dirContents));
324+
}
325+
}
326+
288327
/**
289328
* revert any changes made to config.yml
290329
* remove _generated directory
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<suites xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../src/Magento/FunctionalTestingFramework/Suite/etc/suiteSchema.xsd">
10+
<suite name="suiteExtends">
11+
<include>
12+
<group name="ExtendedTestInSuiteChildTest"/>
13+
</include>
14+
</suite>
15+
</suites>

etc/config/functional.suite.dist.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ modules:
1414
- \Magento\FunctionalTestingFramework\Module\MagentoWebDriver
1515
- \Magento\FunctionalTestingFramework\Helper\Acceptance
1616
- \Magento\FunctionalTestingFramework\Helper\MagentoFakerData
17-
- \Magento\FunctionalTestingFramework\Module\MagentoRestDriver:
18-
url: "%MAGENTO_BASE_URL%/rest/default/V1/"
19-
username: "%MAGENTO_ADMIN_USERNAME%"
20-
password: "%MAGENTO_ADMIN_PASSWORD%"
21-
depends: PhpBrowser
22-
part: Json
2317
- \Magento\FunctionalTestingFramework\Module\MagentoSequence
2418
- \Magento\FunctionalTestingFramework\Module\MagentoAssert
2519
- Asserts

0 commit comments

Comments
 (0)