Skip to content

Commit 86f7831

Browse files
committed
Introduce todo.txt annotation to mark integration tests as disabled.
Similar to previous `disabled.txt`, but ensures that fixed integration tests don't stay disabled. Failing tests marked as "to do" will be reported as *skipped*; passing tests marked as "to do" will be reported as *failed*. Set environment variable `METAFIX_DISABLE_TO_DO=true` (or system property `org.metafacture.metafix.disableToDo=true` when run via Gradle) to mimic previous `disabled.txt` behaviour. Analogous to `@MetafixToDo` annotation in unit tests (see #158 and f4a7523).
1 parent f8495c2 commit 86f7831

File tree

52 files changed

+50
-29
lines changed
  • metafix
    • src/test/resources/org/metafacture/metafix/integration
      • bind/fromJson/toJson/listSimpleArrayOfStringsWithVariableAndAppend
      • lookup/fromJson/toJson/lookupSimpleWithInternalMapWithoutMatch
      • method/fromJson/toJson
        • appendArrayOfObjectsWithFirstArrayWildcard
        • appendArrayOfObjectsWithLastArrayWildcard
        • flatten
        • prependArrayOfObjectsWithFirstArrayWildcard
        • prependArrayOfObjectsWithLastArrayWildcard
        • reverseSubfieldInArrayOfObjects
        • reverseValuesInArrayOfStrings
        • sort_fieldInArrayOfObjectsWithAsterisk
        • split_fieldSubfieldInArrayOfObjectsWithAsterisk
        • sumSubfieldInArrayOfObjects
      • record/fromJson/toJson
        • add_fieldAppendAndCreateArray
        • add_fieldAsteriskIntoArrayOfObjects
        • add_fieldPrependAndCreateArray
        • add_fieldSimpleDestructive
        • add_fieldSimpleSubsubfield
        • copy_fieldAppendAndCreateArray
        • copy_fieldAppendObjectToArrayOfObjects
        • copy_fieldArrayOfObjectsAsRepeatedObjectAndThenArrayOfStringsIntoTheArrayOfObjectsWithLastWildcard
        • copy_fieldArrayOfStringsIntoArrayOfObjectsWithAsteriskWildcard
        • copy_fieldAsteriskIntoArrayOfObjects
        • copy_fieldFromArrayOfStringsInArrayOfObjectsWithAsterisk
        • copy_fieldFromSubfieldInArrayOfObjectsInArrayOfObjectsWithAsterisk
        • copy_fieldObjectFromArrayOfObjectsWithFirstWildcard
        • copy_fieldObjectFromArrayOfObjectsWithLastWildcard
        • copy_fieldPrependAndCreateArray
        • copy_fieldPrependObjectToArrayOfObjects
        • copy_fieldSimpleDestructive
        • copy_fieldValuesOfArrayOfStringsIntoArray
        • copy_fieldWithAlternationOfFieldInArrayOfObjects
        • copy_fieldWithAlternationOfFieldInMultipleArraysOfObjects
        • copy_fieldWithAlternationOfNestedFields
        • move_fieldAppendAndCreateArray
        • move_fieldAppendObjectToArrayOfObjects
        • move_fieldArrayOfStringsWithinArrayOfObjects
        • move_fieldAsteriskIntoArrayOfObjects
        • move_fieldIntoOwnSubfield
        • move_fieldPrependAndCreateArray
        • move_fieldPrependObjectToArrayOfObjects
        • move_fieldSimpleDestructive
        • move_fieldSimpleWithAsteriskPathWildcard
        • move_fieldSimpleWithLeadingQuestionmarkPathWildcard
        • move_fieldSimpleWithTrailingAsteriskPathWildcard
        • move_fieldWithAlternationOfFieldInArrayOfObjects
        • move_fieldWithAlternationOfFieldInMultipleArraysOfObjects
        • move_fieldWithAlternationOfNestedFields
        • retainCertainSubfields
        • set_arrayIntoArray

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+50
-29
lines changed

