Search code examples
base64yamlperformance-testingcontent-typetaurus

How to pass in Content-Type and base64 value as a user in Taurus?


I'm trying to assign a user value which is base64 characters and the Content-Type which is "application/x-www-form-urlencoded". In my postman Content-Type is under Headers and user under body. Therefore i structured my yaml script like below :

execution:
  - concurrency: 10
    ramp-up: 20S
    hold-for: 1m
    scenario: sample

scenarios:
  sample:
    requests:
      - url: 'https://www.mtn.com/umbraco/surface/loginsurface/authenticate'
        method: POST
        headers:
          Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp, application/x-www-form-urlencoded'
        Body:
          user: 'YWFkaWwuaaa2hhbkBzb3RpLdDpXZWxjb21lMTIzNA=='

However This isn't working when i'm running Taurus. Is the syntax wrong?


Solution

    1. According to Taurus documentation

      As you know, JSON is a subset of YAML

      so Taurus supports both JSON and YAML configuration files

    2. According to JSON specification

      All names etc. are case-sensitive. Conforming implementations therefore MUST treat all names as being case-sensitive such the names "bar" and "BAR" would be seen as two distinct entities.

    3. Looking further into Taurus documentation on YAML format:

      Dictionaries are collections of key: value mappings. All keys are case-sensitive.

      Therefore you just need to convert your Body to lowercase and everything should start working as expected (or at least result into following JMeter configuration)

      enter image description here

    Full YAML just in case:

    execution:
      - concurrency: 10
        ramp-up: 20S
        hold-for: 1m
        scenario: sample
    
    scenarios:
      sample:
        requests:
          - url: 'https://www.mtn.com/umbraco/surface/loginsurface/authenticate'
            method: POST
            headers:
              Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp, application/x-www-form-urlencoded'
            body:
              user: YWFkaWwuaaa2hhbkBzb3RpLdDpXZWxjb21lMTIzNA==
    

    You can always open JMeter GUI by running Taurus like:

    bzt test.yaml -gui
    

    or

    bzt -o modules.jmeter.gui=true test.yaml
    

    this way it will be easier to inspect the generated script.

    More information: