summaryrefslogtreecommitdiffstats
path: root/contrib/python/allure-python-commons/allure_commons/model2.py
blob: cd069b176fdd71f3a7880929b5e15e0b0353a2f2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
from attr import attrs, attrib
from attr import Factory


TEST_GROUP_PATTERN = "{prefix}-container.json"
TEST_CASE_PATTERN = "{prefix}-result.json"
ATTACHMENT_PATTERN = "{prefix}-attachment.{ext}"
GLOBALS_PATTERN = "{prefix}-globals.json"
INDENT = 4


@attrs
class TestResultContainer:
    file_pattern = TEST_GROUP_PATTERN

    uuid = attrib(default=None)
    name = attrib(default=None)
    children = attrib(default=Factory(list))
    description = attrib(default=None)
    descriptionHtml = attrib(default=None)
    befores = attrib(default=Factory(list))
    afters = attrib(default=Factory(list))
    links = attrib(default=Factory(list))
    start = attrib(default=None)
    stop = attrib(default=None)


@attrs
class ExecutableItem:
    name = attrib(default=None)
    status = attrib(default=None)
    statusDetails = attrib(default=None)
    stage = attrib(default=None)
    description = attrib(default=None)
    descriptionHtml = attrib(default=None)
    steps = attrib(default=Factory(list))
    attachments = attrib(default=Factory(list))
    parameters = attrib(default=Factory(list))
    start = attrib(default=None)
    stop = attrib(default=None)


@attrs
class TestResult(ExecutableItem):
    file_pattern = TEST_CASE_PATTERN

    uuid = attrib(default=None)
    historyId = attrib(default=None)
    testCaseId = attrib(default=None)
    fullName = attrib(default=None)
    labels = attrib(default=Factory(list))
    links = attrib(default=Factory(list))
    titlePath = attrib(default=Factory(list))


@attrs
class TestStepResult(ExecutableItem):
    id = attrib(default=None)


@attrs
class TestBeforeResult(ExecutableItem):
    pass


@attrs
class TestAfterResult(ExecutableItem):
    pass


@attrs
class Parameter:
    name = attrib(default=None)
    value = attrib(default=None)
    excluded = attrib(default=None)
    mode = attrib(default=None)


@attrs
class Label:
    name = attrib(default=None)
    value = attrib(default=None)


@attrs
class Link:
    type = attrib(default=None)
    url = attrib(default=None)
    name = attrib(default=None)


@attrs
class StatusDetails:
    known = attrib(default=None)
    flaky = attrib(default=None)
    message = attrib(default=None)
    trace = attrib(default=None)


@attrs
class Attachment:
    name = attrib(default=None)
    source = attrib(default=None)
    type = attrib(default=None)


@attrs
class GlobalAttachment(Attachment):
    timestamp = attrib(default=None)


@attrs
class GlobalError(StatusDetails):
    timestamp = attrib(default=None)


@attrs
class Globals:
    file_pattern = GLOBALS_PATTERN

    attachments = attrib(default=Factory(list))
    errors = attrib(default=Factory(list))


class Status:
    FAILED = "failed"
    BROKEN = "broken"
    PASSED = "passed"
    SKIPPED = "skipped"
    UNKNOWN = "unknown"