Skip to content

Commit 5134007

Browse files
committed
MQE-1800: Allow generate:tests to continue running even if one test fails generation
1 parent 1812a0f commit 5134007

File tree

17 files changed

+173
-20
lines changed

17 files changed

+173
-20
lines changed

dev/tests/unit/Magento/FunctionalTestFramework/Suite/SuiteGeneratorTest.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public function setUp(): void
5151

5252
/**
5353
* Tests generating a single suite given a set of parsed test data
54-
* @throws \Exception
5554
*/
5655
public function testGenerateSuite()
5756
{
@@ -87,7 +86,6 @@ public function testGenerateSuite()
8786

8887
/**
8988
* Tests generating all suites given a set of parsed test data
90-
* @throws \Exception
9189
*/
9290
public function testGenerateAllSuites()
9391
{
@@ -124,18 +122,23 @@ public function testGenerateAllSuites()
124122

125123
/**
126124
* Tests attempting to generate a suite with no included/excluded tests and no hooks
127-
* @throws \Exception
128125
*/
129126
public function testGenerateEmptySuite()
130127
{
128+
$testDataArrayBuilder = new TestDataArrayBuilder();
129+
$mockTestData = $testDataArrayBuilder
130+
->withName('test')
131+
->withAnnotations()
132+
->withTestActions()
133+
->build();
134+
131135
$suiteDataArrayBuilder = new SuiteDataArrayBuilder();
132136
$mockData = $suiteDataArrayBuilder
133137
->withName('basicTestSuite')
134138
->build();
135139
unset($mockData['suites']['basicTestSuite'][TestObjectExtractor::TEST_BEFORE_HOOK]);
136140
unset($mockData['suites']['basicTestSuite'][TestObjectExtractor::TEST_AFTER_HOOK]);
137141

138-
$mockTestData = null;
139142
$this->setMockTestAndSuiteParserOutput($mockTestData, $mockData);
140143

141144
// set expected error message
@@ -146,6 +149,9 @@ public function testGenerateEmptySuite()
146149
$mockSuiteGenerator->generateSuite("basicTestSuite");
147150
}
148151

152+
/**
153+
* Tests generating all suites with a suite containing invalid test reference
154+
*/
149155
public function testInvalidSuiteTestPair()
150156
{
151157
// Mock Suite1 => Test1 and Suite2 => Test2
@@ -191,6 +197,9 @@ public function testInvalidSuiteTestPair()
191197
$this->assertArrayHasKey('Suite2', $suiteErrors);
192198
}
193199

200+
/**
201+
* Tests generating all suites with a non-existing suite
202+
*/
194203
public function testNonExistentSuiteTestPair()
195204
{
196205
$testDataArrayBuilder = new TestDataArrayBuilder();
@@ -221,6 +230,7 @@ public function testNonExistentSuiteTestPair()
221230
* Function used to set mock for parser return and force init method to run between tests.
222231
*
223232
* @param array $testData
233+
* @param array $suiteData
224234
* @throws \Exception
225235
*/
226236
private function setMockTestAndSuiteParserOutput($testData, $suiteData)

dev/tests/unit/Magento/FunctionalTestFramework/Test/Handlers/TestObjectHandlerTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ public function testGetTestObject()
118118
*/
119119
public function testGetTestWithFileName()
120120
{
121-
$this->markTestIncomplete();
122-
//TODO
121+
$this->markTestIncomplete('TODO');
123122
}
124123

125124
/**

dev/tests/unit/Magento/FunctionalTestFramework/Util/ModuleResolverTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use AspectMock\Test as AspectMock;
1111

1212
use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig;
13+
use Magento\FunctionalTestingFramework\Exceptions\FastFailException;
1314
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;
1415
use Magento\FunctionalTestingFramework\ObjectManager;
1516
use Magento\FunctionalTestingFramework\ObjectManagerFactory;
@@ -777,7 +778,7 @@ public function testGetModulePathsNoAdminToken()
777778
$this->setMockResolverProperties($resolver, null, null);
778779

779780
// Cannot Generate if no --force was passed in and no Admin Token is returned succesfully
780-
$this->expectException(TestFrameworkException::class);
781+
$this->expectException(FastFailException::class);
781782
$resolver->getModulesPath();
782783
}
783784

@@ -816,7 +817,7 @@ public function testGetAdminTokenWithMissingEnv()
816817
$resolver = ModuleResolver::getInstance();
817818

818819
// Expect exception
819-
$this->expectException(TestFrameworkException::class);
820+
$this->expectException(FastFailException::class);
820821
$resolver->getModulesPath();
821822
}
822823

@@ -833,7 +834,7 @@ public function testGetAdminTokenWithBadResponse()
833834
$resolver = ModuleResolver::getInstance();
834835

835836
// Expect exception
836-
$this->expectException(TestFrameworkException::class);
837+
$this->expectException(FastFailException::class);
837838
$resolver->getModulesPath();
838839
}
839840

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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="urn:magento:mftf:Suite/etc/suiteSchema.xsd">
10+
<suite name="NotGenerateEmptySuite">
11+
</suite>
12+
</suites>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="NotGenerateActionGroupHasBeforeOrAfterTest">
11+
<actionGroup ref="FunctionalActionGroup" stepKey="ag" before="N"/>
12+
</test>
13+
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="NotGenerateNonExistingActionGroupTest">
11+
<actionGroup ref="NNNFunctionalActionGroup" stepKey="ag"/>
12+
</test>
13+
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="NotGenerateExtendNonExistingParentTest" extends="N">
11+
<comment stepKey="comment" userInput="comment"/>
12+
</test>
13+
</tests>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="NotGenerateExtendSelfTest" extends="NotGenerateExtendSelfTest">
11+
<comment stepKey="comment" userInput="comment"/>
12+
</test>
13+
</tests>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="NotGenerateActionHasBothBeforeAndAfterTest">
11+
<amOnPage url="{{AdminLoginPage.url}}" stepKey="navigateToAdmin" before="B" after="A"/>
12+
</test>
13+
</tests>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="NotGenerateActionHasInvalidBeforeOrAfterTest">
11+
<amOnPage url="{{AdminLoginPage.url}}" stepKey="navigateToAdmin" after="N"/>
12+
<click stepKey="a" selector="{{$a.b$}}" userInput="a"/>
13+
</test>
14+
</tests>

0 commit comments

Comments
 (0)