@@ -68,12 +68,32 @@ class Summarization(val sourceFile: File?, val invokeDescriptions: List<InvokeDe
6868            }
6969            return  listOf (UtExecutionCluster (UtClusterInfo (), testCase.executions))
7070        }
71+ 
7172        //  init
7273        val  sootToAST =  sootToAST(testCase)
7374        val  jimpleBody =  testCase.jimpleBody
7475        val  updatedExecutions =  mutableListOf<UtExecution >()
7576        val  clustersToReturn =  mutableListOf<UtExecutionCluster >()
7677
78+         //  TODO: Now it excludes tests generated by Fuzzer, handle it properly, related to the https://github.com/UnitTestBot/UTBotJava/issues/428
79+         val  executionsProducedByFuzzer =  getExecutionsWithEmptyPath(testCase)
80+ 
81+         if  (executionsProducedByFuzzer.isNotEmpty()) {
82+             executionsProducedByFuzzer.forEach {
83+                 logger.info {
84+                     " The path for test ${it.testMethodName}  " + 
85+                             " for method ${testCase.method.clazz.qualifiedName}  is empty and summaries could not be generated." 
86+                 }
87+             }
88+ 
89+             clustersToReturn.add(
90+                 UtExecutionCluster (
91+                     UtClusterInfo (),
92+                     executionsProducedByFuzzer
93+                 )
94+             )
95+         }
96+ 
7797        //  analyze
7898        if  (jimpleBody !=  null  &&  sootToAST !=  null ) {
7999            val  methodUnderTest =  jimpleBody.method
@@ -83,9 +103,9 @@ class Summarization(val sourceFile: File?, val invokeDescriptions: List<InvokeDe
83103            for  (clusterTraceTags in  clusteredTags) {
84104                val  clusterHeader =  clusterTraceTags.summary.takeIf  { GENERATE_CLUSTER_COMMENTS  }
85105                val  clusterContent =  if  (
86-                     GENERATE_CLUSTER_COMMENTS  &&  clusterTraceTags.isSuccessful // add only for successful executions
87-                     &&  numberOfSuccessfulClusters >  1  // there is more than one successful execution
88-                     &&  clusterTraceTags.traceTags.size >  1  // add if there is more than 1 execution
106+                     GENERATE_CLUSTER_COMMENTS  &&  clusterTraceTags.isSuccessful //   add only for successful executions
107+                     &&  numberOfSuccessfulClusters >  1  //   there is more than one successful execution
108+                     &&  clusterTraceTags.traceTags.size >  1  //   add if there is more than 1 execution
89109                ) {
90110                    SimpleClusterCommentBuilder (clusterTraceTags.commonStepsTraceTag, sootToAST)
91111                            .buildString(methodUnderTest)
@@ -113,20 +133,14 @@ class Summarization(val sourceFile: File?, val invokeDescriptions: List<InvokeDe
113133                        val  nameIndex =  namesCounter.getOrPut(name) { 0  }
114134                        namesCounter[name] =  nameIndex +  1 
115135                        updatedExecutions + =  traceTags.execution
116-                         if  (GENERATE_DISPLAY_NAMES 
117-                             //  todo extract these options into more suitable place (https://github.com/UnitTestBot/UTBotJava/issues/359)
118-                             //  do not rewrite display name if already set
119-                             &&  traceTags.execution.displayName.isNullOrBlank()) {
136+                         if  (GENERATE_DISPLAY_NAMES ) {
120137                            if  (! GENERATE_DISPLAYNAME_FROM_TO_STYLE ) {
121138                                traceTags.execution.displayName =  displayName
122139                            } else  {
123140                                traceTags.execution.displayName =  fromToName
124141                            }
125142                        }
126-                         if  (GENERATE_NAMES 
127-                             //  todo extract these options into more suitable place (https://github.com/UnitTestBot/UTBotJava/issues/359)
128-                             //  do not rewrite display name if already set
129-                             &&  traceTags.execution.testMethodName.isNullOrBlank()) {
143+                         if  (GENERATE_NAMES ) {
130144                            traceTags.execution.testMethodName =  name
131145                            if  (nameIndex !=  0 ) traceTags.execution.testMethodName + =  " _$nameIndex " 
132146                        }
@@ -150,6 +164,9 @@ class Summarization(val sourceFile: File?, val invokeDescriptions: List<InvokeDe
150164        return  listOf (UtExecutionCluster (UtClusterInfo (), testCase.executions))
151165    }
152166
167+     private  fun  getExecutionsWithEmptyPath (testCase :  UtTestCase ) = 
168+         testCase.executions.filter { it.path.isEmpty() }
169+ 
153170    /* 
154171    * asts of invokes also included 
155172    * */  
0 commit comments