build.gradle

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ plugins {
66

77
editorconfig {
88
excludes = [
9-
'**/generated',
10-
'**/xtext-gen',
11-
'**/bin',
9+
'**/*.out',
10+
'**/*.vsix',
1211
'**/.*',
13-
'gradlew*',
14-
'**/out',
12+
'**/bin',
13+
'**/generated',
1514
'**/node_modules',
16-
'**/*.vsix'
15+
'**/out',
16+
'**/output-*',
17+
'**/xtext-gen',
18+
'gradlew*'
1719
]
1820
}
1921

metafix/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ test {
6363

6464
task integrationTest(type: Exec, group: 'Verification') {
6565
executable './integrationTest.sh'
66-
if (project.hasProperty("args")) args project.getProperty("args").split()
66+
67+
if (project.hasProperty('args')) args project.getProperty('args').split()
68+
environment.METAFIX_DISABLE_TO_DO = System.getProperty('org.metafacture.metafix.disableToDo')
6769
}
6870

6971
task install(dependsOn: publishToMavenLocal, group: 'Publishing',

metafix/integrationTest.sh

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ metafix_file=test.flux
88
catmandu_file=test.cmd
99

1010
fix_file=test.fix
11-
disabled_file=disabled.txt
11+
todo_file=todo.txt
1212

1313
input_glob=input.*
1414
expected_glob=expected.*
@@ -20,6 +20,12 @@ root_directory="$PWD"
2020
data_directory="$root_directory/src/test/resources/org/metafacture/metafix/integration"
2121
gradle_command="$root_directory/../gradlew"
2222

23+
function parse_boolean() {
24+
[ "${1,,}" == true ]
25+
}
26+
27+
parse_boolean "$METAFIX_DISABLE_TO_DO" && disable_todo=1 || disable_todo=
28+
2329
[ -t 1 -a -x /usr/bin/colordiff ] && colordiff=colordiff || colordiff=cat
2430

2531
function _tput() {
@@ -112,13 +118,30 @@ function command_info() {
112118

113119
[ -s "$3" ] && log " ${color_info}${1^} command output$color_reset: $3" || rm -f "$3"
114120
[ -s "$4" ] && log " ${color_info}${1^} command error$color_reset: $4" || rm -f "$4"
121+
122+
log
123+
}
124+
125+
function skip_test() {
126+
if [ -r "$2" ]; then
127+
local message="$color_test$1$color_reset: ${color_skipped}SKIPPED$color_reset" reason=$(head -1 "$2")
128+
129+
[ -n "$reason" ] && message+=" ($reason)"
130+
log "$message"
131+
132+
((skipped++)) || true
133+
134+
return 0;
135+
else
136+
return 1;
137+
fi
115138
}
116139

117140
function run_tests() {
118141
local test matched=1\
119-
test_input test_expected test_disabled\
120-
metafix_command_output metafix_command_error\
121-
metafix_exit_status metafix_output metafix_diff
142+
test_directory test_fix test_input test_expected test_todo\
143+
metafix_command_output metafix_command_error metafix_start_time\
144+
metafix_exit_status metafix_output metafix_diff metafix_elapsed_time
122145

123146
cd "$data_directory"
124147

@@ -138,13 +161,9 @@ function run_tests() {
138161
get_file "$test" expected "$test_directory"/$expected_glob || { log; continue; }
139162
test_expected=$current_file
140163

141-
test_disabled="$test_directory/$disabled_file"
164+
test_todo="$test_directory/$todo_file"
142165

143-
if [ -r "$test_disabled" ]; then
144-
log "$color_test$test$color_reset: ${color_skipped}SKIPPED$color_reset ($(<"$test_disabled"))"
145-
146-
((skipped++)) || true
147-
else
166+
if [ -z "$disable_todo" ] || ! skip_test "$test" "$test_todo"; then
148167
metafix_command_output="$test_directory/metafix.out"
149168
metafix_command_error="$test_directory/metafix.err"
150169

@@ -162,14 +181,18 @@ function run_tests() {
162181
metafix_elapsed_time=$(elapsed_time "$metafix_start_time")
163182

164183
if diff -u "$test_expected" "$metafix_output" >"$metafix_diff"; then
165-
#log "$color_test$test$color_reset: ${color_passed}PASSED$color_reset$metafix_elapsed_time"
184+
if [ -r "$test_todo" ]; then
185+
log "$color_test$test$color_reset: ${color_failed}FAILED$color_reset (Marked as \"to do\", but passed.)"
166186

167-
rm -f "$metafix_diff" "$metafix_command_output" "$metafix_command_error"
187+
((failed++)) || true
188+
else
189+
#log "$color_test$test$color_reset: ${color_passed}PASSED$color_reset$metafix_elapsed_time"
168190

169-
((passed++)) || true
191+
((passed++)) || true
192+
fi
170193

171-
#log
172-
else
194+
rm -f "$metafix_diff" "$metafix_command_output" "$metafix_command_error"
195+
elif ! skip_test "$test" "$test_todo"; then
173196
log "$color_test$test$color_reset: ${color_failed}FAILED$color_reset$metafix_elapsed_time"
174197

175198
log " Fix: $test_fix"
@@ -183,24 +206,18 @@ function run_tests() {
183206
command_info metafix "$metafix_exit_status" "$metafix_command_output" "$metafix_command_error"
184207

185208
((failed++)) || true
186-
187-
log
188209
fi
189210
else
190211
command_info metafix "$metafix_exit_status" "$metafix_command_output" "$metafix_command_error"
191-
192-
log
193212
fi
194-
else
213+
elif ! skip_test "$test" "$test_todo"; then
195214
metafix_exit_status=$?
196215

197216
log "$color_test$test$color_reset: ${color_error}ERROR$color_reset"
198217

199218
command_info metafix "$metafix_exit_status" "$metafix_command_output" "$metafix_command_error"
200219

201220
((failed++)) || true
202-
203-
log
204221
fi
205222
fi
206223
done

0 commit comments

Comments
 (0)