2222from enum import Enum
2323
2424class TestStatus (Enum ):
25+ """
26+ Enumeration of the test status.
27+ PASSED: The test has passed
28+ FAILED: The test has failed
29+ PUB_UNSUPPORTED: The test is unsupported for the Publisher
30+ SUB_UNSUPPORTED: The test is unsupported for the Subscriber
31+ PUB_SUB_UNSUPPORTED: The test is unsupported for both Publisher and Subscriber
32+ """
2533 PASSED = 1
2634 FAILED = 2
27- UNSUPPORTED = 3
35+ PUB_UNSUPPORTED = 3
36+ SUB_UNSUPPORTED = 4
37+ PUB_SUB_UNSUPPORTED = 5
2838
2939class XlxsReportArgumentParser :
3040 """Class that parse the arguments of the application."""
@@ -236,25 +246,42 @@ def get_info(self, input: pathlib.Path = None):
236246 # subscriber
237247 unsupported_tests_count = 0
238248 for case in list (iter (suite )):
239- this_test_unsupported = False
249+ is_pub_unsupported = False
250+ is_sub_unsupported = False
251+ status = None
240252 test_name = re .search (r'((?:Test_)[\S]+_\d+)' , case .name ).group (1 )
241253
242254 # count number of unsupported tests for the summary
243255 # result array is not empty and the message contains 'UNSUPPORTED_FEATURE'
244- if case .result and len (case .result ) > 0 \
245- and 'UNSUPPORTED_FEATURE' in case .result [0 ].message .upper ():
256+ if case .result and len (case .result ) > 0 :
257+ if 'PUB_UNSUPPORTED_FEATURE' in case .result [0 ].message .upper ():
258+ is_pub_unsupported = True
259+ if 'SUB_UNSUPPORTED_FEATURE' in case .result [0 ].message .upper ():
260+ is_sub_unsupported = True
261+
262+ if is_pub_unsupported or is_sub_unsupported :
246263 unsupported_tests_count += 1
247- this_test_unsupported = True
264+
265+ # Get test status
266+ if case .is_passed :
267+ status = TestStatus .PASSED
268+ elif is_pub_unsupported and is_sub_unsupported :
269+ status = TestStatus .PUB_SUB_UNSUPPORTED
270+ elif is_pub_unsupported :
271+ status = TestStatus .PUB_UNSUPPORTED
272+ elif is_sub_unsupported :
273+ status = TestStatus .SUB_UNSUPPORTED
274+ else :
275+ status = TestStatus .FAILED
276+
248277
249278 # update the value of the publisher_name as publisher with
250279 # all products as subscribers.
251280 # the tuple is (subscriber_name, test_name, status)
252281 publisher_test_result = JunitTestCaseAggregatedData (
253282 product = subscriber_name ,
254283 test_name = test_name ,
255- status = TestStatus .PASSED if case .is_passed
256- else TestStatus .FAILED if not this_test_unsupported
257- else TestStatus .UNSUPPORTED
284+ status = status
258285 )
259286
260287 # add the resulting tuple to the publisher dictionary, the key
@@ -272,9 +299,7 @@ def get_info(self, input: pathlib.Path = None):
272299 subscriber_test_result = JunitTestCaseAggregatedData (
273300 product = publisher_name ,
274301 test_name = test_name ,
275- status = TestStatus .PASSED if case .is_passed
276- else TestStatus .FAILED if not this_test_unsupported
277- else TestStatus .UNSUPPORTED
302+ status = status
278303 )
279304
280305 # add the resulting tuple to the subscriber dictionary, the key
@@ -677,10 +702,21 @@ def add_product_table(self,
677702 element .get_test_name (),
678703 self .__formats ['bold_w_border' ])
679704
680- # set OK or ERROR if the test passed or not
681- str_result = 'OK' if element .get_status () == TestStatus .PASSED \
682- else 'ERROR' if element .get_status () == TestStatus .FAILED \
683- else 'UNSUPPORTED'
705+ # get status string of the test result
706+ if element .get_status () == TestStatus .PASSED :
707+ str_result = 'OK'
708+ elif element .get_status () == TestStatus .FAILED :
709+ str_result = 'ERROR'
710+ elif element .get_status () == TestStatus .PUB_UNSUPPORTED :
711+ str_result = 'PUB UNSUPPORTED'
712+ elif element .get_status () == TestStatus .SUB_UNSUPPORTED :
713+ str_result = 'SUB UNSUPPORTED'
714+ elif element .get_status () == TestStatus .PUB_SUB_UNSUPPORTED :
715+ str_result = 'PUB/SUB UNSUPPORTED'
716+ else :
717+ str_result = 'UNKNOWN'
718+
719+ # write status string to the test result
684720 worksheet .write (
685721 process_row ,
686722 process_column ,
0 commit comments