How can I update a global variable from within a test in Venom

34 Views Asked by At

I have a variable defined at the test suite level with default value set to false , and I would like to update it to true in one of the test cases.

I have used the 'venom: run: var: -variable=new_value' suggested by Microsoft copilot, and expected the global variable to be updated with the new value, but it doesn't work. The code still print out the variable is 'false' after I tried to update it.

name: code_test
vars:
  marketclosed: false

testcases:
  - name: test1
    .......
  - name: test2
    steps:
    - type: exec
      info: '{{.marketclosed}}'
      venom:
        run:
          var:
            - marketclosed=true
      script: echo '{{.marketclosed}}'
0

There are 0 best solutions below