Skip to content

Commit

Permalink
Merge pull request #812 from EMResearch/2xx-issue
Browse files Browse the repository at this point in the history
wrong 2xx coverage info
  • Loading branch information
arcuri82 authored Sep 29, 2023
2 parents 04fb24f + 3bf6d50 commit 94b9cd5
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions core/src/main/kotlin/org/evomaster/core/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ class Main {

val solution = run(injector, controllerInfo)
val faults = solution.overall.potentialFoundFaults(idMapper)
val sampler : Sampler<*> = injector.getInstance(Key.get(object : TypeLiteral<Sampler<*>>(){}))

resetExternalServiceHandler(injector)

Expand Down Expand Up @@ -232,8 +233,18 @@ class Main {
when(config.problemType){
EMConfig.ProblemType.REST -> {
val k = data.find { it.header == Statistics.COVERED_2XX }!!.element.toInt()
val p = String.format("%.0f", (k.toDouble()/n) * 100 )
info("Successfully executed (HTTP code 2xx) $k endpoints out of $n ($p%)")
val t = if (sampler.getPreDefinedIndividuals().isNotEmpty()) {
/*
FIXME this is a temporary hack...
right now we might have 1 call to Schema that messes up this statistics
*/
n + 1
} else {
n
}
assert(k <= t)
val p = String.format("%.0f", (k.toDouble()/t) * 100 )
info("Successfully executed (HTTP code 2xx) $k endpoints out of $t ($p%)")
}
EMConfig.ProblemType.GRAPHQL ->{
val k = data.find { it.header == Statistics.GQL_NO_ERRORS }!!.element.toInt()
Expand Down

0 comments on commit 94b9cd5

Please sign in to comment.