星期五, 3月 29, 2019

selenese runner can't nesting while end loop

Consider this code snippet:
  • execute script | return 2; | i
  • while | ${i} > 0 |
    • execute script | return 3; | j
    • while | ${j} > 0 |
      • echo | i: ${i}, j: ${j} |
      • execute script | return ${j} - 1; | j
    • end | |
    • execute script | return ${i} - 1; | i
  • end | |
It works fine in Selenium IDE with output:
  • i: 2, j: 3
  • i: 2, j: 2
  • i: 2, j: 1
  • i: 1, j: 3
  • i: 1, j: 2
  • i: 1, j: 1
But selenese runner missing some output, just:
  • i: 2, j: 3
  • i: 2, j: 2
  • i: 2, j: 1
  • i: 1, j: 3
How can we avoid this inconsistent? this code snippet should be ok:
  • execute script | return 2; | i
  • do | |
    • execute script | return 3; | j
    • do | |
      • echo | i: ${i}, j: ${j} |
      • execute script | return ${j} - 1; | j
    • repeat if | ${j} > 0 |
    • execute script | return ${i} - 1; | i
  • repeat if | ${i} > 0 |
[2019/03/30]
This bug was fixed at version 3.22.0, see here.