-
-
Notifications
You must be signed in to change notification settings - Fork 447
Expand file tree
/
Copy pathSuiteTestExecution.java
More file actions
100 lines (78 loc) · 3.38 KB
/
SuiteTestExecution.java
File metadata and controls
100 lines (78 loc) · 3.38 KB
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
package ai.giskard.domain.ml;
import ai.giskard.domain.BaseEntity;
import ai.giskard.utils.SimpleJSONStringAttributeConverter;
import ai.giskard.web.dto.ml.TestResultMessageDTO;
import ai.giskard.worker.SingleTestResult;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Entity
@NoArgsConstructor
@Getter
@Setter
public class SuiteTestExecution extends BaseEntity {
private Long id;
@ManyToOne(optional = false)
@JsonIgnore
private SuiteTest test;
@ManyToOne
@JsonIgnore
private TestSuiteExecution execution;
@Column(columnDefinition = "VARCHAR")
@Convert(converter = SimpleJSONStringAttributeConverter.class)
private Map<String, String> inputs;
@Column(columnDefinition = "VARCHAR")
@Convert(converter = SimpleJSONStringAttributeConverter.class)
private List<TestResultMessageDTO> messages;
@Column(columnDefinition = "VARCHAR")
@Convert(converter = SimpleJSONStringAttributeConverter.class)
private List<Integer> actualSlicesSize;
@Column(columnDefinition = "VARCHAR")
@Convert(converter = SimpleJSONStringAttributeConverter.class)
private List<Integer> referenceSlicesSize;
@Enumerated(EnumType.STRING)
private TestResult status;
@Column(columnDefinition = "VARCHAR")
@Convert(converter = SimpleJSONStringAttributeConverter.class)
private List<Integer> partialUnexpectedIndexList;
@Column(columnDefinition = "VARCHAR")
@Convert(converter = SimpleJSONStringAttributeConverter.class)
private List<Integer> unexpectedIndexList;
private Integer missingCount;
private Double missingPercent;
private Integer unexpectedCount;
private Double unexpectedPercent;
private Double unexpectedPercentTotal;
private Double unexpectedPercentNonmissing;
@Column(nullable = false)
private float metric;
public SuiteTestExecution(SuiteTest test,
TestSuiteExecution execution,
SingleTestResult message) {
this.test = test;
this.execution = execution;
this.missingCount = message.getMissingCount();
this.missingPercent = message.getMissingPercent();
this.unexpectedCount = message.getUnexpectedCount();
this.unexpectedPercent = message.getUnexpectedPercent();
this.unexpectedPercentTotal = message.getUnexpectedPercentTotal();
this.unexpectedPercentNonmissing = message.getUnexpectedPercentNonmissing();
this.partialUnexpectedIndexList = message.getPartialUnexpectedIndexListList();
this.unexpectedIndexList = message.getUnexpectedIndexListList();
this.status = message.getIsError()
? TestResult.ERROR : message.getPassed()
? TestResult.PASSED : TestResult.FAILED;
this.metric = message.getMetric();
this.actualSlicesSize = message.getActualSlicesSizeList();
this.referenceSlicesSize = message.getReferenceSlicesSizeList();
this.messages = message.getMessagesList().stream().map(
msg -> new TestResultMessageDTO(msg.getType(), msg.getText())).toList();
this.inputs = test.getFunctionInputs().stream()
.collect(Collectors.toMap(FunctionInput::getName, FunctionInput::getValue));
}
}