Skip to content

Commit 56e09dd

Browse files
authored
Test generation fails if any unexpected exception occurs for a single method #661 (#662)
1 parent 5ac552b commit 56e09dd

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/TestCaseGenerator.kt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import kotlinx.coroutines.CoroutineScope
44
import kotlinx.coroutines.GlobalScope
55
import kotlinx.coroutines.cancel
66
import kotlinx.coroutines.flow.Flow
7+
import kotlinx.coroutines.flow.catch
78
import kotlinx.coroutines.flow.collect
89
import kotlinx.coroutines.isActive
910
import kotlinx.coroutines.launch
@@ -159,12 +160,16 @@ open class TestCaseGenerator(
159160

160161
engineActions.map { engine.apply(it) }
161162

162-
generate(engine).collect {
163-
when (it) {
164-
is UtExecution -> method2executions.getValue(method) += it
165-
is UtError -> method2errors.getValue(method).merge(it.description, 1, Int::plus)
163+
generate(engine)
164+
.catch {
165+
logger.error(it) { "Error in flow" }
166+
}
167+
.collect {
168+
when (it) {
169+
is UtExecution -> method2executions.getValue(method) += it
170+
is UtError -> method2errors.getValue(method).merge(it.description, 1, Int::plus)
171+
}
166172
}
167-
}
168173
}
169174
controller.paused = true
170175
}

0 commit comments

Comments
 (0)