• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2# coding=utf-8
3
4#
5# Copyright (c) 2022 Huawei Device Co., Ltd.
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10#     http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18
19class DetailErrorMassage():
20    Error_01100 = {
21        "Topic": "测试资源加载异常[01100]",
22        "Code": "01100",
23        "Message": {
24            "en": "The third-party Python library or key AW of the test "
25                  "suite is missing or the script syntax is incorrect. "
26                  "As a result, the test suite fails to be loaded. {}",
27            "ch": "测试套的Python三方库、关键AW缺失或脚本语法错误,导致测试套加载失败."
28        }
29    }
30
31    Error_01101 = {
32        "Topic": "测试资源加载异常[01101]",
33        "Code": "01101",
34        "Message": {
35            "en": "An error occurred when parsing AW parameters during "
36                  "script execution (parameter syntax error or method "
37                  "parameter inconsistency).",
38            "ch": "执行脚本过程中解析AW参数出错(参数语法错误,方法参数不一致)."
39        }
40    }
41
42    Error_01102 = {
43        "Topic": "测试资源加载异常[01102]",
44        "Code": "01102",
45        "Message": {
46            "en": "The dependent file resource (video resource file) is "
47                  "missing during task execution.",
48            "ch": "任务执行过程中,依赖的文件资源缺失(视频资源文件)."
49        }
50    }
51
52    Error_01105 = {
53        "Topic": "测试资源加载异常[01105]",
54        "Code": "01105",
55        "Message": {
56            "en": "The CPU of the mobile phone does not depend on "
57                  "the HiSilicon chip during network packet capture.",
58            "ch": "网络报文抓取时,依赖的手机CPU不是海思芯片."
59        }
60    }
61
62    Error_01107 = {
63        "Topic": "测试用例执行失败[01107]",
64        "Code": "01107",
65        "Message": {
66            "en": "Wi-Fi is not enabled.",
67            "ch": "未打开WiFi."
68        }
69    }
70
71    Error_01108 = {
72        "Topic": "测试资源加载异常[01108]",
73        "Code": "01108",
74        "Message": {
75            "en": "model_aw import resource error.",
76            "ch": "model_aw 引入资源时发生错误."
77        }
78    }
79
80    Error_01109 = {
81        "Topic": "测试资源加载异常[01109]",
82        "Code": "01109",
83        "Message": {
84            "en": "hierachyview module import error.",
85            "ch": "hierachyview 模块引入时发生错误."
86        }
87    }
88
89    Error_01110 = {
90        "Topic": "测试资源加载异常[01110]",
91        "Code": "01110",
92        "Message": {
93            "en": "error, test suite not found py script.",
94            "ch": "testsuite用例没有找到目标py用例."
95        }
96    }
97
98    Error_01200 = {
99        "Topic": "测试用例执行失败[01200]",
100        "Code": "01200",
101        "Message": {
102            "en": "No error message is set in the script, and the actual "
103                  "value of the check point is different from the expected "
104                  "value. {}",
105            "ch": "脚本没有设置错误提示信息,检查点的实际输入值与预期结果不一致."
106        }
107    }
108
109    Error_01201 = {
110        "Topic": "测试用例执行失败[01201]",
111        "Code": "01201",
112        "Message": {
113            "en": "The manual submission result is incorrect.",
114            "ch": "手动提交的步骤结果不正确."
115        }
116    }
117
118    Error_01202 = {
119        "Topic": "测试用例执行失败[01202]",
120        "Code": "01202",
121        "Message": {
122            "en": "An unknown error occurred when running the setup command.",
123            "ch": "执行setup遇到未知错误."
124        }
125    }
126
127    Error_01203 = {
128        "Topic": "测试用例执行失败[01203]",
129        "Code": "01203",
130        "Message": {
131            "en": "An unknown error occurred when running the test command.",
132            "ch": "执行test遇到未知错误."
133        }
134    }
135
136    Error_01204 = {
137        "Topic": "测试用例执行失败[01204]",
138        "Code": "01204",
139        "Message": {
140            "en": "An unknown error occurred when running the teardown "
141                  "command.",
142            "ch": "执行teardown遇到未知错误."
143        }
144    }
145
146    Error_01205 = {
147        "Topic": "测试用例执行失败[01205]",
148        "Code": "01205",
149        "Message": {
150            "en": "An unexpected error occurs during the execution of "
151                  "the current case.",
152            "ch": "当前用例执行出现非预期的错误."
153        }
154    }
155
156    Error_01206 = {
157        "Topic": "测试用例执行失败[01206]",
158        "Code": "01206",
159        "Message": {
160            "en": "An error is reported when the connector command is executed.",
161            "ch": "执行connector命令异常报错."
162        }
163    }
164
165    Error_01207 = {
166        "Topic": "测试用例执行失败[01207]",
167        "Code": "01207",
168        "Message": {
169            "en": "generate test report failed.",
170            "ch": "生成xml报告失败."
171        }
172    }
173
174    Error_01208 = {
175        "Topic": "测试用例执行失败[01208]",
176        "Code": "01207",
177        "Message": {
178            "en": "Failed to obtain the idle port.",
179            "ch": "获取connector空闲端口失败."
180        }
181    }
182
183    Error_01209 = {
184        "Topic": "测试用例执行失败[01209]",
185        "Code": "01209",
186        "Message": {
187            "en": "An exception occurred when parsing parameters in the "
188                  "current aw step.",
189            "ch": "当前aw步骤的参数解析异常."
190        }
191    }
192
193    Error_01210 = {
194        "Topic": "测试用例执行失败[01210]",
195        "Code": "01210",
196        "Message": {
197            "en": "An exception occurred when executing the current aw step.",
198            "ch": "当前aw步骤的执行异常."
199        }
200    }
201
202    Error_01211 = {
203        "Topic": "测试用例执行失败[01211]",
204        "Code": "01211",
205        "Message": {
206            "en": "Failed to connect to the device:The device goes offline.",
207            "ch": "连接设备失败:设备掉线."
208        }
209    }
210
211    Error_01212 = {
212        "Topic": "测试用例执行失败[01212]",
213        "Code": "01212",
214        "Message": {
215            "en": "Running the connector command times out.",
216            "ch": "执行connector命令超时."
217        }
218    }
219
220    Error_01213 = {
221        "Topic": "测试用例执行失败[01213]",
222        "Code": "01213",
223        "Message": {
224            "en": "Failed to install the App.",
225            "ch": "App安装失败."
226        }
227    }
228
229    Error_01214 = {
230        "Topic": "测试用例执行失败[01214]",
231        "Code": "01214",
232        "Message": {
233            "en": "with open write file content Failed.",
234            "ch": "打开并写入文件内容失败."
235        }
236    }
237
238    Error_01215 = {
239        "Topic": "测试用例执行失败[01215]",
240        "Code": "01215",
241        "Message": {
242            "en": "with open read file content Failed.",
243            "ch": "打开并读取文件内容失败."
244        }
245    }
246
247    Error_01216 = {
248        "Topic": "测试用例执行失败[01216]",
249        "Code": "01216",
250        "Message": {
251            "en": "with open read file: No such file.",
252            "ch": "读文件时文件不存在."
253        }
254    }
255
256    Error_01217 = {
257        "Topic": "测试用例执行失败[01217]",
258        "Code": "01217",
259        "Message": {
260            "en": "device not found:The test mobile phone is disconnected.",
261            "ch": "设备未找到:测试手机断连."
262        }
263    }
264
265    Error_01218 = {
266        "Topic": "测试用例执行失败[01218]",
267        "Code": "01218",
268        "Message": {
269            "en": "Failed to initialize the device object in the TestCase.",
270            "ch": "TestCase初始化设备对象异常."
271        }
272    }
273    ##########################################################################
274    # root 相应接口错误码
275
276    Error_01239 = {
277        "Topic": "测试用例执行失败[01239]",
278        "Code": "01239",
279        "Message": {
280            "en": "Can't get StatusBar height {}.",
281            "ch": "无法获取状态栏高度."
282        }
283    }
284
285    Error_01240 = {
286        "Topic": "测试用例执行失败[01240]",
287        "Code": "01240",
288        "Message": {
289            "en": "failed to refresh StatusBar.",
290            "ch": "刷新状态栏失败."
291        }
292    }
293
294    Error_01241 = {
295        "Topic": "测试用例执行失败[01241]",
296        "Code": "01241",
297        "Message": {
298            "en": "Widget don't have property {}.",
299            "ch": "工具没有对应属性."
300        }
301    }
302
303    Error_01242 = {
304        "Topic": "测试用例执行失败[01242]",
305        "Code": "01242",
306        "Message": {
307            "en": "can't get window named {} from device {}.",
308            "ch": "无法从设备获取指定的窗口."
309        }
310    }
311
312    Error_01243 = {
313        "Topic": "测试用例执行失败[01243]",
314        "Code": "01243",
315        "Message": {
316            "en": "get Focused WindowId Exception.",
317            "ch": "获取焦点窗口ID异常."
318        }
319    }
320
321    Error_01244 = {
322        "Topic": "测试用例执行失败[01244]",
323        "Code": "01244",
324        "Message": {
325            "en": "Unable to get the focused window name from device {}.",
326            "ch": "找到的视图节点不可见."
327        }
328    }
329
330    Error_01245 = {
331        "Topic": "测试用例执行失败[01245]",
332        "Code": "01245",
333        "Message": {
334            "en": "Finded viewnode with {} is not visible.",
335            "ch": "找到的视图节点不可见."
336        }
337    }
338
339    Error_01246 = {
340        "Topic": "测试用例执行失败[01246]",
341        "Code": "01246",
342        "Message": {
343            "en": "Not find viewnode with {}.",
344            "ch": "未找到对应视图节点."
345        }
346    }
347
348    Error_01247 = {
349        "Topic": "测试用例执行失败[01247]",
350        "Code": "01247",
351        "Message": {
352            "en": "cannot find viewnode with property {}.{}.",
353            "ch": "找不到具有属性的视图节点."
354        }
355    }
356
357    Error_01248 = {
358        "Topic": "测试用例执行失败[01248]",
359        "Code": "01248",
360        "Message": {
361            "en": "ViewNode is none.",
362            "ch": "目标控件对象为None."
363        }
364    }
365
366    Error_01249 = {
367        "Topic": "测试用例执行失败[01249]",
368        "Code": "01249",
369        "Message": {
370            "en": "parse View Hierarchy Exception.",
371            "ch": "解析视图层次结构异常."
372        }
373    }
374
375    Error_01250 = {
376        "Topic": "测试用例执行失败[01250]",
377        "Code": "01250",
378        "Message": {
379            "en": "load Window Data Exception.",
380            "ch": "获取视图数据异常."
381        }
382    }
383
384    Error_01251 = {
385        "Topic": "测试用例执行失败[01251]",
386        "Code": "01251",
387        "Message": {
388            "en": "get Focused Window Exception.",
389            "ch": "获取焦点窗口异常."
390        }
391    }
392
393    Error_01252 = {
394        "Topic": "测试用例执行失败[01252]",
395        "Code": "01252",
396        "Message": {
397            "en": "Load Windows Exception.",
398            "ch": "加载Windows服务异常."
399        }
400    }
401
402    Error_01253 = {
403        "Topic": "测试用例执行失败[01253]",
404        "Code": "01253",
405        "Message": {
406            "en": "stop View Server Failed.",
407            "ch": "停止视图服务失败."
408        }
409    }
410
411    Error_01254 = {
412        "Topic": "测试用例执行失败[01254]",
413        "Code": "01254",
414        "Message": {
415            "en": "start View Server Failed.",
416            "ch": "启动视图服务失败."
417        }
418    }
419
420    Error_01255 = {
421        "Topic": "测试用例执行失败[01255]",
422        "Code": "01255",
423        "Message": {
424            "en": "service call window 3 error.",
425            "ch": "服务调用窗口3错误."
426        }
427    }
428
429    Error_01256 = {
430        "Topic": "测试用例执行失败[01256]",
431        "Code": "01256",
432        "Message": {
433            "en": "setup Device Forward Failed.",
434            "ch": "设置设备转发失败."
435        }
436    }
437
438    Error_01257 = {
439        "Topic": "测试用例执行失败[01257]",
440        "Code": "01257",
441        "Message": {
442            "en": "Cannot forward to view server.",
443            "ch": "无法转发到查看服务器."
444        }
445    }
446
447    Error_01258 = {
448        "Topic": "测试用例执行失败[01258]",
449        "Code": "01258",
450        "Message": {
451            "en": "Could not connect to the view server.",
452            "ch": "无法连接到视图服务器."
453        }
454    }
455
456    Error_01259 = {
457        "Topic": "测试用例执行失败[01259]",
458        "Code": "01259",
459        "Message": {
460            "en": "Failed to create socket connection with view server.",
461            "ch": "创建与视图服务器的套接字连接失败."
462        }
463    }
464
465    ##########################################################################
466    # 业务使用
467
468    Error_01260 = {
469        "Topic": "测试用例执行失败[01260]",
470        "Code": "01260",
471        "Message": {
472            "en": "Assertion Error: Two objects determined by '==' are "
473                  "unequal,{}",
474            "ch": "断言错误: 由'=='确定的两个对象不相等."
475        }
476    }
477
478    Error_01261 = {
479        "Topic": "测试用例执行失败[01261]",
480        "Code": "01261",
481        "Message": {
482            "en": "Assertion Error: Two objects determined by '!=' are "
483                  "equal,{}",
484            "ch": "断言错误: 由'!='确定的两个对象相等."
485        }
486    }
487
488    Error_01262 = {
489        "Topic": "测试用例执行失败[01262]",
490        "Code": "01262",
491        "Message": {
492            "en": "Assertion Error: The asserted object is not false,{}",
493            "ch": "断言错误: 检查的对象不为false."
494        }
495    }
496
497    Error_01263 = {
498        "Topic": "测试用例执行失败[01263]",
499        "Code": "01263",
500        "Message": {
501            "en": "Assertion Error: The asserted object is not true.,{}",
502            "ch": "断言错误: 检查的对象不为true."
503        }
504    }
505
506    Error_01264 = {
507        "Topic": "测试用例执行失败[01264]",
508        "Code": "01264",
509        "Message": {
510            "en": "Assertion Error: The asserted object1 is not object2,{}",
511            "ch": "断言错误: 断言的对象1不是对象2."
512        }
513    }
514
515    Error_01265 = {
516        "Topic": "测试用例执行失败[01265]",
517        "Code": "01265",
518        "Message": {
519            "en": "Assertion Error: The asserted object1 is object2,{}",
520            "ch": "断言错误: 断言的对象1是对象2."
521        }
522    }
523
524    Error_01266 = {
525        "Topic": "测试用例执行失败[01266]",
526        "Code": "01266",
527        "Message": {
528            "en": "Assertion error: The asserted object is not None,{}",
529            "ch": "断言错误: 断言的对象不为None."
530        }
531    }
532
533    Error_01267 = {
534        "Topic": "测试用例执行失败[01267]",
535        "Code": "01267",
536        "Message": {
537            "en": "Assertion error: The asserted object is None,{}",
538            "ch": "断言错误: 断言的对象为None."
539        }
540    }
541
542    Error_01268 = {
543        "Topic": "测试用例执行失败[01268]",
544        "Code": "01268",
545        "Message": {
546            "en": "Assertion error: The asserted object1not in object2,{}",
547            "ch": "断言错误: 断言的对象1不在对象2中."
548        }
549    }
550
551    Error_01269 = {
552        "Topic": "测试用例执行失败[01269]",
553        "Code": "01269",
554        "Message": {
555            "en": "Assertion error: The asserted object1 in object2,{}",
556            "ch": "断言错误: 断言的对象1在对象2中."
557        }
558    }
559
560    Error_01270 = {
561        "Topic": "测试用例执行失败[01270]",
562        "Code": "01270",
563        "Message": {
564            "en": "Assertion error: The asserted object1 is not an instance "
565                  "of object2,{}",
566            "ch": "断言错误: 断言的对象1不是对象2的实例."
567        }
568    }
569
570    Error_01271 = {
571        "Topic": "测试用例执行失败[01271]",
572        "Code": "01271",
573        "Message": {
574            "en": "Assertion error: The asserted object1 is an instance of "
575                  "object2,{}",
576            "ch": "断言错误: 断言的对象1是对象2的实例."
577        }
578    }
579
580    Error_01272 = {
581        "Topic": "测试用例执行失败[01272]",
582        "Code": "01272",
583        "Message": {
584            "en": "Assertion error: The difference between object1 and "
585                  "object2 is not within the expected range,{}",
586            "ch": "断言错误: 断言的对象1与对象2的差值不在预期的范围内."
587        }
588    }
589
590    Error_01273 = {
591        "Topic": "测试用例执行失败[01273]",
592        "Code": "01273",
593        "Message": {
594            "en": "Assertion error: The difference between object1 and "
595                  "object2 is not within the expected range,{}",
596            "ch": "断言错误: 断言的对象1与对象2的差值不在预期的范围外."
597        }
598    }
599
600    Error_01274 = {
601        "Topic": "测试用例执行失败[01274]",
602        "Code": "01274",
603        "Message": {
604            "en": "Assertion error: The asserted object1 is not "
605                  "greater than object2,{}",
606            "ch": "断言错误: 断言的对象1小于等于对象2."
607        }
608    }
609
610    Error_01275 = {
611        "Topic": "测试用例执行失败[01275]",
612        "Code": "01275",
613        "Message": {
614            "en": "Assertion error: The asserted object1 is not "
615                  "greater than or equal to object2,{}",
616            "ch": "断言错误: 断言的对象1小于对象2."
617        }
618    }
619
620    Error_01276 = {
621        "Topic": "测试用例执行失败[01276]",
622        "Code": "01276",
623        "Message": {
624            "en": "Assertion error: The asserted object1 is not less than to "
625                  "object2,{}",
626            "ch": "断言错误: 断言的对象1大于等于对象2."
627        }
628    }
629
630    Error_01277 = {
631        "Topic": "测试用例执行失败[01277]",
632        "Code": "01277",
633        "Message": {
634            "en": "Assertion error: The asserted object1 is not "
635                  "less than or equal to object2,{}",
636            "ch": "断言错误: 断言的对象1大于对象2."
637        }
638    }
639
640    Error_01278 = {
641        "Topic": "测试用例执行失败[01278]",
642        "Code": "01278",
643        "Message": {
644            "en": "Assertion error: The asserted of two dict objects "
645                  "unequal,{}",
646            "ch": "断言错误: 断言的两个字典对象不相等."
647        }
648    }
649
650    Error_01279 = {
651        "Topic": "测试用例执行失败[01279]",
652        "Code": "01279",
653        "Message": {
654            "en": "Assertion error: The asserted of two set objects "
655                  "unequal,{}",
656            "ch": "断言错误: 断言的两个集合对象不相等."
657        }
658    }
659
660    Error_01280 = {
661        "Topic": "测试用例执行失败[01280]",
662        "Code": "01280",
663        "Message": {
664            "en": "Assertion error: The asserted of two tuple objects "
665                  "unequal,{}",
666            "ch": "断言错误: 断言的两个元组对象不相等."
667        }
668    }
669
670    Error_01281 = {
671        "Topic": "测试用例执行失败[01281]",
672        "Code": "01281",
673        "Message": {
674            "en": "Assertion error: The asserted of two list objects "
675                  "unequal,{}",
676            "ch": "断言错误: 断言的两个列表对象不相等."
677        }
678    }
679
680    Error_01282 = {
681        "Topic": "测试用例执行失败[01282]",
682        "Code": "01282",
683        "Message": {
684            "en": "Assertion error: The asserted of two sequence objects "
685                  "unequal,{}",
686            "ch": "断言错误: 断言的两个序列对象不相等."
687        }
688    }
689
690    Error_01283 = {
691        "Topic": "测试用例执行失败[01283]",
692        "Code": "01283",
693        "Message": {
694            "en": "Assertion error: Assert that two multi-line strings are "
695                  "unequal,{}",
696            "ch": "断言错误: 断言两个多行字符串不相等."
697        }
698    }
699
700    ##########################################################################
701
702    Error_01300 = {
703        "Topic": "测试任务被人工中止[01300]",
704        "Code": "01300",
705        "Message": {
706            "en": "A user manually terminates the current task on "
707                  "the DECC GUI.",
708            "ch": "用户在DECC界面上手动终止当前的任务执行."
709        }
710    }
711
712    Error_01301 = {
713        "Topic": "测试任务被人工中止[01301]",
714        "Code": "01301",
715        "Message": {
716            "en": "The test case is not executed(the task is manually "
717                  "stopped).",
718            "ch": "用例未执行(任务被手动停止)."
719        }
720    }
721
722    Error_01400 = {
723        "Topic": "测试任务被异常中止[01400]",
724        "Code": "01400",
725        "Message": {
726            "en": "An unexpected error occurs in the tool.",
727            "ch": "工具内部出现非预期的错误."
728        }
729    }
730
731    Error_01401 = {
732        "Topic": "测试任务被异常中止[01401]",
733        "Code": "01401",
734        "Message": {
735            "en": "The connector is disconnected and fails to be reconnected for "
736                  "10 consecutive times.",
737            "ch": "connector连接断链,连续10次重连失败."
738        }
739    }
740
741    Error_01402 = {
742        "Topic": "测试任务被异常中止[01402]",
743        "Code": "01402",
744        "Message": {
745            "en": "The Agent scocket service exits abnormally: Failed to "
746                  "parse the DECC IDE command message.",
747            "ch": "Agent scoket服务异常退出:解析DECC IDE命令消息失败."
748        }
749    }
750
751    Error_01403 = {
752        "Topic": "测试任务被异常中止[01403]",
753        "Code": "01403",
754        "Message": {
755            "en": "The Agent scocket service exits abnormally: Failed to "
756                  "decrypt the socket authentication message.",
757            "ch": "Agent scoket服务异常退出:socket认证消息解密失败."
758        }
759    }
760
761    Error_01404 = {
762        "Topic": "测试任务被异常中止[01404]",
763        "Code": "01404",
764        "Message": {
765            "en": "The test case is not executed(an unexpected error occurs "
766                  "in the tool).",
767            "ch": "用例未执行(工具内部出现非预期的错误)."
768        }
769    }
770
771    Error_01405 = {
772        "Topic": "测试任务被异常中止[01405]",
773        "Code": "01405",
774        "Message": {
775            "en": "Dry-run failed: An error is during {} script query.",
776            "ch": "dry-run失败:查找{}脚本出错."
777        }
778    }
779
780    Error_01406 = {
781        "Topic": "测试任务被异常中止[01406]",
782        "Code": "01406",
783        "Message": {
784            "en": "Failed to start the xdevice service: Failed to load the "
785                  "xdevice-extension extension module.",
786            "ch": "拉起xdevice服务失败:加载xdevice-extension扩展模块失败."
787        }
788    }
789
790    Error_01407 = {
791        "Topic": "测试任务被异常中止[01407]",
792        "Code": "01407",
793        "Message": {
794            "en": "Dry-run failed: The syntax format of statement in '{}'.py "
795                  "is wrong when parse step parameter, please check! "
796                  "statement:{}.",
797            "ch": "dry-run失败:在解析step parameter时,'{}'.py中语句的语法格式错"
798                  "误,请检查,语句:{}."
799        }
800    }
801
802    Error_01408 = {
803        "Topic": "测试任务被异常中止[01408]",
804        "Code": "01408",
805        "Message": {
806            "en": "Dry-run failed: The syntax format of statement in '{}'.py "
807                  "is wrong when parse step content, please check! "
808                  "statement:{}.",
809            "ch": "dry-run失败:在解析step content时,'{}'.py中语句的语法格式错误,"
810                  "请检查!声明:{}."
811        }
812    }
813
814    Error_01409 = {
815        "Topic": "测试任务被异常中止[01409]",
816        "Code": "01409",
817        "Message": {
818            "en": "Dry-run failed: The script '{}.py/pyd' not exist, "
819                  "please check!",
820            "ch": "dry-run失败:脚本'{}.py/pyd'不存在,请检查!"
821        }
822    }
823    Error_01410 = {
824        "Topic": "测试任务被异常中止[01410]",
825        "Code": "01410",
826        "Message": {
827            "en": "Dry-run failed: Load script {} failed!",
828            "ch": "dry-run失败:加载脚本{}失败!"
829        }
830    }
831
832    Error_01411 = {
833        "Topic": "测试任务被异常中止[01411]",
834        "Code": "01411",
835        "Message": {
836            "en": "The Agent scocket service exits abnormally: "
837                  "An error is reported when the socket message is parsed.",
838            "ch": "Agent scoket服务异常退出:socket消息解析处理异常报错."
839        }
840    }
841
842    Error_01412 = {
843        "Topic": "测试任务被异常中止[01412]",
844        "Code": "01412",
845        "Message": {
846            "en": "Environment configuration error: The message format of "
847                  "environment configuration is wrong. Please check.",
848            "ch": "环境配置异常:环境配置消息格式错误,请查一下."
849        }
850    }
851
852    Error_01413 = {
853        "Topic": "测试任务被异常中止[01413]",
854        "Code": "01413",
855        "Message": {
856            "en": "Environment configuration error: The workspace path {} "
857                  "delivered by the client does not exist.",
858            "ch": "环境配置异常:客户端下发的工作路径xxx不存在!"
859        }
860    }
861
862    Error_01414 = {
863        "Topic": "测试任务被异常中止[01414]",
864        "Code": "01414",
865        "Message": {
866            "en": "Environment configuration error: test suite type error, "
867                  "not in ['Kit', 'OS'].",
868            "ch": "环境配置异常:测试套件类型不在【'Kit', 'OS'】中."
869        }
870    }
871
872    Error_01415 = {
873        "Topic": "测试任务被异常中止[01415]",
874        "Code": "01415",
875        "Message": {
876            "en": "Environment configuration error: The type of the param "
877                  "parameter "
878                  "delivered by the client is incorrect, which is not a "
879                  "known dictionary type.",
880            "ch": "环境配置异常:客户端下发的param参数类型错误,不是已知的字典类型."
881        }
882    }
883
884    Error_01416 = {
885        "Topic": "测试任务被异常中止[01416]",
886        "Code": "01416",
887        "Message": {
888            "en": "Dry-run failed: An unknown exception occurred during "
889                  "the dry-run process.",
890            "ch": "dry-run失败:dry-run过程出现未知异常."
891        }
892    }
893
894    Error_01417 = {
895        "Topic": "测试任务被异常中止[01417]",
896        "Code": "01417",
897        "Message": {
898            "en": "Failed to start the Agent service task because no "
899                  "environment is configured before the task is started.",
900            "ch": "Agent服务启动任务失败:启动任务前没有配置环境"
901        }
902    }
903
904    Error_01418 = {
905        "Topic": "测试任务被异常中止[01418]",
906        "Code": "01418",
907        "Message": {
908            "en": "An error is reported when the Agent service is started.",
909            "ch": "Agent服务启动任务异常报错."
910        }
911    }
912
913    Error_01419 = {
914        "Topic": "测试任务被异常中止[01419]",
915        "Code": "01419",
916        "Message": {
917            "en": "Agent server pull xdevice runner failed.",
918            "ch": "Agent服务拉取xdevice服务失败."
919        }
920    }
921
922    Error_01420 = {
923        "Topic": "测试任务被异常中止[01420]",
924        "Code": "01420",
925        "Message": {
926            "en": "Agent server start task retry failed.",
927            "ch": "Agent服务启动任务重试失败."
928        }
929    }
930
931    Error_01421 = {
932        "Topic": "测试任务被异常中止[01421]",
933        "Code": "01421",
934        "Message": {
935            "en": "Failed to update the XML Report Str.",
936            "ch": "更新xml report str失败."
937        }
938    }
939
940    Error_01422 = {
941        "Topic": "测试任务被异常中止[01422]",
942        "Code": "01422",
943        "Message": {
944            "en": "Failed to start xdevice agent service: An unknown "
945                  "exception was encountered.",
946            "ch": "启动xdevice agent服务失败:遇到未知异常."
947        }
948    }
949
950    Error_01423 = {
951        "Topic": "测试任务被异常中止[01423]",
952        "Code": "01423",
953        "Message": {
954            "en": "Failed to start the xdevice agent service "
955                  "because an error is reported when parsing the args "
956                  "parameter.",
957            "ch": "启动xdevice agent服务失败:解析args参数报错."
958        }
959    }
960
961    Error_01424 = {
962        "Topic": "测试任务被异常中止[01424]",
963        "Code": "01424",
964        "Message": {
965            "en": "Failed to reclaim the xdevice agent service process.",
966            "ch": "回收xdevice agent服务进程失败."
967        }
968    }
969
970    Error_01425 = {
971        "Topic": "测试任务被异常中止[01425]",
972        "Code": "01425",
973        "Message": {
974            "en": "Socket message authentication failed:Decrypt failed due "
975                  "to The message component, decrypted message, or key type "
976                  "is incorrect.",
977            "ch": "socket消息认证失败:消息组件、解密的消息、秘钥类型错误导致解密失败."
978        }
979    }
980
981    Error_01426 = {
982        "Topic": "测试任务被异常中止[01426]",
983        "Code": "01426",
984        "Message": {
985            "en": "Socket message authentication failed:An unknown error "
986                  "occurred during message decryption, and the socket message"
987                  " authentication failed.",
988            "ch": "socket消息认证失败:消息解密遇到未知错误."
989        }
990    }
991
992    Error_01427 = {
993        "Topic": "测试任务被异常中止[01427]",
994        "Code": "01427",
995        "Message": {
996            "en": "devicetest upload generate test report failed.",
997            "ch": "devicetest上报任务汇总报告失败."
998        }
999    }
1000
1001    Error_01428 = {
1002        "Topic": "测试任务被异常中止[01428]",
1003        "Code": "01428",
1004        "Message": {
1005            "en": "devicetest upload generate test report failed.",
1006            "ch": "devicetest上报任务汇总报告失败."
1007        }
1008    }
1009
1010    Error_01429 = {
1011        "Topic": "测试任务被异常中止[01429]",
1012        "Code": "01429",
1013        "Message": {
1014            "en": "Failed to obtain the list of failed cases during task "
1015                  "rerun. An unknown error is reported.",
1016            "ch": "任务重跑获取失败用例列表异常:出现未知报错."
1017        }
1018    }
1019
1020    Error_01430 = {
1021        "Topic": "测试任务被异常中止[01430]",
1022        "Code": "01430",
1023        "Message": {
1024            "en": "The type of the test case list transferred by the xdevice "
1025                  "is incorrect.",
1026            "ch": "xdevice传递重试用例列表类型错误,不是列表."
1027        }
1028    }
1029
1030    Error_01431 = {
1031        "Topic": "测试任务被异常中止[01431]",
1032        "Code": "01431",
1033        "Message": {
1034            "en": "Dry-run failed: The {} json configuration file of the "
1035                  "scrpit does not exist. Please check.",
1036            "ch": "dry-run失败:脚本xxx.json配置文件不存在,请检查!"
1037        }
1038    }
1039
1040    Error_01432 = {
1041        "Topic": "测试任务被异常中止[01432]",
1042        "Code": "01432",
1043        "Message": {
1044            "en": "Failed to obtain the test case during task re-execution. "
1045                  "An error is reported when the data returned by the "
1046                  "xdevice is parsed.",
1047            "ch": "任务重跑获取失败用例异常:解析xdevice返回的数据报错."
1048        }
1049    }
1050
1051    Error_01433 = {
1052        "Topic": "测试任务被异常中止[01433]",
1053        "Code": "01433",
1054        "Message": {
1055            "en": "report path is None, Please check",
1056            "ch": "获取任务报告失败,请检查!"
1057        }
1058    }
1059
1060    Error_01434 = {
1061        "Topic": "测试任务被异常中止[01434]",
1062        "Code": "01434",
1063        "Message": {
1064            "en": "Failed to instantiate the test runner.",
1065            "ch": "实例化测试运行程序失败."
1066        }
1067    }
1068
1069    Error_01435 = {
1070        "Topic": "测试任务被异常中止[01435]",
1071        "Code": "01435",
1072        "Message": {
1073            "en": "Set locales failed.",
1074            "ch": "设置本地化失败."
1075        }
1076    }
1077
1078    Error_01436 = {
1079        "Topic": "测试任务被异常中止[01436]",
1080        "Code": "01436",
1081        "Message": {
1082            "en": "The DECC does not deliver the log encryption key.",
1083            "ch": "DECC未下发日志加密秘钥."
1084        }
1085    }
1086
1087    Error_01437 = {
1088        "Topic": "测试任务被异常中止[01437]",
1089        "Code": "01437",
1090        "Message": {
1091            "en": "Failed to obtain the spt value of the configuration file, {}.",
1092            "ch": "获取配置文件的spt值失败."
1093        }
1094    }
1095
1096    Error_01438 = {
1097        "Topic": "测试任务被异常中止[01438]",
1098        "Code": "01438",
1099        "Message": {
1100            "en": "Loop continues fail.",
1101            "ch": "循环测试中连续失败."
1102        }
1103    }
1104
1105    ##########################################################################
1106    # RPC错误码
1107    Error_01439 = {
1108        "Topic": "测试用例执行失败[01439]",
1109        "Code": "01439",
1110        "Message": {
1111            "en": "The RPC service fails to be started.",
1112            "ch": "RPC服务启动失败。"
1113        }
1114    }
1115
1116    Error_01440 = {
1117        "Topic": "测试用例执行失败[01440]",
1118        "Code": "01440",
1119        "Message": {
1120            "en": "The RPC process is not found.",
1121            "ch": "RPC进程未查询到。"
1122        }
1123    }
1124
1125    # 脚本自定义的异常信息:上报用例结果的fail_msg用脚本自定义的异常信息
1126    Error_01500 = {
1127        "Topic": "{}[01500]",
1128        "Code": "01500",
1129        "Message": {
1130            "en": "",
1131            "ch": "脚本自定义的错误信息."
1132        }
1133    }
1134
1135
1136class ErrorMessage(DetailErrorMassage):
1137    """
1138    # 打印异常类信息
1139    1开头:工具报错
1140    2开头:测试套
1141    3开头:环境
1142    001:未知错误
1143    """
1144
1145    class Dict(dict):
1146        __setattr__ = dict.__setitem__
1147        __getattr__ = dict.__getitem__
1148
1149    @classmethod
1150    def add_attribute(cls):
1151        for _attribute in dir(DetailErrorMassage):
1152            if _attribute.startswith("Error_"):
1153                get_value = getattr(DetailErrorMassage, _attribute)
1154                if isinstance(get_value, dict):
1155                    value = cls.dict_to_object(get_value)
1156                    setattr(cls, _attribute, value)
1157
1158    @classmethod
1159    def dict_to_object(cls, dict_obj):
1160        if not isinstance(dict_obj, dict):
1161            return dict_obj
1162        inst = cls.Dict()
1163        for _key, _value in dict_obj.items():
1164            inst[_key] = cls.dict_to_object(_value)
1165        return inst
1166
1167
1168# 添加类属性
1169ErrorMessage.add_attribute()
1170
1171if __name__ == '__main__':
1172    print(ErrorMessage.Error_01300)
1173    print(ErrorMessage.Error_01424)
1174    print(ErrorMessage.Error_01424.Code)
1175    print(ErrorMessage.Error_01424.Message.ch)
1176