简体   繁体   English

Flutter 集成测试的记者

[英]Reporters for Flutter integration testing

I am looking for examples of integrations among Flutter Integration library and test management tools like TestRail or Xray.我正在寻找 Flutter 集成库和测试管理工具(如 TestRail 或 Xray)之间的集成示例。 For Cypress and other browser automation tools I can find plenty of solutions but for Flutter integration basically nothing.对于 Cypress 和其他浏览器自动化工具,我可以找到很多解决方案,但对于 Flutter 集成基本上没有。

For Xray, there's no tutorial yet.对于 Xray,还没有教程。 However, it should be fairly simple.但是,它应该相当简单。

Run your tests using flutter test and pass the --machine argument to generate a JSON report.使用flutter test运行测试并传递--machine参数以生成 JSON 报告。 Use the junitreport package to generate a JUnit XML report.使用junitreport 包生成 JUnit XML 报告。 Then you can add it to your command as such:然后你可以将它添加到你的命令中:

flutter test --machine | tojunit -o junit.xml

If you redirect this to a file, then you have the report that you can submit to Xray for example.如果您将其重定向到文件,那么您就有了可以提交给 Xray 的报告。 For Xray server/datacenter, you need to call the REST API endpoint , something like:对于 Xray 服务器/数据中心,您需要调用REST API 端点,例如:

curl -H "Content-Type: multipart/form-data" -u username:password -F "file=@junit.xml" http://yourserver/rest/raven/1.0/import/execution/junit?projectKey=JIRAPROJECTKEY

For Xray on Jira Cloud, the syntax is slightly different.对于Jira Cloud 上的 Xray,语法略有不同。 You have to make an authentication request first, and then do another submiting the JUnit XML report.您必须先发出身份验证请求,然后再提交 JUnit XML 报告。

token=$(curl -H "Content-Type: application/json" -X POST --data '{ "client_id": "32A27E69B0AC4E5000000...","client_secret": "d62f81eb9ed859e1....." }'  https://xray.cloud.getxray.app/api/v2/authenticate)
curl -H "Content-Type: text/xml" -X POST -H "Authorization: Bearer $token"  --data @"junit.xml" https://xray.cloud.getxray.app/api/v2/import/execution/junit?projectKey=XTP

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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