Skip to content

Commit ce8b333

Browse files
committed
MQE-1713: Generate/run test in single suite context
- Added unit test for different exception message
1 parent 22e1f48 commit ce8b333

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

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

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public function testGenerateEmptySuite()
145145
$mockSuiteGenerator->generateSuite("basicTestSuite");
146146
}
147147

148-
public function testInvalidTestRef()
148+
public function testInvalidSuiteTestPair()
149149
{
150150
// Mock Suite1 => Test1 and Suite2 => Test2
151151
$suiteDataArrayBuilder = new SuiteDataArrayBuilder();
@@ -188,6 +188,30 @@ public function testInvalidTestRef()
188188
$mockSuiteGenerator->generateAllSuites($manifest);
189189
}
190190

191+
public function testNonExistentSuiteTestPair()
192+
{
193+
$testDataArrayBuilder = new TestDataArrayBuilder();
194+
$mockSimpleTest = $testDataArrayBuilder
195+
->withName('Test1')
196+
->withAnnotations(['group' => [['value' => 'group1']]])
197+
->withTestActions()
198+
->build();
199+
$mockTestData = ['tests' => array_merge($mockSimpleTest)];
200+
$this->setMockTestAndSuiteParserOutput($mockTestData, []);
201+
202+
// Make invalid manifest
203+
$suiteConfig = ['Suite3' => ['Test1']];
204+
$manifest = TestManifestFactory::makeManifest('default', $suiteConfig);
205+
206+
// Set up Expected Exception
207+
$this->expectException(TestReferenceException::class);
208+
$this->expectExceptionMessageRegExp('#Suite3 is not defined#');
209+
210+
// parse and generate suite object with mocked data and manifest
211+
$mockSuiteGenerator = SuiteGenerator::getInstance();
212+
$mockSuiteGenerator->generateAllSuites($manifest);
213+
}
214+
191215
/**
192216
* Function used to set mock for parser return and force init method to run between tests.
193217
*

0 commit comments

Comments
 (0)