Skip to content

MQE-980: <features> tag defaults to module #125

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 6 commits into from
May 9, 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 @@ -88,6 +88,7 @@ public function testGetTestObject()
$testDataArrayBuilder->testName,
[$expectedTestActionObject],
[
'features' => ['NO MODULE DETECTED'],
'group' => ['test']
],
[
Expand All @@ -101,6 +102,15 @@ public function testGetTestObject()
$this->assertEquals($expectedTestObject, $actualTestObject);
}

/**
* Tests basic getting of a test that has a fileName
*/
public function testGetTestWithFileName()
{
$this->markTestIncomplete();
//TODO
}

/**
* Tests the function used to get a series of relevant tests by group.
*
Expand Down Expand Up @@ -131,6 +141,44 @@ public function testGetTestsByGroup()
$this->assertArrayNotHasKey('excludeTest', $tests);
}

/**
* Tests the function used to parse and determine a test's Module (used in allure Features annotation)
*
* @throws \Exception
*/
public function testGetTestWithModuleName()
{
// set up Test Data
$moduleExpected = "SomeTestModule";
$filepath = DIRECTORY_SEPARATOR .
"user" .
"magento2ce" . DIRECTORY_SEPARATOR .
"dev" . DIRECTORY_SEPARATOR .
"tests" . DIRECTORY_SEPARATOR .
"acceptance" . DIRECTORY_SEPARATOR .
"tests" . DIRECTORY_SEPARATOR .
$moduleExpected . DIRECTORY_SEPARATOR .
"Tests" . DIRECTORY_SEPARATOR .
"text.xml";
// set up mock data
$testDataArrayBuilder = new TestDataArrayBuilder();
$mockData = $testDataArrayBuilder
->withAnnotations()
->withFailedHook()
->withAfterHook()
->withBeforeHook()
->withTestActions()
->withFileName($filepath)
->build();
$this->setMockParserOutput(['tests' => $mockData]);
// Execute Test Method
$toh = TestObjectHandler::getInstance();
$actualTestObject = $toh->getObject($testDataArrayBuilder->testName);
$moduleName = $actualTestObject->getAnnotations()["features"][0];
//performAsserts
$this->assertEquals($moduleExpected, $moduleName);
}

/**
* Function used to set mock for parser return and force init method to run between tests.
*
Expand Down
28 changes: 27 additions & 1 deletion dev/tests/unit/Util/TestDataArrayBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace tests\unit\Util;

use Magento\FunctionalTestingFramework\Test\Util\ActionObjectExtractor;
use Magento\FunctionalTestingFramework\Test\Util\AnnotationExtractor;
use Magento\FunctionalTestingFramework\Test\Util\TestObjectExtractor;

class TestDataArrayBuilder
Expand All @@ -18,6 +19,13 @@ class TestDataArrayBuilder
*/
public $testName = 'testTest';

/**
* Mock file name
*
* @var string
*/
public $filename = null;

/**
* Mock before action name
*
Expand Down Expand Up @@ -187,6 +195,23 @@ public function withTestActions($actions = null)
return $this;
}

/**
* Add file name passe in by arg (or default if no arg)
* @param string $filename
* @return $this
*/
public function withFileName($filename = null)
{
if ($filename == null) {
$this->filename =
"/magento2-functional-testing-framework/dev/tests/verification/TestModule/Test/BasicFunctionalTest.xml";
} else {
$this->filename = $filename;
}

return $this;
}

