Try another approach to mark hanging generated tests #371 by Vassiliy-Kudryashov · Pull Request #554 · UnitTestBot/UTBotJava · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,17 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
return
}

when (exception) {
is TimeoutException -> {
methodType = TIMEOUT
writeWarningAboutTimeoutExceeding()
if (shouldTestPassWithTimeoutException(execution, exception)) {
writeWarningAboutTimeoutExceeding()
testFrameworkManager.expectTimeout(hangingTestsTimeout.timeoutMs) {
methodInvocationBlock()
}
methodType = TIMEOUT

return
}

when (exception) {
is ConcreteExecutionFailureException -> {
methodType = CRASH
writeWarningAboutCrash()
Expand All @@ -388,6 +394,10 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
return exceptionRequiresAssert || exceptionIsExplicit
}

private fun shouldTestPassWithTimeoutException(execution: UtExecution, exception: Throwable): Boolean {
return execution.result is UtTimeoutException || exception is TimeoutException
}

private fun writeWarningAboutTimeoutExceeding() {
+CgMultilineComment(
listOf(
Expand Down