[英]playwright cucumber json report need to generate with different names based on package.json execution scripts [ need diff report for each execution]
I am using playwright cucumber report.json我正在使用剧作家 cucumber 报告。json
This is my cucumber.js这是我的 cucumber.js
My package.json我的 package.json
"test:sit1rcb": "NODE_ENV=sit1 NODE_TLS_REJECT_UNAUTHORIZED=0 cucumber-js -t @RCBSIT features/RCB/*.feature",
"test:sit3rcb": "NODE_ENV=sit3 NODE_TLS_REJECT_UNAUTHORIZED=0 cucumber-js -t @RCBSIT features/RCB/*.feature",
"test:sit3csk": "NODE_ENV=sit3 NODE_TLS_REJECT_UNAUTHORIZED=0 cucumber-js -t @CSKSIT features/CSK/*.feature",
"test:sit3kkr": "NODE_ENV=sit3 NODE_TLS_REJECT_UNAUTHORIZED=0 cucumber-js -t @KKRSIT features/KKR/*.feature"
each script should generate a different report based on names ( RCB, CSK, KKR) say like CSK_report.json, RCB_report.json...每个脚本应根据名称(RCB、CSK、KKR)生成不同的报告,例如 CSK_report.json、RCB_report.json...
my report path我的报告路径
When we execute this in windows server pipleline report is created and placed in a single location with the same file name.当我们在 windows 中执行此操作时,将创建服务器管道报告并将其放置在具有相同文件名的单个位置。 This means that whenever the test scripts are executed in same time for RCB, CSK, KKR in each(SIT1, SIT2) environment, the output will be overwritten and only the last executed test case result will be available for consumption
这意味着,每当在每个(SIT1,SIT2)环境中同时执行 RCB、CSK、KKR 的测试脚本时,output 将被覆盖,只有最后执行的测试用例结果可供使用
Please help me on following请帮助我关注
I am expecting to see我期待看到
CSK_report_SIT3.json for npm run test:sit3csk
RCB_report_SIT3.json for npm run test:sit3rcb
please help me on this.请帮助我。
You can pass report file name from the test script of package.json file.您可以从 package.json 文件的测试脚本中传递报告文件名。
Create multiple const's in cucumber.js file for different names like CSK, KKR and RCB because you be will running different features files.在 cucumber.js 文件中为 CSK、KKR 和 RCB 等不同名称创建多个 const,因为您将运行不同的功能文件。 Pass the REPORT_FILE_NAME from the package.json script, this will be passed to cucumber.js file and create report file accordingly.
从 package.json 脚本传递 REPORT_FILE_NAME,这将传递给 cucumber.js 文件并相应地创建报告文件。 Also, will create unique file name and won't override.
此外,将创建唯一的文件名并且不会覆盖。
Check below sample code.检查下面的示例代码。
cucumber.js cucumber.js
const csk_test= `
--require config/config.js
--require setup/assertions.js
--require setup/hooks.js
--require tests/sb/base-setup/baseSetup.js
--require tests/sb/step-definitions/features/csk/**/*.js
--format json:./reports/${process.env.REPORT_FILE_NAME}.json
--format summary --format @cucumber/pretty-formatter
--no-strict
--tags "@CSK"
--publish-quiet"
},
`;
const rcb_test= `
--require config/config.js
--require setup/assertions.js
--require setup/hooks.js
--require tests/sb/base-setup/baseSetup.js
--require tests/sb/step-definitions/features/rcb/**/*.js
--format json:./reports/${process.env.REPORT_FILE_NAME}.json
--format summary --format @cucumber/pretty-formatter
--no-strict
--tags "@RCB"
--publish-quiet"
},
`;
package.json package.json
"test:sb:csk": "cross-env BROWSER='' HEADLESS=false LANGUAGE=english REPORT_FILE_NAME=CSK_Test_Report APP_LOAD_TIMEOUT=50000 --retry 3 cucumber-js --parallel 2 -p csk_test",
"test:sb:rcb": "cross-env BROWSER='' HEADLESS=false LANGUAGE=english REPORT_FILE_NAME=RCB_Test_Report APP_LOAD_TIMEOUT=50000 --retry 3 cucumber-js --parallel 2 -p rcb_test",
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.