@@ -105,7 +105,11 @@ open class CgTestClassConstructor(val context: CgContext) :
105
105
106
106
val currentTestClassDataProviderMethods = currentTestClassContext.cgDataProviderMethods
107
107
if (currentTestClassDataProviderMethods.isNotEmpty()) {
108
- staticDeclarationRegions + = CgStaticsRegion (" Data providers" , currentTestClassDataProviderMethods)
108
+ staticDeclarationRegions + =
109
+ CgStaticsRegion (
110
+ " Data provider methods for parametrized tests" ,
111
+ currentTestClassDataProviderMethods,
112
+ )
109
113
}
110
114
111
115
if (currentTestClass == outerMostTestClass) {
@@ -223,34 +227,47 @@ open class CgTestClassConstructor(val context: CgContext) :
223
227
}
224
228
225
229
regions + = CgSimpleRegion (
226
- " Tests for method ${methodUnderTest.humanReadableName} that cannot be presented as parameterized" ,
227
- collectAdditionalTestsForParameterizedMode(testSet),
230
+ " SYMBOLIC EXECUTION: additional tests for symbolic executions for method ${methodUnderTest.humanReadableName} " ,
231
+ collectAdditionalSymbolicTestsForParametrizedMode(testSet),
232
+ )
233
+
234
+ regions + = CgSimpleRegion (
235
+ " FUZZER: Tests for method ${methodUnderTest.humanReadableName} " ,
236
+ collectFuzzerTestsForParameterizedMode(testSet),
228
237
)
229
238
}
230
239
231
- private fun collectAdditionalTestsForParameterizedMode (testSet : CgMethodTestSet ): List <CgTestMethod > {
232
- val (methodUnderTest, _, _, _) = testSet
233
- val testCaseTestMethods = mutableListOf<CgTestMethod >()
240
+ /* *
241
+ * Collects standard tests for fuzzer executions in parametrized mode.
242
+ * This is a requirement from [https://github.com/UnitTestBot/UTBotJava/issues/1137].
243
+ */
244
+ private fun collectFuzzerTestsForParameterizedMode (testSet : CgMethodTestSet ): List <CgTestMethod > {
245
+ val testMethods = mutableListOf<CgTestMethod >()
234
246
235
- // We cannot track mocking in fuzzed executions,
236
- // so we generate standard tests for each [UtFuzzedExecution].
237
- // [https://github.com/UnitTestBot/UTBotJava/issues/1137]
238
247
testSet.executions
239
248
.filterIsInstance<UtFuzzedExecution >()
240
249
.forEach { execution ->
241
- testCaseTestMethods + = methodConstructor.createTestMethod(methodUnderTest , execution)
250
+ testMethods + = methodConstructor.createTestMethod(testSet.executableId , execution)
242
251
}
243
252
244
- // Also, we generate standard tests for symbolic executions with force mocking.
245
- // [https://github.com/UnitTestBot/UTBotJava/issues/1231]
253
+ return testMethods
254
+ }
255
+
256
+ /* *
257
+ * Collects standard tests for symbolic executions that can't be included into parametrized tests.
258
+ * This is a requirement from [https://github.com/UnitTestBot/UTBotJava/issues/1231].
259
+ */
260
+ private fun collectAdditionalSymbolicTestsForParametrizedMode (testSet : CgMethodTestSet ): List <CgTestMethod > {
261
+ val testMethods = mutableListOf<CgTestMethod >()
262
+
246
263
testSet.executions
247
264
.filterIsInstance<UtSymbolicExecution >()
248
265
.filter { it.containsMocking }
249
266
.forEach { execution ->
250
- testCaseTestMethods + = methodConstructor.createTestMethod(methodUnderTest , execution)
267
+ testMethods + = methodConstructor.createTestMethod(testSet.executableId , execution)
251
268
}
252
269
253
- return testCaseTestMethods
270
+ return testMethods
254
271
}
255
272
256
273
/* *
0 commit comments