Skip to content

When using loop, how to change description  #546

@t-kitamura-axel

Description

@t-kitamura-axel

I try changing description in loop.
But, I cannot change description.

  • curent log
Run 'test' on 'impoted yaml'.steps.normal
Run '{{ vars.register_session_desc }}' on 'impoted yaml'.steps.normal
.
.
.
Run 'test' on 'impoted yaml'.steps.normal
Run '{{ vars.register_session_desc }}' on 'impoted yaml'.steps.normal
.
.
.
  • root yaml

desc: desc change test
runners:
  sc:
    host:  xxxx
    keepSession: true
    localForward: '10443:xxxxx.execute-api.xxxxx.vpce.amazonaws.com:443'
    useAgent: false
  req:
    endpoint: https://127.0.0.1:10443/xxxx
    skipVerify: true
debug: true
vars:
  header: "json://header/header.json"
  vars_section:
    desc:
      - "xxxxx xxxxx (normal) 1"
      - "xxxxx xxxxx (normal) 2"
    req:
      - "json://../../json/req/200/normal1.json"
      - "json://../../json/req/200/normal2.json"
    res:
      - "json://../../json/res/200/normal1.json"
      - "json://../../json/res/200/normal2.json"
steps:
  step_name:
    desc: xxx xxxx
    loop:
      count: len(vars.vars_section.req)
    include:
      path: books/xxx_xxxx/yamls/200/normal.yaml
      vars:
        header:
          accept: "{{ vars.header.accept }}"
          content_type: "{{ vars.header.content_type }}"
          host: "{{ vars.header.host }}"
          x_api_key: "{{ vars.header.x_api_key }}"
        vars_section_desc: "{{ vars.vars_section.desc[i] }}"
        vars_section_req: "{{ vars.vars_section.req[i] }}"
        vars_section_res: "{{ vars.vars_section.res[i] }}"

  • imported yaml
desc: impoted yaml
steps:
  normal:
    desc:  "{{ vars.vars_section_desc }}"
    req:
      /xxxx/xxxx/xxx:
        post:
          headers:
            accept: "{{ vars.header.accept }}"
            Content-Type: "{{ vars.header.content_type }}"
            Host: "{{ vars.header.host }}"
            X-API-KEY: "{{ vars.header.x_api_key }}"
          body:
            application/json: "{{ vars.vars_section_req }}"
    test: steps.normal.res.status == 200
      && steps.normal.res.body contains vars.vars_section_res.res

I think description is important in data driven test, because we know what data are we using.
Threfore, though I specify vars_section_desc: "{{ vars.vars_section.desc[i] }}" in root yaml, I didn't have expected result.

  • expected log
Run 'test' on 'impoted yaml'.steps.normal
Run  'xxxxx xxxxx (normal) 1' on 'impoted yaml'.steps.normal
.
.
.
Run 'test' on 'impoted yaml'.steps.normal
Run 'xxxxx xxxxx (normal) 2' on 'impoted yaml'.steps.normal
.
.
.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions