@@ -983,7 +983,9 @@ def __create_incident_report(
983
983
return incident_report .work_item_id
984
984
985
985
@tx_wrapper
986
- def add_test_record_by_object (self , test_record , manual_state_change = False ):
986
+ def add_test_record_by_object (
987
+ self , test_record , manual_state_change = False , create_incident = True
988
+ ):
987
989
"""method add_test_record_by_object, adds a test record for the given
988
990
test case based on the TestRecord object passed in.
989
991
In addition, the test run is checked for completeness and the test
@@ -995,6 +997,8 @@ def add_test_record_by_object(self, test_record, manual_state_change=False):
995
997
test_record (TestRecord or Polarion TestRecord):
996
998
manual_state_change (boolean): Change test run state
997
999
automatically or manual.
1000
+ create_incident (boolean): Create an incident report if the test
1001
+ case fails and no incident is linked.
998
1002
999
1003
Returns:
1000
1004
None
@@ -1009,7 +1013,11 @@ def add_test_record_by_object(self, test_record, manual_state_change=False):
1009
1013
suds_object = test_record ._suds_object
1010
1014
elif isinstance (test_record , TestRecord ()._suds_object .__class__ ):
1011
1015
suds_object = test_record
1012
- if test_record .result == "failed" and not test_record .defect_case_id :
1016
+ if (
1017
+ test_record .result == "failed"
1018
+ and not test_record .defect_case_id
1019
+ and create_incident
1020
+ ):
1013
1021
test_record .defect_case_id = self .__create_incident_report (
1014
1022
test_case_id ,
1015
1023
test_record ,
@@ -1357,7 +1365,11 @@ def update_test_record_by_fields(
1357
1365
1358
1366
@tx_wrapper
1359
1367
def update_test_record_by_object (
1360
- self , test_case_id , test_record , manual_state_change = False
1368
+ self ,
1369
+ test_case_id ,
1370
+ test_record ,
1371
+ manual_state_change = False ,
1372
+ create_incident = True ,
1361
1373
):
1362
1374
"""method update_test_record_by_object, adds a test record for the
1363
1375
given test case based on the TestRecord object passed in.
@@ -1371,6 +1383,9 @@ def update_test_record_by_object(
1371
1383
test_record (TestRecord or Polarion TestRecord)
1372
1384
manual_state_change (boolean): Change the test
1373
1385
run result automatically or manual.
1386
+ create_incident (boolean): Create an incident report if the test
1387
+ record result is failed and no defect
1388
+ case id is set.
1374
1389
1375
1390
Returns:
1376
1391
None
@@ -1387,7 +1402,11 @@ def update_test_record_by_object(
1387
1402
if test_case_id not in test_case_ids :
1388
1403
self .add_test_record_by_object (test_record )
1389
1404
else :
1390
- if test_record .result == "failed" and not test_record .defect_case_id :
1405
+ if (
1406
+ test_record .result == "failed"
1407
+ and not test_record .defect_case_id
1408
+ and create_incident
1409
+ ):
1391
1410
test_record .defect_case_id = self .__create_incident_report (
1392
1411
test_case_id , test_record
1393
1412
)
0 commit comments