-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Phg/query params disamb #1127
base: master
Are you sure you want to change the base?
Phg/query params disamb #1127
Conversation
core/src/main/kotlin/org/evomaster/core/output/naming/RestActionTestCaseNamingStrategy.kt
Outdated
Show resolved
Hide resolved
* The filter call ensures that we are only performing this disambiguation when there's only one individual that | ||
* differs and the list of query params is not empty. | ||
*/ | ||
private fun checkForQueryParams(duplicatedIndividuals: MutableSet<EvaluatedIndividual<*>>): Map<EvaluatedIndividual<*>, String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess could be specified <RestIndividual
instead of <*>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried doing so, the Kotlin type system didn't like it much
.filter { it.value.size == 1 && it.key.isNotEmpty()} | ||
.mapNotNull { entry -> | ||
val eInd = entry.value[0] | ||
duplicatedIndividuals.remove(eInd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this? this is a side effect on the input list. quite confusing, considering that the name of the function is check
. also, this is the same datastructure used on line 118 at the beginning of stream operations (althugh these ones are eagerly evaluated), which complicates the understanding of the function. this needs refactoring/simplification
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as rule of thumb, side effects on inputs data structures should be avoided, unless explicitely clarified in the method name (somehow)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just pushed a draft on a possible solution. It transfers the responsibility of removing the solved duplicates to a specific function.
The downside is the duplicate removal happens twice:
- in the
resolveAmbiguities
function where the local working copy has the resolved duplicates removed - in the outer loop which triggers the resolution in NumberedTestCaseNamingStrategy.
However, this downside could be an advantage if we decide that all ambiguity solvers should be executed for resolution. It could even be tested for the experimentation: "do you like this naming where it only solves by one particular parameter or do you want the whole enchilada?".
Let me know what you think. Once we decide on this I'll also extract the groupBy
sections of the solvers to more clearly named methods
duplicatedIndividuals: MutableSet
, either no more disambiguation takes place (no individuals are removed from the set) or eventually all individuals are disambigauted (the set size is now 0 and the next iteration will have the same size)