Can we iterate values from excel to POST json request one by one in SOAPUI. If yes please share a piece of code - rest

Can we iterate values from excel to POST json request one by one in SOAPUI?
It should get the response for each and every request from iterated value.
Kindly share groovy script to achieve this.

No code is needed as such. You need to create a TestCase, in which you have:
DataSource TestStep
Rest Request TestStep
DataSource Loop TestStep
The DataSource should be set to point towards your Excel input file, and you should input the column names. Make sure your Excel file i saved in the rather ancient 97 format. (This may no longer be true, but for a long time, this has been the only type of Excel file that SoapUI was able to work with.)
Your Rest Request should naturally import and use the columns from your input file that are relevant.
Your DataSource Loop should just send the script back to your Rest Request.
This will make the script loop until it runs out of data in your input file.

Related

Jmeter: how to save both success and failure soap requests values into separate CSV files

I want to run the Jmeter for a soap service and save both success and failed request values into separate csv files. First of all would like to know if this is possible. I am using CSV input file for generating the request. I could see some posts here but I dont know how we can extract multiple specific values from the soap request upon the status of response. As I mentioned I want to do this for both success and failure responses.
Tried adding XPath2 Extractor and I could see debug sampler is printing values but not sure how to get them into sepaerate csv files. First of all is that doable ?
Update I just realized that my original question was wrong. Saving response wont help much to identify the failed records. My idea is to identify both failed and successful records. Need to do some business logic on failed records. Is there anyway I can do that? I would like to get all those fields from CSV file to both success and failed output files. Thanks in advance
If you want to save successful and not successful responses into separate files you can use Simple Data Writer:
For successful responses
For failures:
If the file has to be CSV and you need only variable values I can think of Flexible File Writer, it doesn't allow you to filter successful and failed responses, however you can add an appropriate column to CSV and filter it later on.
And finally you can just use Sample Variables property and variable values will be stored into JMeter's .jtl results file. It's in CSV format and contains the information regarding whether the request was successful or not and filtering it in Excel or equivalent will be quite easy.

REST API Pagination in Azure Data Factory

I have a project scenario to get all values from an endpoint URL. I am using ADF Pipeline but I'm having some issues with pagination.
To get the following values, I need to make requests with the PaginationCursor value in the current body response in the following request header.
I have read that ADF supports the following case, which would be mine.
Next request’s header = property value in current response body ADF - Pagination support
I don't know how to use the following attributes in order to use the paginationCursor value from the current response body in the header of the next request.
Attributes for pagination in ADF
I tried to reproduce above but not successful. Instead, if you want to do it without pagination, you can try this approach.
First create a web activity with any page URL of your API to get the total number of pages count.
In ForEach create an array for page numbers using the count from web activity as
#range(1,activity('Web1').output.total_pages)
Inside ForEach use the copy activity and give the source REST dataset parameter for the page number like ?page=#{item()}.
In the sink dataset also, create a dataset for each page with the dataset parameter value like APIdataset#{item()}.csv. This generates the sink dataset names like APIdataset1.csv, APIdataset2.csv,...
Now, you can copy from your REST API without pagination.
My repro for your reference:
Copy activity:
I could solve this problem with the following attributes.
Solution
In the Headers I had to put the name of the header of the next call. In my case the name is PaginationCursor and I got the value of this header from the actual body response called paginationCursor.

SharePoint REST API returns incomplete content of file during downloading

I work on application for fetching and downloading SharePoint data. For every folder in SharePoint I can get the list of all files inside given folder by using next SharePoint REST API endpoint:
/_api/web/GetFolderById('<folder_guid>')/Files
The expected size and guid is provided for every file so I can use them when I want to download the file. Then I use the next endpoint from SharePoint REST API in order to actually get file content:
/_api/web/GetFileById('<file_guid>')/$value
From time to time when I download the file I get less data than expected: size of downloaded data is just different from the value I obtain while getting the properties list of files. However when I try to get its content again it can be successfully downloaded (size of downloaded data is equal the expected value) or I can get another incomplete data.
I verified that the first endpoint (one used to get properties of all files in the folder) returns the correct file size. The problem is in the call of the second one.
I see that there is "transfer-encoding" header with "chunked" value in response. So when my http client performs chunked data download and if zero chunk is received at some point then we reached the end of the body by definition. So it looks like in some cases SharePoint either returns the incomplete data or zero chunks when they should not be sent.
What can be the reason of such strange behavior? Is it a know issue?
We actually also see this, strange behaviour, many files are just small aspx files, about 3-4kb and they are constantly smaller by 15% and more than appears in file propertis. We're also using REST API and this is really frustrating. All those strange bugs in Sharepoint Online are very annoying.
this is an interesting topic... are those files large? like over 1GB? It would seem that chunk file download is not supported way in SP Online. Better option is to user RPC. Please see this links for examples:
https://sharepoint.stackexchange.com/questions/184789/download-large-files-from-sharepoint-online
https://social.msdn.microsoft.com/Forums/office/en-US/03e55d41-1daf-46a5-b61d-2d80139123f4/download-large-files-using-rest?forum=sharepointdevelopment
https://piyushksingh.com/2016/08/15/download-large-files-from-sharepoint-online/
You could also check the MS Graph API if maybe will work better for this case
https://learn.microsoft.com/en-us/graph/api/driveitem-get-content?view=graph-rest-1.0&tabs=http
... I hope this will be of any help

How to compare XQuery output with databasein SOAP UI

I have written Xquery assertion in SOAP UI request its working fine. But i want to compare output of this with database. Can I add code to get the values from database in Expected panel of XQuery assertion of SOAP UI. If not is there any way where I can compare the xml response of a request with column values of a database
You can do it the following way:
Call a service with a Soap request
Make a property transfer from the service response to a test case variable, see the SoapUI docs for more information. You can use XPath or XQuery. See the picture bellow.
Make a JDBC request to your database and compare the results with the data stored in your test case variable.
This way is intuitive and effective for simple comparissons, for complex tests I would choose Groovy scripting.

How to organise REST endpoints for a drop-wizard application?

I am new to dropwizard and REST.
My sample application is a order viewing system. Currently, I am working on a functionality where the UI page consists of set of order search criteria, search button, and link to download the search result as CSV. Download link is displayed only after the successful search. The application has to write the search result to a CSV file and the file location returned will be used to download the file.
I need help in organising the endpoints for this.
Initially, I thought of an end point GET - /orders - text/JSON with search criteria passed in as query params. But, since I will be actually creating the CSV for every GET request, I am wondering if I am violating the HATEOAS rest constraint for the GET (resource should not be created). Or, since the actual resource is Order and not the CSV, is it ok to have the endpoint as GET?
Or, do I need multiple endpoints adhering to the REST constraints and conventions interacting with each other to produce the required result?
Like:
1.POST - /orders/csv - text/json (file name) : creates the CSV file of orders and returns the JSON of file name.
2.GET /orders/csv/<file_name>: gets the file to download.
Many thanks for your help.