lundi 30 avril 2018

When use parameters in JSON POST data in Jmeter, another json entity is changed [duplicate]

This question already has an answer here:

i use JMeter for REST API testing and i have following request in my POST data section:

{
  "RootUrl": "http://localhost:4747",
  "Name": "E-commerce website",
  "ContentSite": true,
  "ContentLinks": [
    {
      "RegexPattern": "(log|sign)\\-?(out|off)"
    }
   ]
}

it is working regularly.

i'd like to use RootUrl as parameter so i created a "User Defined Variables". enter image description here

{
  "RootUrl": "${website_url}",
  "Name": "E-commerce website",
  "ContentSite": true,
  "ContentLinks": [
    {
      "RegexPattern": "(log|sign)\\-?(out|off)"
    }
   ]
}

When run it, it gives Request is NOT valid error. When i check it in Result tree, "RegexPattern" looks changed. There is one reverse slash in entity:

"RegexPattern": "(log|sign)-?(out|off)"

Do you have any idea why parameter does change another part?

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire