Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript mocha的Puppeter中是否有类似于TestNG中的dataProvider的功能?_Javascript_Node.js_Automation_Puppeteer_Browser Automation - Fatal编程技术网

Javascript mocha的Puppeter中是否有类似于TestNG中的dataProvider的功能?

Javascript mocha的Puppeter中是否有类似于TestNG中的dataProvider的功能?,javascript,node.js,automation,puppeteer,browser-automation,Javascript,Node.js,Automation,Puppeteer,Browser Automation,我在Puppeter中寻找类似的功能,mocha作为TestNG测试框架中的数据提供者。有谁能建议如何在《木偶戏》中做到这一点。 提前感谢。在摩卡咖啡中没有内置的方法。但您可以使用简单的forEach方法轻松实现它 或者使用图书馆 顺便说一句,你可以很容易地做到 const SITES = ['https://github.com', 'https://google.com']; SUITES.forEach(expected => { describe('Suites:',

我在Puppeter中寻找类似的功能,mocha作为TestNG测试框架中的数据提供者。有谁能建议如何在《木偶戏》中做到这一点。
提前感谢。

在摩卡咖啡中没有内置的方法。但您可以使用简单的forEach方法轻松实现它

或者使用图书馆

顺便说一句,你可以很容易地做到

 const SITES = ['https://github.com', 'https://google.com'];

 SUITES.forEach(expected => {
   describe('Suites:', () => {
     it(`go to the ${expected} url`, => async () {
       await page.goto(expected);
     });
   });
 });