Skip to content

Commit 5f92b6a

Browse files
committed
MQE-1068: Require Issue ID for Skipped Test
- Added Skip text for issue Ids - Update and added test
1 parent 2cfa59a commit 5f92b6a

File tree

6 files changed

+69
-3
lines changed

6 files changed

+69
-3
lines changed

dev/tests/verification/Resources/SkippedTest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ class SkippedTestCest
3333
*/
3434
public function SkippedTest(AcceptanceTester $I, \Codeception\Scenario $scenario)
3535
{
36-
$scenario->skip("This test is skipped");
36+
$scenario->skip("This test is skipped due to the following issues:\nSkippedValue");
3737
}
3838
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
namespace Magento\AcceptanceTest\_default\Backend;
3+
4+
use Magento\FunctionalTestingFramework\AcceptanceTester;
5+
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\DataObjectHandler;
6+
use Magento\FunctionalTestingFramework\DataGenerator\Persist\DataPersistenceHandler;
7+
use Magento\FunctionalTestingFramework\DataGenerator\Objects\EntityDataObject;
8+
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\CredentialStore;
9+
use \Codeception\Util\Locator;
10+
use Yandex\Allure\Adapter\Annotation\Features;
11+
use Yandex\Allure\Adapter\Annotation\Stories;
12+
use Yandex\Allure\Adapter\Annotation\Title;
13+
use Yandex\Allure\Adapter\Annotation\Description;
14+
use Yandex\Allure\Adapter\Annotation\Parameter;
15+
use Yandex\Allure\Adapter\Annotation\Severity;
16+
use Yandex\Allure\Adapter\Model\SeverityLevel;
17+
use Yandex\Allure\Adapter\Annotation\TestCaseId;
18+
19+
/**
20+
* @Title("skippedNoIssuesTest")
21+
* @Description("")
22+
* @group skip
23+
*/
24+
class SkippedTestNoIssuesCest
25+
{
26+
/**
27+
* @Stories({"skippedNo"})
28+
* @Severity(level = SeverityLevel::MINOR)
29+
* @Features({"TestModule"})
30+
* @Parameter(name = "AcceptanceTester", value="$I")
31+
* @param AcceptanceTester $I
32+
* @return void
33+
* @throws \Exception
34+
*/
35+
public function SkippedTestNoIssues(AcceptanceTester $I, \Codeception\Scenario $scenario)
36+
{
37+
$scenario->skip("This test is skipped due to the following issues:\nNo issues have been specified.");
38+
}
39+
}

dev/tests/verification/Resources/SkippedTestTwoIssues.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ class SkippedTestTwoIssuesCest
3333
*/
3434
public function SkippedTestTwoIssues(AcceptanceTester $I, \Codeception\Scenario $scenario)
3535
{
36-
$scenario->skip("This test is skipped");
36+
$scenario->skip("This test is skipped due to the following issues:\nSkippedValue\nSecondSkippedValue");
3737
}
3838
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,13 @@
3131
</skip>
3232
</annotations>
3333
</test>
34+
<test name="SkippedTestNoIssues">
35+
<annotations>
36+
<stories value="skippedNo"/>
37+
<title value="skippedNoIssuesTest"/>
38+
<description value=""/>
39+
<severity value="AVERAGE"/>
40+
<group value="skip"/>
41+
</annotations>
42+
</test>
3443
</tests>

dev/tests/verification/Tests/SkippedGenerationTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,15 @@ public function testMultipleSkippedIssuesGeneration()
3030
{
3131
$this->generateAndCompareTest('SkippedTestTwoIssues');
3232
}
33+
34+
/**
35+
* Tests skipped test generation with no specified issues. Will be deprecated after MFTF 3.0.0
36+
*
37+
* @throws \Exception
38+
* @throws \Magento\FunctionalTestingFramework\Exceptions\TestReferenceException
39+
*/
40+
public function testSkippedNoIssueGeneration()
41+
{
42+
$this->generateAndCompareTest('SkippedTestNoIssues');
43+
}
3344
}

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,14 @@ private function generateTestPhp($test)
15291529
$testAnnotations = $this->generateAnnotationsPhp($test->getAnnotations(), true);
15301530
$dependencies = 'AcceptanceTester $I';
15311531
if ($test->isSkipped()) {
1532-
$steps = "\t\t" . '$scenario->skip("This test is skipped");' . "\n";
1532+
$skipString = "This test is skipped due to the following issues:\\n";
1533+
$issues = $test->getAnnotations()['skip'] ?? null;
1534+
if (isset($issues)) {
1535+
$skipString .= implode("\\n", $issues);
1536+
} else {
1537+
$skipString .= "No issues have been specified.";
1538+
}
1539+
$steps = "\t\t" . '$scenario->skip("' . $skipString . '");' . "\n";
15331540
$dependencies .= ', \Codeception\Scenario $scenario';
15341541
} else {
15351542
try {

0 commit comments

Comments
 (0)