@@ -48,7 +48,7 @@ public function extendTest($testObject)
4848 ["parent " => $ testObject ->getParentName (), "test " => $ testObject ->getName ()]
4949 );
5050 }
51- $ skippedTest = $ this ->skipTest ($ testObject );
51+ $ skippedTest = $ this ->skipTest ($ testObject, ' ParentTestDoesNotExist ' );
5252 return $ skippedTest ;
5353 }
5454
@@ -64,6 +64,11 @@ public function extendTest($testObject)
6464 ->debug ("extending test " , ["parent " => $ parentTest ->getName (), "test " => $ testObject ->getName ()]);
6565 }
6666
67+ // Skip test if parent is skipped
68+ if ($ parentTest ->isSkipped ()) {
69+ return $ this ->skipTest ($ testObject );
70+ }
71+
6772 // Get steps for both the parent and the child tests
6873 $ referencedTestSteps = $ parentTest ->getUnresolvedSteps ();
6974 $ newSteps = $ this ->processRemoveActions (array_merge ($ referencedTestSteps , $ testObject ->getUnresolvedSteps ()));
@@ -207,17 +212,19 @@ private function processRemoveActions($actions)
207212 * This method returns a skipped form of the Test Object
208213 *
209214 * @param TestObject $testObject
215+ * @param string $skipReason
210216 * @return TestObject
211217 */
212- public function skipTest ($ testObject )
218+ public function skipTest ($ testObject, $ skipReason = null )
213219 {
214220 $ annotations = $ testObject ->getAnnotations ();
221+ $ skipReason = $ skipReason ?? 'ParentTestIsSkipped ' ;
215222
216223 // Add skip to the group array if it doesn't already exist
217224 if (array_key_exists ('skip ' , $ annotations )) {
218225 return $ testObject ;
219226 } elseif (!array_key_exists ('skip ' , $ annotations )) {
220- $ annotations ['skip ' ] = ['issueId ' => " ParentTestDoesNotExist " ];
227+ $ annotations ['skip ' ] = ['issueId ' => $ skipReason ];
221228 }
222229
223230 $ skippedTest = new TestObject (
@@ -229,6 +236,10 @@ public function skipTest($testObject)
229236 $ testObject ->getParentName ()
230237 );
231238
239+ LoggingUtil::getInstance ()->getLogger (ObjectExtensionUtil::class)->info (
240+ "\nMQE-2463 LOGGING: {$ testObject ->getName ()} is skipped due to {$ skipReason }\n"
241+ );
242+
232243 return $ skippedTest ;
233244 }
234245}
0 commit comments