Skip to content
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

Skip a step in range/loop doesn't work #651

Open
aabouzaid opened this issue Apr 7, 2023 · 1 comment
Open

Skip a step in range/loop doesn't work #651

aabouzaid opened this issue Apr 7, 2023 · 1 comment

Comments

@aabouzaid
Copy link

Hi 👋

Thanks for this nice test suite, it's pretty useful. I use Venom in Camunda Platform Helm charts integration tests.

Use case:
I want to control the loop steps conditionally in case some services are not available for testing.
So some of the loop items work, and some are skipped.

The problem:
It looks like the loop vars are not accessible in skip part.

Example:

testcases:
- name: TEST
  steps:
  - name: "{{ .value.component }}"
    type: http
    range:
    - component: A
      url: http://service-a/health
      skip: 1
    - component: B
      url: http://service-b/health
      skip: 1
    - component: C
      url: http://service-c/health
      skip: 0
    method: GET
    url: "{{ .value.url }}"
    retry: 3
    delay: 10
    skip:
    - "{{ .value.skip }} ShouldNotEqual 1"
    assertions:
    - result.statuscode ShouldEqual 200

I get the following:

• A (range=0) FAIL
 assertion not supported
• B (range=1) FAIL
 assertion not supported
• C (range=2) FAIL
 assertion not supported

The same behaviour would be if I used {{ .index }}, the loop vars are not accessible.

Info:

  • Version venom: v1.1.0
@fokion
Copy link
Contributor

fokion commented Jun 19, 2023

One of the issues is that you cannot have the assertion wrapped in a string - "{{ .value.skip }} ShouldNotEqual 1" you need to unwrap it. Now having this will make venom fail as it wont be able to parse the file - {{ .value.skip }} ShouldNotEqual 1 so you can convert it to - value.skip ShouldNotEqual 1 . Will try this test case with the a draft pr that I have here #685

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants