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

foreach feature if doing #494

Open
xx1906 opened this issue Nov 30, 2023 · 0 comments
Open

foreach feature if doing #494

xx1906 opened this issue Nov 30, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@xx1906
Copy link

xx1906 commented Nov 30, 2023

foreach and if section is ambiguous
i would like to use foreach like golang as

func foreach() {
    var list = []int{1,2,3,4}
    for _,num:=range list {
      if num % 2 == 0 {
      printX(num)
      }
    }
}

func printX(num int ) {
   println(num)
}

i try this with foreach and conditions but not work

name: "foreach runner......"
description: foreach example
long_description: foreach example
doc_link: http://127.0.0.1:18080/index/examples/network-checker/doc.html

title: "foreach testcase"
title_format: "[test] foreach"


steps:
  foreach_gen_data:
    foreach: '["1","1","1","1"]'
    conditions:
      - type: skip
        if:
          - value: "{{.iterator}}"
            operator: EQ
            expected: a
        then:
          this: PRUNE
      - type: check
        if:
          - value: "{{.iterator}}"
            operator: EQ
            expected: "1"
        then:
          bStep: YIELD_B
    action:
      type: echo
      configuration:
        output:
          foo: "foo-{{.iterator}}"

  bStep:
    description: impacted by concatItems b step
    dependencies: [ foreach_gen_data ]
    custom_states: [ YIELD_B ]
    action:
      type: echo
      configuration:
        output:
          "done"

thanks you for reading this issue, expected for resolution online!

@xx1906 xx1906 added the enhancement New feature or request label Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant