Skip to content

Commit e5b2f7f

Browse files
committed
specify if a test case should fail or pass
1 parent 94fc0eb commit e5b2f7f

File tree

6 files changed

+40
-6
lines changed

6 files changed

+40
-6
lines changed

backend/src/main/java/de/learnlib/alex/testsuites/entities/TestCase.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,17 @@ public void setName(String name) {
7979
/** The map with the variables for the test case. */
8080
private HashMap<String, String> variables;
8181

82+
/** If the test case execution should pass. */
83+
private boolean shouldPass;
84+
8285
/**
8386
* Default Constructor.
8487
*/
8588
public TestCase() {
8689
super();
8790
this.symbols = new LinkedList<>();
8891
this.variables = new HashMap<>();
92+
this.shouldPass = true;
8993
}
9094

9195
/**
@@ -164,13 +168,19 @@ public void addSymbol(Symbol action) {
164168
}
165169

166170
@Lob
167-
@JsonProperty
168171
public HashMap<String, String> getVariables() {
169172
return variables;
170173
}
171174

172-
@JsonProperty
173175
public void setVariables(HashMap<String, String> variables) {
174176
this.variables = variables;
175177
}
178+
179+
public boolean isShouldPass() {
180+
return shouldPass;
181+
}
182+
183+
public void setShouldPass(boolean shouldPass) {
184+
this.shouldPass = shouldPass;
185+
}
176186
}

backend/src/main/java/de/learnlib/alex/testsuites/entities/TestCaseResult.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public TestCaseResult(TestCase testCase, List<String> outputs, boolean passed, l
5656
super(testCase);
5757
this.outputs = outputs;
5858
this.passed = passed;
59+
this.passed = testCase.isShouldPass() == passed;
5960
this.time = time;
6061
this.failureMessage = failureMessage;
6162
}

frontend/src/main/javascript/src/html/components/views/test-case-view.html

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="view">
1+
<div class="view view-test-case">
22
<view-header title="Test Management"></view-header>
33
<action-bar>
44
<button class="btn btn-sm btn-success" ng-click="vm.save()">
@@ -34,11 +34,21 @@
3434
<button class="btn btn-sm btn-default" ui-sref="tests({testId: vm.testCase.parent})" style="margin-right: 12px">
3535
<i class="fa fa-fw fa-level-up"></i>
3636
</button>
37-
<h4 style="display: inline; margin: 0;">
37+
<h4 class="flex-grow-1" style="margin: 0;">
3838
<strong>
3939
<i class="fa fa-fw fa-file-o"></i> {{vm.testCase.name}}
4040
</strong>
4141
</h4>
42+
<button class="btn btn-sm btn-default text-left toggle-button-success"
43+
ng-class="{'toggle-button-success': vm.testCase.shouldPass, 'toggle-button-danger': !vm.testCase.shouldPass}"
44+
ng-click="vm.testCase.shouldPass = !vm.testCase.shouldPass">
45+
<span ng-if="vm.testCase.shouldPass">
46+
<i class="fa fa-toggle-on mr-1"></i>Should pass
47+
</span>
48+
<span ng-if="!vm.testCase.shouldPass">
49+
<i class="fa fa-toggle-on fa-flip-horizontal mr-1"></i>Should fail
50+
</span>
51+
</button>
4252
</div>
4353

4454
<hr>

frontend/src/main/javascript/src/js/components/views/testSuiteView.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ export const testSuiteView = {
128128
project: this.project.id,
129129
parent: this.testSuite.id,
130130
symbols: [],
131-
variables: {}
131+
variables: {},
132+
shouldPass: true
132133
};
133134
this.TestResource.create(testCase)
134135
.then(data => {

frontend/src/main/javascript/src/scss/_font-awesome.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ $fa-font-path: "../../fonts" !default;
99
// @import "../../node_modules/font-awesome/scss/list";
1010
// @import "../../node_modules/font-awesome/scss/bordered-pulled";
1111
@import "../../node_modules/font-awesome/scss/animated";
12-
// @import "../../node_modules/font-awesome/scss/rotated-flipped";
12+
@import "../../node_modules/font-awesome/scss/rotated-flipped";
1313
// @import "../../node_modules/font-awesome/scss/stacked";
1414
@import "../../node_modules/font-awesome/scss/icons";

frontend/src/main/javascript/src/scss/style.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,18 @@ body {
132132
margin-bottom: 36px;
133133
}
134134
}
135+
136+
&.view-test-case {
137+
.toggle-button-success {
138+
border-color: $brand-success;
139+
color: $brand-success;
140+
}
141+
142+
.toggle-button-danger {
143+
border-color: $brand-danger;
144+
color: $brand-danger;
145+
}
146+
}
135147
}
136148

137149
.view-body {

0 commit comments

Comments
 (0)