EvoMaster icon indicating copy to clipboard operation
EvoMaster copied to clipboard

TestCaseWriter login cookie variable name

Open chrstphlbr opened this issue 1 year ago • 2 comments

Hi,

I was just trying to execute EM-generated REST test suites and ran into a compilation error when the login username contains characters that are not permissible as variable names.

As an example: if I have a login username that contains a hyphen (e.g., my-user) the org.evomaster.core.output.auth.CookieWriter (via org.evomaster.core.output.service.ApiTestCaseWriter) will generate the variable name cookies_my-user, which leads to a compilation error.

I assume that this line (https://github.com/EMResearch/EvoMaster/blob/0d6e01be737e8a7a434907eda651d29f1e2ffef3/core/src/main/kotlin/org/evomaster/core/output/auth/CookieWriter.kt#L20) is the place to fix it.

Let me know if you need any more infos.

Christoph

chrstphlbr avatar May 24 '24 08:05 chrstphlbr

hi,

thx for reporting this bug. indeed, as that name is provided by the user, it could contain invalid characters for a variable.

arcuri82 avatar May 24 '24 19:05 arcuri82

@chrstphlbr btw, the name is just a label. it does not have to match the actual username. so an easy workaround is to change the label name into my_user while the actual username used in the username field can stay as my-user

arcuri82 avatar May 30 '24 08:05 arcuri82