diff --git a/dev/tests/verification/Resources/ExtendingSkippedTest.txt b/dev/tests/verification/Resources/ExtendingSkippedTest.txt
new file mode 100644
index 000000000..35cd3a825
--- /dev/null
+++ b/dev/tests/verification/Resources/ExtendingSkippedTest.txt
@@ -0,0 +1,66 @@
+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::CRITICAL)
+ * @Features({"TestModule"})
+ * @Stories({"Child"})
+ * @Parameter(name = "AcceptanceTester", value="$I")
+ * @param AcceptanceTester $I
+ * @return void
+ * @throws \Exception
+ */
+ public function ExtendingSkippedTest(AcceptanceTester $I)
+ {
+ $I->comment("text");
+ $I->comment("child");
+ }
+}
diff --git a/dev/tests/verification/Resources/SkippedTestWithHooks.txt b/dev/tests/verification/Resources/SkippedTestWithHooks.txt
new file mode 100644
index 000000000..d28c61486
--- /dev/null
+++ b/dev/tests/verification/Resources/SkippedTestWithHooks.txt
@@ -0,0 +1,38 @@
+skip("This test is skipped due to the following issues:\nSkippedValue");
+ }
+}
diff --git a/dev/tests/verification/TestModule/Test/ExtendedFunctionalTest.xml b/dev/tests/verification/TestModule/Test/ExtendedFunctionalTest.xml
index 602b9a02c..9d50f7197 100644
--- a/dev/tests/verification/TestModule/Test/ExtendedFunctionalTest.xml
+++ b/dev/tests/verification/TestModule/Test/ExtendedFunctionalTest.xml
@@ -116,7 +116,6 @@
-
@@ -129,4 +128,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/tests/verification/TestModule/Test/SkippedTest.xml b/dev/tests/verification/TestModule/Test/SkippedTest.xml
index bceb619f8..7641e270e 100644
--- a/dev/tests/verification/TestModule/Test/SkippedTest.xml
+++ b/dev/tests/verification/TestModule/Test/SkippedTest.xml
@@ -19,6 +19,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dev/tests/verification/Tests/ExtendedGenerationTest.php b/dev/tests/verification/Tests/ExtendedGenerationTest.php
index d0c9926d0..46246c45b 100644
--- a/dev/tests/verification/Tests/ExtendedGenerationTest.php
+++ b/dev/tests/verification/Tests/ExtendedGenerationTest.php
@@ -96,4 +96,15 @@ public function testExtendedTestGenerationNoParent()
{
$this->generateAndCompareTest('ChildExtendedTestNoParent');
}
+
+ /**
+ * Tests extending a skipped test generation.
+ *
+ * @throws \Exception
+ * @throws \Magento\FunctionalTestingFramework\Exceptions\TestReferenceException
+ */
+ public function testExtendingSkippedGeneration()
+ {
+ $this->generateAndCompareTest('ExtendingSkippedTest');
+ }
}
diff --git a/dev/tests/verification/Tests/SkippedGenerationTest.php b/dev/tests/verification/Tests/SkippedGenerationTest.php
index 6a65df8e3..2d259e02c 100644
--- a/dev/tests/verification/Tests/SkippedGenerationTest.php
+++ b/dev/tests/verification/Tests/SkippedGenerationTest.php
@@ -20,6 +20,17 @@ public function testSkippedGeneration()
$this->generateAndCompareTest('SkippedTest');
}
+ /**
+ * Tests skipped test generation does not generate hooks.
+ *
+ * @throws \Exception
+ * @throws \Magento\FunctionalTestingFramework\Exceptions\TestReferenceException
+ */
+ public function testSkippedWithHooksGeneration()
+ {
+ $this->generateAndCompareTest('SkippedTestWithHooks');
+ }
+
/**
* Tests skipped test with multiple issues generation.
*
diff --git a/src/Magento/FunctionalTestingFramework/Test/Objects/TestObject.php b/src/Magento/FunctionalTestingFramework/Test/Objects/TestObject.php
index 71f5ec36b..30c3a9004 100644
--- a/src/Magento/FunctionalTestingFramework/Test/Objects/TestObject.php
+++ b/src/Magento/FunctionalTestingFramework/Test/Objects/TestObject.php
@@ -168,10 +168,6 @@ public function getAnnotations()
*/
public function getHooks()
{
- // if this test is skipped we do not want any before/after actions to generate as the tests will not run
- if ($this->isSkipped()) {
- return [];
- }
return $this->hooks;
}
diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php
index af39f6ad1..bcae12c9b 100644
--- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php
+++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php
@@ -207,7 +207,11 @@ private function assembleTestPhp($testObject)
$className = $testObject->getCodeceptionName();
try {
- $hookPhp = $this->generateHooksPhp($testObject->getHooks());
+ if (!$testObject->isSkipped()) {
+ $hookPhp = $this->generateHooksPhp($testObject->getHooks());
+ } else {
+ $hookPhp = null;
+ }
$testsPhp = $this->generateTestPhp($testObject);
} catch (TestReferenceException $e) {
throw new TestReferenceException($e->getMessage() . "\n" . $testObject->getFilename());