Skip to content

Commit 32deee9

Browse files
maxTestsPerMethod=1 is exceeded #1297 (#1309)
1 parent 8734d59 commit 32deee9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

utbot-framework-api/src/main/kotlin/org/utbot/framework/UtSettings.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,9 @@ object UtSettings : AbstractSettings(
385385
var useSandbox by getBooleanProperty(true)
386386

387387
/**
388-
* Limit for number of generated tests per method
388+
* Limit for number of generated tests per method (in each region)
389389
*/
390-
var maxTestsPerMethod by getIntProperty(50)
390+
var maxTestsPerMethodInRegion by getIntProperty(50)
391391

392392
/**
393393
* Max file length for generated test file

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgTestClassConstructor.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ internal class CgTestClassConstructor(val context: CgContext) :
179179
for ((clusterSummary, executionIndices) in clustersInfo) {
180180
val currentTestCaseTestMethods = mutableListOf<CgTestMethod>()
181181
emptyLineIfNeeded()
182-
val (checkedRange, needLimitExceedingComments) = if (executionIndices.last - executionIndices.first > UtSettings.maxTestsPerMethod) {
183-
IntRange(executionIndices.first, executionIndices.first + (UtSettings.maxTestsPerMethod - 1).coerceAtLeast(0)) to true
182+
val (checkedRange, needLimitExceedingComments) = if (executionIndices.last - executionIndices.first >= UtSettings.maxTestsPerMethodInRegion) {
183+
IntRange(executionIndices.first, executionIndices.first + (UtSettings.maxTestsPerMethodInRegion - 1).coerceAtLeast(0)) to true
184184
} else {
185185
executionIndices to false
186186
}
@@ -189,7 +189,7 @@ internal class CgTestClassConstructor(val context: CgContext) :
189189
currentTestCaseTestMethods += methodConstructor.createTestMethod(methodUnderTest, testSet.executions[i])
190190
}
191191

192-
val comments = listOf("Actual number of generated tests (${executionIndices.last - executionIndices.first}) exceeds per-method limit (${UtSettings.maxTestsPerMethod})",
192+
val comments = listOf("Actual number of generated tests (${executionIndices.last - executionIndices.first}) exceeds per-method limit (${UtSettings.maxTestsPerMethodInRegion})",
193193
"The limit can be configured in '{HOME_DIR}/.utbot/settings.properties' with 'maxTestsPerMethod' property")
194194

195195
val clusterHeader = clusterSummary?.header

0 commit comments

Comments
 (0)