Coverage for testrail_api_reporter/utils/case_stat.py: 100%
35 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-30 12:40 +0200
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-30 12:40 +0200
1# -*- coding: utf-8 -*-
2""" CaseStat class """
5class CaseStat:
6 """Placeholder class for automation statistics"""
8 def __init__(self, name: str):
9 """
10 Constructor
12 :param name: name of the test case
13 """
14 self.name: str = name
15 self.total: int = 0
16 self.automated: int = 0
17 self.not_automated: int = 0
18 self.not_applicable: int = 0
20 # getters
21 def get_name(self) -> str:
22 """
23 Returns the name of the test case
25 :return: name of the test case
26 """
27 return self.name
29 def get_total(self) -> int:
30 """
31 Returns the total number of test cases
33 :return: total number of test cases
34 """
35 return self.total
37 def get_automated(self) -> int:
38 """
39 Returns the number of automated test cases
41 :return: number of automated test cases
42 """
43 return self.automated
45 def get_not_automated(self) -> int:
46 """
47 Returns the number of not automated test cases
49 :return: number of not automated test cases
50 """
51 return self.not_automated
53 def get_not_applicable(self) -> int:
54 """
55 Returns the number of not applicable test cases
57 :return: number of not applicable test cases
58 """
59 return self.not_applicable
61 # setters
62 def set_name(self, name: str) -> None:
63 """
64 Sets the name of the test case
66 :param name: name of the test case
67 """
68 self.name = name
70 def set_total(self, total: int) -> None:
71 """
72 Sets the total number of test cases
74 :param total: total number of test cases
75 """
76 if total < 0:
77 raise ValueError("State value 'total' can't be less than 0")
78 self.total = total
80 def set_automated(self, automated: int):
81 """
82 Sets the number of automated test cases
84 :param automated: number of automated test cases
85 """
86 if automated < 0:
87 raise ValueError("State value 'automated' can't be less than 0")
88 self.automated = automated
90 def set_not_automated(self, not_automated: int) -> None:
91 """
92 Sets the number of not automated test cases
94 :param not_automated: number of not automated test cases
95 """
96 if not_automated < 0:
97 raise ValueError("State value 'not_automated' can't be less than 0")
98 self.not_automated = not_automated
100 def set_not_applicable(self, not_applicable):
101 """
102 Sets the number of not applicable test cases
104 :param not_applicable: number of not applicable test cases
105 """
106 if not_applicable < 0:
107 raise ValueError("State value 'not_applicable' can't be less than 0")
108 self.not_applicable = not_applicable