I am looking for examples of integrations among Flutter Integration library and test management tools like TestRail or Xray. For Cypress and other browser automation tools I can find plenty of solutions but for Flutter integration basically nothing.
For Xray, there's no tutorial yet. However, it should be fairly simple.
Run your tests using flutter test
and pass the --machine
argument to generate a JSON report.
Use the junitreport package to generate a JUnit XML report.
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. For Xray server/datacenter, you need to call the REST API endpoint, something like:
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. You have to make an authentication request first, and then do another submiting the JUnit XML report.
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