Skip to content

MQE-1302: MFTF Remove Action Not Working For Extended Test #279

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 3 commits into from
Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ use Yandex\Allure\Adapter\Model\SeverityLevel;
use Yandex\Allure\Adapter\Annotation\TestCaseId;

/**
* @Title("[NO TESTCASEID]: ExtendedTestInSuiteChildTest")
* @group ExtendedTestInSuiteChildTest
* @Title("[NO TESTCASEID]: ExtendedChildTestInSuite")
* @group ExtendedTestInSuite
*/
class ExtendedTestInSuiteChildTestCest
class ExtendedChildTestInSuiteCest
{
/**
* @param AcceptanceTester $I
Expand Down Expand Up @@ -50,13 +50,13 @@ class ExtendedTestInSuiteChildTestCest
/**
* @Severity(level = SeverityLevel::TRIVIAL)
* @Features({"TestModule"})
* @Stories({"ExtendedTestInSuiteChildTest"})
* @Stories({"ExtendedChildTestInSuite"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
* @throws \Exception
*/
public function ExtendedTestInSuiteChildTest(AcceptanceTester $I)
public function ExtendedChildTestInSuite(AcceptanceTester $I)
{
$I->comment("Different Input");
}
Expand Down
62 changes: 62 additions & 0 deletions dev/tests/verification/Resources/ExtendedChildTestNotInSuite.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php
namespace Magento\AcceptanceTest\_default\Backend;

use Magento\FunctionalTestingFramework\AcceptanceTester;
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\CredentialStore;
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\PersistedObjectHandler;
use \Codeception\Util\Locator;
use Yandex\Allure\Adapter\Annotation\Features;
use Yandex\Allure\Adapter\Annotation\Stories;
use Yandex\Allure\Adapter\Annotation\Title;
use Yandex\Allure\Adapter\Annotation\Description;
use Yandex\Allure\Adapter\Annotation\Parameter;
use Yandex\Allure\Adapter\Annotation\Severity;
use Yandex\Allure\Adapter\Model\SeverityLevel;
use Yandex\Allure\Adapter\Annotation\TestCaseId;

/**
* @Title("[NO TESTCASEID]: ExtendedChildTestNotInSuite")
*/
class ExtendedChildTestNotInSuiteCest
{
/**
* @param AcceptanceTester $I
* @throws \Exception
*/
public function _before(AcceptanceTester $I)
{
$I->amOnPage("/beforeUrl");
}

/**
* @param AcceptanceTester $I
* @throws \Exception
*/
public function _after(AcceptanceTester $I)
{
$I->amOnPage("/afterUrl");
}

/**
* @param AcceptanceTester $I
* @throws \Exception
*/
public function _failed(AcceptanceTester $I)
{
$I->saveScreenshot();
}

/**
* @Severity(level = SeverityLevel::TRIVIAL)
* @Features({"TestModule"})
* @Stories({"ExtendedChildTestNotInSuite"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
* @throws \Exception
*/
public function ExtendedChildTestNotInSuite(AcceptanceTester $I)
{
$I->comment("Different Input");
}
}
32 changes: 22 additions & 10 deletions dev/tests/verification/TestModule/Test/ExtendedFunctionalTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,13 @@
<comment userInput="child" stepKey="replaceMe"/>
</test>

<test name="ExtendedTestInSuiteParentTest">
<test name="ExtendedTestRelatedToSuiteParentTest">
<annotations>
<severity value="AVERAGE"/>
<title value="ExtendedTestInSuiteParentTest"/>
<group value="ExtendedTestInSuite"/>
<features value="ExtendedTestInSuite"/>
<stories value="ExtendedTestInSuite"/>
<title value="ExtendedTestRelatedToSuiteParentTest"/>
<group value="ExtendedTestRelatedToSuite"/>
<features value="ExtendedTestRelatedToSuiteParentTest"/>
<stories value="ExtendedTestRelatedToSuiteParentTest"/>
</annotations>
<before>
<amOnPage url="/beforeUrl" stepKey="beforeAmOnPageKey"/>
Expand All @@ -174,16 +174,28 @@
<amOnPage url="/afterUrl" stepKey="afterAmOnPageKey"/>
</after>
<comment stepKey="basicCommentWithNoData" userInput="Parent Comment"/>
<amOnPage url="/url/in/parent" stepKey="amOnPageInParent"/>
</test>

<test name="ExtendedTestInSuiteChildTest" extends="ExtendedTestInSuiteParentTest">
<test name="ExtendedChildTestInSuite" extends="ExtendedTestRelatedToSuiteParentTest">
<annotations>
<severity value="MINOR"/>
<title value="ExtendedChildTestInSuite"/>
<group value="ExtendedTestInSuite"/>
<features value="ExtendedChildTestInSuite"/>
<stories value="ExtendedChildTestInSuite"/>
</annotations>
<comment stepKey="basicCommentWithNoData" userInput="Different Input"/>
<remove keyForRemoval="amOnPageInParent"/>
</test>
<test name="ExtendedChildTestNotInSuite" extends="ExtendedTestRelatedToSuiteParentTest">
<annotations>
<severity value="MINOR"/>
<title value="ExtendedTestInSuiteChildTest"/>
<group value="ExtendedTestInSuiteChildTest"/>
<features value="ExtendedTestInSuiteChildTest"/>
<stories value="ExtendedTestInSuiteChildTest"/>
<title value="ExtendedChildTestNotInSuite"/>
<features value="ExtendedChildTestNotInSuite"/>
<stories value="ExtendedChildTestNotInSuite"/>
</annotations>
<comment stepKey="basicCommentWithNoData" userInput="Different Input"/>
<remove keyForRemoval="amOnPageInParent"/>
</test>
</tests>
11 changes: 11 additions & 0 deletions dev/tests/verification/Tests/ExtendedGenerationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,15 @@ public function testExtendingSkippedGeneration()
{
$this->generateAndCompareTest('ExtendingSkippedTest');
}

/**
* Tests extending and removing parent steps test generation.
*
* @throws \Exception
* @throws \Magento\FunctionalTestingFramework\Exceptions\TestReferenceException
*/
public function testExtendingAndRemovingStepsGeneration()
{
$this->generateAndCompareTest('ExtendedChildTestNotInSuite');
}
}
13 changes: 8 additions & 5 deletions dev/tests/verification/Tests/SuiteGenerationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ public function testSuiteGenerationWithExtends()
{
$groupName = 'suiteExtends';

$expectedContents = [
'ExtendedTestInSuiteChildTestCest.php'
$expectedFileNames = [
'ExtendedChildTestInSuiteCest'
];

// Generate the Suite
Expand All @@ -312,15 +312,18 @@ public function testSuiteGenerationWithExtends()
$this->assertArrayHasKey($groupName, $yml['groups']);

$suiteResultBaseDir = self::GENERATE_RESULT_DIR .
DIRECTORY_SEPARATOR .
$groupName .
DIRECTORY_SEPARATOR;

// Validate tests have been generated
$dirContents = array_diff(scandir($suiteResultBaseDir), ['..', '.']);

foreach ($expectedContents as $expectedFile) {
$this->assertTrue(in_array($expectedFile, $dirContents));
foreach ($expectedFileNames as $expectedFileName) {
$this->assertTrue(in_array($expectedFileName . ".php", $dirContents));
$this->assertFileEquals(
self::RESOURCES_PATH . DIRECTORY_SEPARATOR . $expectedFileName . ".txt",
$suiteResultBaseDir . $expectedFileName . ".php"
);
}
}

Expand Down
2 changes: 1 addition & 1 deletion dev/tests/verification/_suite/functionalSuiteExtends.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<suites xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../src/Magento/FunctionalTestingFramework/Suite/etc/suiteSchema.xsd">
<suite name="suiteExtends">
<include>
<group name="ExtendedTestInSuiteChildTest"/>
<group name="ExtendedTestInSuite"/>
</include>
</suite>
</suites>
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ public function getObject($testName)
*/
public function getAllObjects()
{
$testObjects = [];
foreach ($this->tests as $testName => $test) {
$this->tests[$testName] = $this->extendTest($test);
$testObjects[$testName] = $this->extendTest($test);
}
return $this->tests;
return $testObjects;
}

/**
Expand Down