@@ -48,7 +48,7 @@ public function extendTest($testObject)
48
48
["parent " => $ testObject ->getParentName (), "test " => $ testObject ->getName ()]
49
49
);
50
50
}
51
- $ skippedTest = $ this ->skipTest ($ testObject );
51
+ $ skippedTest = $ this ->skipTest ($ testObject, ' ParentTestDoesNotExist ' );
52
52
return $ skippedTest ;
53
53
}
54
54
@@ -64,6 +64,11 @@ public function extendTest($testObject)
64
64
->debug ("extending test " , ["parent " => $ parentTest ->getName (), "test " => $ testObject ->getName ()]);
65
65
}
66
66
67
+ // Skip test if parent is skipped
68
+ if ($ parentTest ->isSkipped ()) {
69
+ return $ this ->skipTest ($ testObject );
70
+ }
71
+
67
72
// Get steps for both the parent and the child tests
68
73
$ referencedTestSteps = $ parentTest ->getUnresolvedSteps ();
69
74
$ newSteps = $ this ->processRemoveActions (array_merge ($ referencedTestSteps , $ testObject ->getUnresolvedSteps ()));
@@ -207,17 +212,19 @@ private function processRemoveActions($actions)
207
212
* This method returns a skipped form of the Test Object
208
213
*
209
214
* @param TestObject $testObject
215
+ * @param string $skipReason
210
216
* @return TestObject
211
217
*/
212
- public function skipTest ($ testObject )
218
+ public function skipTest ($ testObject, $ skipReason = null )
213
219
{
214
220
$ annotations = $ testObject ->getAnnotations ();
221
+ $ skipReason = $ skipReason ?? 'ParentTestIsSkipped ' ;
215
222
216
223
// Add skip to the group array if it doesn't already exist
217
224
if (array_key_exists ('skip ' , $ annotations )) {
218
225
return $ testObject ;
219
226
} elseif (!array_key_exists ('skip ' , $ annotations )) {
220
- $ annotations ['skip ' ] = ['issueId ' => " ParentTestDoesNotExist " ];
227
+ $ annotations ['skip ' ] = ['issueId ' => $ skipReason ];
221
228
}
222
229
223
230
$ skippedTest = new TestObject (
@@ -229,6 +236,10 @@ public function skipTest($testObject)
229
236
$ testObject ->getParentName ()
230
237
);
231
238
239
+ LoggingUtil::getInstance ()->getLogger (ObjectExtensionUtil::class)->info (
240
+ "\nMQE-2463 LOGGING: {$ testObject ->getName ()} is skipped due to {$ skipReason }\n"
241
+ );
242
+
232
243
return $ skippedTest ;
233
244
}
234
245
}
0 commit comments