Search code examples
cookiesyamltokenperformance-testingtaurus

How to pass in the token and Cookie in Taurus


I'm trying to pass in the token and the cookie to my script. When i try to run it with Taurus i get the below error:

ERROR : Config Error: You must specify either a JMX file or list of requests to run JMeter

How do i pass token and cookie in my script?

Here is the script :


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


Solution

  • The correct syntax would be:

    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=='
    

    When you run bzt test.yaml -gui it will result into the following JMeter Test Plan

    enter image description here

    More information: