When working with XML responses I dont have the option to Copy as Response body dynamic value?
Is this facility only available with JSON?
UPDATE-1:
Can't seem to get it working
I can add the Request object but the Key Path (dotted xpath) to the desired data is not giving the expected results. I am using "plan.link"
So the xml is like this
<plan>
<id>7286</id>
<piuid>1</piuid>
<title>Bollard Positions</title>
<link>http://<my-server-name>/port/1/plan/7286.gif</link>
</plan>
And I want to pick the url from the link element (plan.link)
But Paw is not reading right and changes the request to
GET / HTTP/1.1
Host: echo.paw.cloud
Connection: close
User-Agent: Paw/3.1.3 (Macintosh; OS X/10.11.6) GCDHTTPRequest
I'm doing something wrong but not sure what.
Any suggestions?
That's true, sadly you cannot just right-click and pick Copy as Response Body Dynamic Value for XML responses (only works for JSON and Form URL-Encoded).
Though, you can manually set a dynamic value to point to this field.
Right-click on a field where you want to insert this reference, and choose Response > Response Parsed Body
Enter the Key Path to the node you want to select, and end it with the text key to access the string's value.
Should be a working reference. You can have the preview below.
Related
Trying to pull data from private page, I am receiving a JSON response and would like to check whether everything is okay. The status of the request is fine (200), but if I use
Debug.Print (xmlhttp.responseText)
I see unknown ( for me ) format, it looks like:
? ?s???+]?f? ?n??????w????#??E????LJ??n???
Do you know how to convert it to standard JSON code ?
If I use the same headers in Javascript, then everything is okay, so I would like to know why excel converting the response to such strange form
Thanks in advance.
I am trying to create 10 users at the same time in Jmeter, using REST APIs.
Test Data i.e. input is taken from CSV files (The details of users like user name, last name , mobile)
For this I have added one thread group,User Defined Variable,HTTP Header Manager, HTTP Request Sampler (which perform successful login into web application), JSON PATH EXTRACTOR ( to extract auth token, which will be used while adding user)
To Add User, I have used one "Loop Controller" - "HTTP Request Sampler" - HTTP Header Manager, CSV Data Set Config.
And to track result, View Results Tree and Aggregate Report.
Please tell me what would be the syntax of parameters which I am passing in "Body Data" section of HTTP Request sampler, so that it can read values from csv files.
Below is the syntax I am using now to add single user.
{
"phoneNo": "9998885551",
"lastName": "john25",
"email": "azp25#gmail.com",
"firstName": "ricky25",
"mobileNo": "9820420420"
}
If your CSV file looks like:
9998885551,john25,azp25#gmail.com,ricky25,9820420420
9998885552,john26,azp26#gmail.com,ricky26,9820420421
....
Configuration should be the following:
Filename: full path to your source .csv file
Variable Names: phone,lastname,email,firstname,mobile
Delimiter: ,
Populate other values according to your test scenario i.e. whether you want test to stop on .csv file end or re-spin or whatever.
And your HTTP Request should look like:
The main point is that variables defined in the CSV Data Set Config need to match the ones in the HTTP Request.
See Using CSV DATA SET CONFIG guide for detailed instructions.
I would also recommend adding the following entry to your HTTP Header Manager:
Name: Content-Type
Value: application/json
elsewise your request will be treated like plain text and may fail.
Also don't forget to disable View Results Tree listener for actual load test run as it consumes a lot of resources and may lead to out-of-memory errors on JMeter side.
Also,if your formparam\ Body data contains multiple parameters like this:
UserName=abc
password=abc123,
Instead of created two columns for userName and password, it can be given in single column like this:
UserName=abc&password=abc123
This way you can loop through multiple\different URL's which takes different numbers of bodydata
E.g.: If URL1 takes only username as body data and URL2 takes Username & password as body data the above will be an easy solution.
I'm using YQL to fetch a bunch of pages, some of which could be offline (obviously I don't know which ones). I'm using this query:
SELECT * FROM html WHERE url IN ("http://www.whooma.net", "http://www.dfdsfsdgsfagdffgd.com", "http://www.cnn.com")
Where the first and the last one are actual sites, while the second one obviously doesn't exist. Two results are actually returned but the url from where they were loaded doesn't appear anywhere. So what would be the way to find out which html page belongs to which url, if not every page in the query is loaded?
Unfortunately, I do not know a way where you can get a key=>value pair in the response where key being the url and value being the html response. But, you can try the following query and see if it meets your use case:
select * from yql.query.multi where queries="select * from html where url='http://www.whooma.net';select * from feed where url='http://www.dfdsfsdgsfagdffgd.com';select * from html where url='http://www.cnn.com'"
Try it here. What you can do is before firing the query, maintain the order in an array of the url in the queries like so
['http://www.whooma.net','http://www.dfdsfsdgsfagdffgd.com','http://www.cnn.com']. We can call this array A When you iterate over the response from the YQL query, the url which does not exists will return a null. A sample response from the above query:
<results>
<results>
// Response from select * from html where url='http://www.whooma.net'. This should be some html
</results>
<results>
// Response from select * from feed where url='http://www.dfdsfsdgsfagdffgd.com'. This should be null.
</results>
<results>
// select * from html where url='http://www.cnn.com'. This should also be some html
</results>
</results>
So in conclusion, you can iterate over array A and response from YQL. The first element of array A should correspond to the first results(inner results) element of that YQL response. i.e You are creating a hashmap from two arrays. I know the answer is long but I think it was needed. Let me know if there is any confusion.
You can figure out which urls aren't loading by using the YQL diagnostics flag. The diagnostics flag will cause the response to include a diagnostics property with a url array that indicates whether the corresponding servers were found. Presumably, once you eliminate the urls that didn't load, the result pages will match up with the remaining urls.
I am trying to do a HTTP GET of an URL with multiple query strings using a browser. Following is my observation
http://192.168.0.1:80/mycontent/?key1=value1 //Works.
http://192.168.0.1:80/mycontent/?key1=value1&key2=value2 //Doesen't work.
The question here :
I am finding a hard time to figure out what's the right format to
append the query string
Should we use & when we put in the browser?
Is there a way that I can find the validity (availability in the server) of the query string I enter in the URL.
You should use & when writing the link into HTML, for example:
Example
But not when entering the URL into the address bar, or using it directly in JavaScript (for example).
Your format is correct, so you should be able to pick up both key1 and key2 in the request collection. Depending on the language you are using on the server, the technique for this differs.
I want something like this:
link
GET and 2x POST in hyperlink. How can I do that? Nothing wants to work
I have a GET array in PHP and I want to generate a link which leads to the correct url to give me those GET variables.
You can't have 2 GET variables with the same name. You can arrange them into an array as follows:
link
Just for clarification, this is still a GET request, links cannot normally produce a POST request, nor you should try to achieve that not-normally.
EDIT: To answer OP's calrification.
If you have a $_GET array, and you want to generate a link to get you there, you can use http_build_query()
I don't think you understand what GET and POST means in the HTTP world. Any items you put on a query string of a URL are GET parameters, you can't have 2 with the same name. POST parameters are sent as a part of the request, not as a query string on the URL.
GET and POST are http operations.
Sending values by using the ? as a separator in the url is different but related. eg:
foo.com/page.php?val1=1&val2=2
The values are called Query String values.
For GET operations, values are sent as a query string values. For POST operations, the values are sent in the body of the POST request. This is why POST must be used when a lot of data is being sent to the server. (Query strings have a maximum length, HTTP requests do not.)
You can do a POST operation to a url that includes query string values. This is more common with Ajax requests but can be done in a form as well. Just set the action url to something like index.php?val1=1&val2=2 the form's (additional) values will be sent as the http body. Remember to set method="post" in the form.
Note that you will need to create the query string yourself in this example, including escaping it properly.
Repeating value names in the query string values
Usually this causes both values to be sent, but the server overwrites the variable and ends up only presenting the last one to the client software.
So if you use a url such as
<a href="http://localhost/index.php?get=abc&post=cde&post=efg">
// It will be decoded by php and most server-side frameworks as
set get to abc
set post to cde
set post to efg
Result: 2 variables, get and post
There is nothing in the HTTP standard that says you can't send two query string params with the same name. However, you won't be able to use $_GET to retrieve these values; $_GET will pick up the last one. Instead, you'll have to manually parse $_SERVER['QUERY_STRING']. It's not that hard and I've done it a number of times when PHP has to handle a URL pattern generated by a third-party tool. If you're feeling really fancy you can have your query-string parse routine generate a $_GET member as an array if more than one instance of that member is encountered.