Taurus中如何传入token和Cookie

How to pass in the token and Cookie in Taurus

我正在尝试将令牌和 cookie 传递到我的脚本中。当我尝试使用 Taurus 运行 时,出现以下错误:

错误:配置错误:您必须为 运行 JMeter

指定 JMX 文件或请求列表

如何在脚本中传递令牌和 cookie?

这是脚本:


execution:
- concurrency: 100
  ramp-up: 1m
  hold-for: 2m
  scenario: sample

scenarios:
  sample :
    headers:
      Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp'
      Cookie: 'yourAuthCookie=48DEDbhjbhj08F4A918C1813ADDD9A9C603E4AE1F6648CEA7025CAA676839B72FCE955512C03B86348285307C53385D9C5746BBB8A8F00C6DCCB42A8DAA77DF474F2115B81EEFB3C340B5299A8EF147FC2B9DDE9D488DF96DE3672977D2573A5BCD02C1FDB0A535BBA37FAFF3E4666D'
      token: 'SHIvSkp1TQWswT0Z5WjMwM nvhjvjh1F2NHJWODRUZ3ZPVjcyUGhZQ2ljQ3cyNnFpTFlDaG9UbnRycEE5dDVsd1JmNkdubklISXJhWHgyZkJFS3FUSWtBalE9PQ=='
      requests:
        -'https://www.ericsson.com/umbraco/api/snip/GetUserSessions'
      method: GET

正确的语法是:

execution:
  - concurrency: 100
    ramp-up: 1m
    hold-for: 2m
    scenario: sample

scenarios:
  sample:
    requests:
      - url: 'https://www.ericsson.com/umbraco/api/snip/GetUserSessions'
        method: GET
        headers:
          Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp'
          Cookie: 'yourAuthCookie=48DEDbhjbhj08F4A918C1813ADDD9A9C603E4AE1F6648CEA7025CAA676839B72FCE955512C03B86348285307C53385D9C5746BBB8A8F00C6DCCB42A8DAA77DF474F2115B81EEFB3C340B5299A8EF147FC2B9DDE9D488DF96DE3672977D2573A5BCD02C1FDB0A535BBA37FAFF3E4666D'
          token: 'SHIvSkp1TQWswT0Z5WjMwM nvhjvjh1F2NHJWODRUZ3ZPVjcyUGhZQ2ljQ3cyNnFpTFlDaG9UbnRycEE5dDVsd1JmNkdubklISXJhWHgyZkJFS3FUSWtBalE9PQ=='

当你运行 bzt test.yaml -gui 它将导致以下 JMeter Test Plan

更多信息: