Overriding global variables is funky

I have the following test script:

if (GlobalVariable.rucniOdabirPacijenta){
WebUI.comment("--------A---------")
}
if (GlobalVariable.sendReport){
WebUI.comment("--------B---------")
}

Both of the above global variables are of boolean type and initially set to true and false, respectively.

  1. When run inside of a test suite from cmd line, without overriding the global variables, the output is

    2019-01-16 14:06:17.744 DEBUG testcase.premoscivanje globalnih - 1: if (rucniOdabirPacijenta)
    2019-01-16 14:06:17.745 DEBUG testcase.premoscivanje globalnih - 1: comment("--------A---------")
    2019-01-16 14:06:17.747 INFO c.k.k.c.keyword.builtin.CommentKeyword - --------A---------
    2019-01-16 14:06:17.747 DEBUG testcase.premoscivanje globalnih - 2: if (sendReport)

    This works as expected.

  2. The second run overrides the sendReport global variable: -g_sendReport=true is added to the console line command. The output is as follows:

    2019-01-16 14:07:10.200 DEBUG testcase.premoscivanje globalnih - 1: if (rucniOdabirPacijenta)
    2019-01-16 14:07:10.201 DEBUG testcase.premoscivanje globalnih - 1: comment("--------A---------")
    2019-01-16 14:07:10.202 INFO c.k.k.c.keyword.builtin.CommentKeyword - --------A---------
    2019-01-16 14:07:10.202 DEBUG testcase.premoscivanje globalnih - 2: if (sendReport)
    2019-01-16 14:07:10.203 DEBUG testcase.premoscivanje globalnih - 1: comment("--------B---------")
    2019-01-16 14:07:10.204 INFO c.k.k.c.keyword.builtin.CommentKeyword - --------B---------

    So, nothing strange here.

  3. The problem happens when I try to override the ‘rucniOdabirPacijenta’ variable with -g_rucniOdabirPacijenta=false. The output is:

    2019-01-16 14:10:00.397 DEBUG testcase.premoscivanje globalnih - 1: if (rucniOdabirPacijenta)
    2019-01-16 14:10:00.398 DEBUG testcase.premoscivanje globalnih - 1: comment("--------A---------")
    2019-01-16 14:10:00.400 INFO c.k.k.c.keyword.builtin.CommentKeyword - --------A---------
    2019-01-16 14:10:00.401 DEBUG testcase.premoscivanje globalnih - 2: if (sendReport)

So, GlobalVariable.rucniOdabirPacijenta wasn’t overriden.

Thank you for the detailed report. I cannot test it now but please try to print GlobalVariable.rucniOdabirPacijenta.getClass() and see the output.

It is java.lang.Boolean.

1 Like

I can confirm that it’s a bug.

Is this going to be looked at?

I can see this bug is present in 5.10.4 beta.

Hi @Mate_Mrse

This bug is logged and we will fix it in the upcoming releases.

2 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.