@@ -167,19 +167,60 @@ def scenario_business_capability_dependency(self) -> TestResult:
167167 """Scenario: Link and unlink business capability dependencies"""
168168 scenario_name = "Business Capability Dependency Management"
169169 start_time = time .perf_counter ()
170+ created_guids = []
170171
171172 try :
172173 console .print (f"\n [bold blue]▶ Running: { scenario_name } [/bold blue]" )
173174
174- # Note: This test requires pre-existing business capability GUIDs
175- # In a real scenario, you would create or retrieve these
176- console . print ( " → Testing business capability dependency linking... " )
175+ # CREATE: Create two business capabilities for testing dependency
176+ console . print ( " → Creating business capabilities for dependency test..." )
177+ ts = datetime . now (). strftime ( "%Y%m%d%H%M%S%f " )
177178
178- # Mock GUIDs for demonstration (in real tests, these would be actual GUIDs)
179- capability_guid = "test-capability-guid-1"
180- supporting_guid = "test-supporting-guid-1"
179+ # Create first capability (the one that depends on another)
180+ body1 = {
181+ "class" : "NewElementRequestBody" ,
182+ "properties" : {
183+ "class" : "BusinessCapabilityProperties" ,
184+ "qualifiedName" : f"BusinessCapability::DependentCapability::{ ts } " ,
185+ "displayName" : f"Dependent Capability { ts } " ,
186+ "description" : "Business capability that depends on another" ,
187+ "identifier" : f"BC-DEP-{ ts } " ,
188+ "businessCapabilityType" : 1
189+ }
190+ }
181191
182- body = {
192+ capability_guid = self .client .create_business_capability (body1 )
193+ if capability_guid :
194+ created_guids .append (capability_guid )
195+ self .created_capabilities .append (capability_guid )
196+ console .print (f" ✓ Created dependent capability: { capability_guid } " )
197+ else :
198+ raise Exception ("Failed to create dependent capability" )
199+
200+ # Create second capability (the supporting one)
201+ body2 = {
202+ "class" : "NewElementRequestBody" ,
203+ "properties" : {
204+ "class" : "BusinessCapabilityProperties" ,
205+ "qualifiedName" : f"BusinessCapability::SupportingCapability::{ ts } " ,
206+ "displayName" : f"Supporting Capability { ts } " ,
207+ "description" : "Business capability that supports another" ,
208+ "identifier" : f"BC-SUP-{ ts } " ,
209+ "businessCapabilityType" : 2
210+ }
211+ }
212+
213+ supporting_guid = self .client .create_business_capability (body2 )
214+ if supporting_guid :
215+ created_guids .append (supporting_guid )
216+ self .created_capabilities .append (supporting_guid )
217+ console .print (f" ✓ Created supporting capability: { supporting_guid } " )
218+ else :
219+ raise Exception ("Failed to create supporting capability" )
220+
221+ # LINK: Link the dependency relationship
222+ console .print (" → Linking business capability dependency..." )
223+ dependency_body = {
183224 "class" : "NewRelationshipRequestBody" ,
184225 "properties" : {
185226 "class" : "BusinessCapabilityDependencyProperties" ,
@@ -188,28 +229,26 @@ def scenario_business_capability_dependency(self) -> TestResult:
188229 }
189230 }
190231
191- # This would fail without real GUIDs, so we catch and report
192- try :
193- self .client .link_business_capability_dependency (
194- capability_guid , supporting_guid , body
195- )
196- console .print (" ✓ Linked business capability dependency" )
197-
198- # Detach
199- self .client .detach_business_capability_dependency (
200- capability_guid , supporting_guid
201- )
202- console .print (" ✓ Detached business capability dependency" )
203-
204- except PyegeriaNotFoundException :
205- console .print (" [yellow]⚠ Test GUIDs not found (expected in test environment)[/yellow]" )
232+ self .client .link_business_capability_dependency (
233+ capability_guid , supporting_guid , dependency_body
234+ )
235+ console .print (" ✓ Linked business capability dependency" )
236+
237+ # DETACH: Remove the dependency relationship
238+ console .print (" → Detaching business capability dependency..." )
239+ body = {"class" :"DeleteRelationshipRequestBody" }
240+ self .client .detach_business_capability_dependency (
241+ capability_guid , supporting_guid , body
242+ )
243+ console .print (" ✓ Detached business capability dependency" )
206244
207245 duration = time .perf_counter () - start_time
208246 return TestResult (
209247 scenario_name = scenario_name ,
210248 status = "PASSED" ,
211249 duration = duration ,
212- message = "Business capability dependency methods executed (requires real GUIDs for full test)"
250+ message = f"Successfully tested dependency linking with { len (created_guids )} capabilities" ,
251+ created_guids = created_guids
213252 )
214253
215254 except Exception as e :
@@ -228,17 +267,64 @@ def scenario_digital_support(self) -> TestResult:
228267 """Scenario: Link and unlink digital support to business capabilities"""
229268 scenario_name = "Digital Support Management"
230269 start_time = time .perf_counter ()
270+ created_guids = []
231271
232272 try :
233273 console .print (f"\n [bold blue]▶ Running: { scenario_name } [/bold blue]" )
234274
235- console .print (" → Testing digital support linking..." )
275+ # CREATE: Create a business capability and another element for digital support
276+ console .print (" → Creating business capability for digital support test..." )
277+ ts = datetime .now ().strftime ("%Y%m%d%H%M%S%f" )
236278
237- # Mock GUIDs for demonstration
238- capability_guid = "test-capability-guid-2"
239- element_guid = "test-element-guid-1"
279+ # Create business capability
280+ capability_body = {
281+ "class" : "NewElementRequestBody" ,
282+ "typeName" : "BusinessCapability" ,
283+ "initialStatus" : "ACTIVE" ,
284+ "properties" : {
285+ "class" : "BusinessCapabilityProperties" ,
286+ "qualifiedName" : f"BusinessCapability::DigitalSupportTest::{ ts } " ,
287+ "displayName" : f"Digital Support Test Capability { ts } " ,
288+ "description" : "Business capability for digital support testing" ,
289+ "identifier" : f"BC-DS-{ ts } " ,
290+ "businessCapabilityType" : 1
291+ }
292+ }
240293
241- body = {
294+ capability_guid = self .client .create_business_capability (capability_body )
295+ if capability_guid :
296+ created_guids .append (capability_guid )
297+ self .created_capabilities .append (capability_guid )
298+ console .print (f" ✓ Created business capability: { capability_guid } " )
299+ else :
300+ raise Exception ("Failed to create business capability" )
301+
302+ # Create another business capability to act as the digital support element
303+ element_body = {
304+ "class" : "NewElementRequestBody" ,
305+ "typeName" : "BusinessCapability" ,
306+ "initialStatus" : "ACTIVE" ,
307+ "properties" : {
308+ "class" : "BusinessCapabilityProperties" ,
309+ "qualifiedName" : f"BusinessCapability::DigitalSupportElement::{ ts } " ,
310+ "displayName" : f"Digital Support Element { ts } " ,
311+ "description" : "Element providing digital support" ,
312+ "identifier" : f"BC-DSE-{ ts } " ,
313+ "businessCapabilityType" : 2
314+ }
315+ }
316+
317+ element_guid = self .client .create_business_capability (element_body )
318+ if element_guid :
319+ created_guids .append (element_guid )
320+ self .created_capabilities .append (element_guid )
321+ console .print (f" ✓ Created digital support element: { element_guid } " )
322+ else :
323+ raise Exception ("Failed to create digital support element" )
324+
325+ # LINK: Link digital support
326+ console .print (" → Linking digital support..." )
327+ support_body = {
242328 "class" : "NewRelationshipRequestBody" ,
243329 "properties" : {
244330 "class" : "DigitalSupportProperties" ,
@@ -247,23 +333,22 @@ def scenario_digital_support(self) -> TestResult:
247333 }
248334 }
249335
250- try :
251- self .client .link_digital_support (capability_guid , element_guid , body )
252- console .print (" ✓ Linked digital support" )
253-
254- # Detach
255- self .client .detach_digital_support (capability_guid , element_guid )
256- console .print (" ✓ Detached digital support" )
257-
258- except PyegeriaNotFoundException :
259- console .print (" [yellow]⚠ Test GUIDs not found (expected in test environment)[/yellow]" )
336+ self .client .link_digital_support (capability_guid , element_guid , support_body )
337+ console .print (" ✓ Linked digital support" )
338+
339+ # DETACH: Remove digital support
340+ console .print (" → Detaching digital support..." )
341+ body = {"class" :"DeleteRelationshipRequestBody" }
342+ self .client .detach_digital_support (capability_guid , element_guid , body = body )
343+ console .print (" ✓ Detached digital support" )
260344
261345 duration = time .perf_counter () - start_time
262346 return TestResult (
263347 scenario_name = scenario_name ,
264348 status = "PASSED" ,
265349 duration = duration ,
266- message = "Digital support methods executed (requires real GUIDs for full test)"
350+ message = f"Successfully tested digital support with { len (created_guids )} elements" ,
351+ created_guids = created_guids
267352 )
268353
269354 except Exception as e :
@@ -282,40 +367,62 @@ def scenario_business_significance(self) -> TestResult:
282367 """Scenario: Set and clear business significance classification"""
283368 scenario_name = "Business Significance Classification"
284369 start_time = time .perf_counter ()
370+ created_guids = []
285371
286372 try :
287373 console .print (f"\n [bold blue]▶ Running: { scenario_name } [/bold blue]" )
288374
289- console .print (" → Testing business significance classification..." )
375+ # CREATE: Create a business capability for significance testing
376+ console .print (" → Creating business capability for significance test..." )
377+ ts = datetime .now ().strftime ("%Y%m%d%H%M%S%f" )
290378
291- # Mock GUID for demonstration
292- element_guid = "test-element-guid-2"
379+ element_body = {
380+ "class" : "NewElementRequestBody" ,
381+ "typeName" : "BusinessCapability" ,
382+ "initialStatus" : "ACTIVE" ,
383+ "properties" : {
384+ "class" : "BusinessCapabilityProperties" ,
385+ "qualifiedName" : f"BusinessCapability::SignificanceTest::{ ts } " ,
386+ "displayName" : f"Significance Test Capability { ts } " ,
387+ "description" : "Business capability for significance testing" ,
388+ "identifier" : f"BC-SIG-{ ts } " ,
389+ "businessCapabilityType" : 1
390+ }
391+ }
293392
294- body = {
393+ element_guid = self .client .create_business_capability (element_body )
394+ if element_guid :
395+ created_guids .append (element_guid )
396+ self .created_capabilities .append (element_guid )
397+ console .print (f" ✓ Created business capability: { element_guid } " )
398+ else :
399+ raise Exception ("Failed to create business capability" )
400+
401+ # SET: Set business significance classification
402+ console .print (" → Setting business significance..." )
403+ significance_body = {
295404 "class" : "NewClassificationRequestBody" ,
296405 "properties" : {
297406 "class" : "BusinessSignificantProperties" ,
298407 "subjectAreaName" : "Test Subject Area"
299408 }
300409 }
301410
302- try :
303- self .client .set_business_significant (element_guid , body )
304- console .print (" ✓ Set business significance" )
305-
306- # Clear
307- self .client .clear_business_significance (element_guid )
308- console .print (" ✓ Cleared business significance" )
309-
310- except PyegeriaNotFoundException :
311- console .print (" [yellow]⚠ Test GUID not found (expected in test environment)[/yellow]" )
411+ self .client .set_business_significant (element_guid , significance_body )
412+ console .print (" ✓ Set business significance" )
413+
414+ # CLEAR: Remove business significance classification
415+ console .print (" → Clearing business significance..." )
416+ self .client .clear_business_significance (element_guid )
417+ console .print (" ✓ Cleared business significance" )
312418
313419 duration = time .perf_counter () - start_time
314420 return TestResult (
315421 scenario_name = scenario_name ,
316422 status = "PASSED" ,
317423 duration = duration ,
318- message = "Business significance methods executed (requires real GUID for full test)"
424+ message = f"Successfully tested business significance with { len (created_guids )} element" ,
425+ created_guids = created_guids
319426 )
320427
321428 except Exception as e :
0 commit comments