Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
445 views
in Technique[技术] by (71.8m points)

javascript - 我们可以从邮递员的excel中读取excel数据以进行js测试吗?(Can we read data from excel in postman for js tests?)

Can we read data from excel in postman for js tests?(我们可以从邮递员的excel中读取excel数据以进行js测试吗?)

OR can we write a js script which read data from excel/csv/notepad.(或者我们可以编写一个js脚本来从excel / csv / notepad中读取数据。) I have wrote some js script which automate my API tests.(我已经写了一些js脚本来自动化我的API测试。) I am using Newman to execute them from command prompt.(我正在使用Newman从命令提示符处执行它们。) I am writing automated test in postman.(我正在用邮递员编写自动测试。) I want to import data from excel for my tests.(我想从Excel导入数据以进行测试。) 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.(我认为使用js尝试编写直接读取/与excel / csv / notepad之类的文件进行交互的代码。) Is it possible?(可能吗?) Any help would be appreciated(任何帮助,将不胜感激)   ask by Shubham Jain translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can if you export your excel to csv and the format is similar to this file .(如果将excel导出到csv,并且格式类似于此文件,则可以 。)

You can also do this with newman using -d <source>, --iteration-data <source> .(您也可以使用-d <source>, --iteration-data <source>newman一起执行此操作。) Specify a data source file (CSV) to be used for iteration as a path to a file or as a URL.(指定要用于迭代的数据源文件(CSV),作为文件路径或URL。) Working with data files .(处理数据文件 。) If you want to use Postman app, you can use the Collection Runner -(如果您想使用Postman应用,可以使用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.(使用收集运行器,您可以导入CSV或JSON文件,然后在HTTP请求和脚本中使用数据文件中的值。) 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.(要在Postman UI中使用它们,必须遵循与环境或全局变量相同的语法。) Having the same syntax helps you test individual requests inside Postman using dummy environment values.(具有相同的语法可帮助您使用虚拟环境值测试Postman内部的单个请求。) When you move to the Collection Runner you don't have to change anything.(当您移至Collection Runner时,您无需进行任何更改。) More on the blog here .(更多内容请点击这里 。)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...