/**
* Output the resulting test data array based on parameters set in the object
*
Expand All @@ -201,7 +226,8 @@ public function build()
TestObjectExtractor::TEST_ANNOTATIONS => $this->annotations,
TestObjectExtractor::TEST_BEFORE_HOOK => $this->beforeHook,
TestObjectExtractor::TEST_AFTER_HOOK => $this->afterHook,
TestObjectExtractor::TEST_FAILED_HOOK => $this->failedHook
TestObjectExtractor::TEST_FAILED_HOOK => $this->failedHook,
"filename" => $this->filename
],
$this->testActions
)];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use Yandex\Allure\Adapter\Annotation\TestCaseId;
class ActionGroupUsingNestedArgumentCest
{
/**
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ActionGroupWithDataOverrideTestCest

/**
* @Severity(level = SeverityLevel::CRITICAL)
* @Features({"Action Group Functional Cest"})
* @Features({"TestModule"})
* @Stories({"MQE-433"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ActionGroupWithDataTestCest

/**
* @Severity(level = SeverityLevel::CRITICAL)
* @Features({"Action Group Functional Cest"})
* @Features({"TestModule"})
* @Stories({"MQE-433"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class ActionGroupWithDefaultArgumentAndStringSelectorParamCest
{
/**
* @Severity(level = SeverityLevel::BLOCKER)
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class ActionGroupWithMultipleParameterSelectorsFromDefaultArgumentCest
{
/**
* @Severity(level = SeverityLevel::BLOCKER)
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class ActionGroupWithNoArgumentsCest
{
/**
* @Severity(level = SeverityLevel::BLOCKER)
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ActionGroupWithNoDefaultTestCest

/**
* @Severity(level = SeverityLevel::CRITICAL)
* @Features({"Action Group Functional Cest"})
* @Features({"TestModule"})
* @Stories({"MQE-433"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class ActionGroupWithPassedArgumentAndStringSelectorParamCest
{
/**
* @Severity(level = SeverityLevel::BLOCKER)
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ActionGroupWithPersistedDataCest

/**
* @Severity(level = SeverityLevel::CRITICAL)
* @Features({"Action Group Functional Cest"})
* @Features({"TestModule"})
* @Stories({"MQE-433"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class ActionGroupWithSimpleDataUsageFromDefaultArgumentCest
{
/**
* @Severity(level = SeverityLevel::CRITICAL)
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class ActionGroupWithSimpleDataUsageFromPassedArgumentCest
{
/**
* @Severity(level = SeverityLevel::CRITICAL)
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class ActionGroupWithSingleParameterSelectorFromDefaultArgumentCest
{
/**
* @Severity(level = SeverityLevel::BLOCKER)
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class ActionGroupWithSingleParameterSelectorFromPassedArgumentCest
{
/**
* @Severity(level = SeverityLevel::BLOCKER)
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use Yandex\Allure\Adapter\Annotation\TestCaseId;
class ActionGroupWithStepKeyReferencesCest
{
/**
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ActionGroupWithTopLevelPersistedDataCest

/**
* @Severity(level = SeverityLevel::CRITICAL)
* @Features({"Action Group Functional Cest"})
* @Features({"TestModule"})
* @Stories({"MQE-433"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ArgumentWithSameNameAsElementCest

/**
* @Severity(level = SeverityLevel::CRITICAL)
* @Features({"Action Group Functional Cest"})
* @Features({"TestModule"})
* @Stories({"MQE-433"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
Expand Down
1 change: 1 addition & 0 deletions dev/tests/verification/Resources/AssertTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class AssertTestCest
}

/**
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
2 changes: 1 addition & 1 deletion dev/tests/verification/Resources/BasicActionGroupTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class BasicActionGroupTestCest

/**
* @Severity(level = SeverityLevel::CRITICAL)
* @Features({"Action Group Functional Cest"})
* @Features({"TestModule"})
* @Stories({"MQE-433"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
Expand Down
2 changes: 1 addition & 1 deletion dev/tests/verification/Resources/BasicFunctionalTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class BasicFunctionalTestCest

/**
* @Severity(level = SeverityLevel::CRITICAL)
* @Features({"Basic Functional Cest"})
* @Features({"TestModule"})
* @Stories({"MQE-305"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
Expand Down
2 changes: 1 addition & 1 deletion dev/tests/verification/Resources/BasicMergeTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class BasicMergeTestCest

/**
* @Severity(level = SeverityLevel::CRITICAL)
* @Features({"Merge Functional Cest"})
* @Features({"TestModule"})
* @Stories({"MQE-433"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use Yandex\Allure\Adapter\Annotation\TestCaseId;
class CharacterReplacementTestCest
{
/**
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
1 change: 1 addition & 0 deletions dev/tests/verification/Resources/DataReplacementTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use Yandex\Allure\Adapter\Annotation\TestCaseId;
class DataReplacementTestCest
{
/**
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
1 change: 1 addition & 0 deletions dev/tests/verification/Resources/HookActionsTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class HookActionsTestCest
}

/**
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
1 change: 1 addition & 0 deletions dev/tests/verification/Resources/LocatorFunctionTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use Yandex\Allure\Adapter\Annotation\TestCaseId;
class LocatorFunctionTestCest
{
/**
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
2 changes: 1 addition & 1 deletion dev/tests/verification/Resources/MergedActionGroupTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class MergedActionGroupTestCest

/**
* @Severity(level = SeverityLevel::CRITICAL)
* @Features({"Action Group Functional Cest"})
* @Features({"TestModule"})
* @Stories({"MQE-433"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
Expand Down
2 changes: 1 addition & 1 deletion dev/tests/verification/Resources/MergedReferencesTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MergedReferencesTestCest

/**
* @Severity(level = SeverityLevel::CRITICAL)
* @Features({"Merge Functional Cest"})
* @Features({"TestModule"})
* @Stories({"MQE-433"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class MultipleActionGroupsTestCest

/**
* @Severity(level = SeverityLevel::CRITICAL)
* @Features({"Action Group Functional Cest"})
* @Features({"TestModule"})
* @Stories({"MQE-433"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
Expand Down
1 change: 1 addition & 0 deletions dev/tests/verification/Resources/PageReplacementTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use Yandex\Allure\Adapter\Annotation\TestCaseId;
class PageReplacementTestCest
{
/**
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
1 change: 1 addition & 0 deletions dev/tests/verification/Resources/ParameterArrayTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use Yandex\Allure\Adapter\Annotation\TestCaseId;
class ParameterArrayTestCest
{
/**
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use Yandex\Allure\Adapter\Annotation\TestCaseId;
class PersistedAndXmlEntityArgumentsCest
{
/**
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class PersistedReplacementTestCest
}

/**
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class PersistenceCustomFieldsTestCest
}

/**
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
Expand Down
Loading