Highlighted
Trusted Contributor.
Trusted Contributor.
813 views

How to automate file Upload content recorded in json format in body

Hi

I have to check the performance of Excell File upload in my application. The application is developed in .Net.

When the file is uploaded it is being converted into json format at UI level and then the data is getting uploaded into the application.

So when the scenario is recorded the content in the Excell file is showing in body. The file name is not showing anywhere in the log as the content is converted into Json format at UI level.  I have tried by adding  multipart/form data and file path but no success.  I also tried the  captured the requests using Fiddler but the same requests are recorded.

When discussed with dev team they said they have written a code in angular js /java script and converting the data in the file into json format and then saving it into the application.

Please help me how to resolve the issue.

Tags (1)
0 Likes
7 Replies
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: How to automate file Upload content recorded in json format in body

Can anyone please advice me how to solve this issue

0 Likes
Highlighted
Super Contributor.. Super Contributor..
Super Contributor..

Re: How to automate file Upload content recorded in json format in body

Hello,

For example check here:
https://community.saas.hpe.com/t5/Performance-Center-Practitioners/File-upload/td-p/635851

You can try like this:

web_custom_request("Import",
  "URL=http://www.neoint.ai/TestNewAPI/api/DefinitionData/Import/?isDefinition=false",
  "Method=POST",
  "TargetFrame=",
  "Resource=0",
  "RecContentType=text/html", 
  "Referer=http://www.neoint.ai/TestNewWeb/",
  "Snapshot=t17.inf",
  "Mode=HTML",
  "EncType=multipart/form-data",
  "Body=c:\\full_path\\fileName",
  LAST);

0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: How to automate file Upload content recorded in json format in body

Hi Skumar1

I have executed the script by giving file path and it is throwing me Unsupported Media type error. Please find the underlined text in the screenshot.

As said earlier, the data in the file is being converted in Json format at UI level and then it is being loaded into the application, so the file name is not captured in the log.

So inorder to check upload functionality for multiple records, i have to convert the data into json format and store it in "Body" and execute the script.

Can anyone please advise me how to resolve this.

0 Likes
Highlighted
Super Contributor.. Super Contributor..
Super Contributor..

Re: How to automate file Upload content recorded in json format in body

0 Likes
Highlighted
Member..
Member..

Re: How to automate file Upload content recorded in json format in body

Hi KVS Kumar,

Did you get a solution for the issue? If yes could you please share it as I am facing the same issue.

0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: How to automate file Upload content recorded in json format in body

If java script is responsable for document conversion to json, you might consider to run this java script code yourself with help of web_jr_run().

Signature:
Reward community members who take time to respond and help.
0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: How to automate file Upload content recorded in json format in body

Hi Punithraju

First i converted json to xml format and then used string functions (strcp, strcat) and looped as many times the records exists in the excel file. With this iam able to upload multiple records in a single excel file, but not mulitple excel files at a time.

So, with truclient protocol, i acheived uploading multiple excel files.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.