1
  1. Hi, I declared variables in config and iam using in below test case. the variables are not passing. iam not able to figure out the actual issue.

    • config:
      • variable_binds: {'user_id': 'ravitej', 'pass': 'password', 'auth': 'plain'}
    • test:
      • name:"login success"
      • url: "/api/login"
      • method: "POST"
      • body: '{"username": "$user_id", "password": "$pass", "authtype": "$auth"}'
      • headers: {Content-Type: application/json}
      • expected_status: [200]
      • group: "User"
  2. In this below case: I'm running 1st test set and I'm getting some auth_token in response this auth_token is saved to auth_key to use in another test set, but this auth_key is not passing to the 2nd test set. it was passing an empty variable. I tried all possible ways wich are posted in Github still I am getting the same problem

    • test:

      • name: "Registration"
      • url: "/api/register"
      • method: "POST"
      • body: '{"device_id": "0080", "device_key": "imAck", "device_name": "teja", "device_description": "Added By Ravi", "project_tag": "MYSTQ-16", "attributes": "{}"}'
      • headers: {Content-Type: application/json}
      • expected_status: [200]
      • group: "Register"
      • extract_binds: - 'auth_key': {'jsonpath_mini': 'auth_token'}
    • test:

      • name: "Status"
      • url: "/api/status"
      • method: "POST"
      • body: '{"attributes": {"num_ports": "2", "model": "Phillips", "firmware_ver": "8.0.1", "ipaddress": "192.168.0.0", "rssi": "Not Available"}}'
      • headers: {Content-Type: application/json, auth_token: "$auth_key"}
      • expected_status: [200]
      • group: "Status"
Ravi Teja
  • 45
  • 1
  • 10
  • Hey Ravi Teja, Have you got the solution. I also have the same question. If you become able to resolve this, can you please help me? – Gautam Kumar Mar 07 '19 at 06:41

1 Answers1

0

need to use template headers, like

headers: {template: {Content-Type: application/json, auth_token: "$auth_key"}}

Example: headers: {template: {'$headername': '$headervalue', '$cache': '$cachevalue'}}

its worked fine now

Ravi Teja
  • 45
  • 1
  • 10