简体   繁体   中英

Can we read data from excel in postman for js tests?

Can we read data from excel in postman for js tests? OR can we write a js script which read data from excel/csv/notepad.

I have wrote some js script which automate my API tests. I am using Newman to execute them from command prompt.

I am writing automated test in postman. I want to import data from excel for my tests. Is it possible? There is any plug-in or anything present which can help me to achieve same

I have a thought that using js I try to write a code which directly read/interacts file like excel/csv/notepad. Is it possible?

Any help would be appreciated

You can if you export your excel to csv and the format is similar tothis file .

You can also do this with newman using -d <source>, --iteration-data <source> .

Specify a data source file (CSV) to be used for iteration as a path to a file or as a URL. Working with data files .

If you want to use Postman app, you can use the Collection Runner -

The Collection Runner let's you import a CSV or a JSON file and then use the values from the data file inside HTTP requests and scripts. We call these variables data variables. To use them inside the Postman UI, you have to follow the same syntax as environment or global variables. Having the same syntax helps you test individual requests inside Postman using dummy environment values. When you move to the Collection Runner you don't have to change anything.

More on the blog here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM