Hey everyone!
Maybe this is just my lack of knowledge of javascript, but is there anyway to send the test results to an external api during or after a run? We're trying to hook up our automation to Test Rail's API but I'm not quite sure how to pass the data after the completion of each test. Any suggestions?
Thanks!
Hi @jesterxiii,
You can create a custom reporter for your purposes. Here is a step-by-step guide on how to implement it: https://devexpress.github.io/testcafe/documentation/extending-testcafe/reporter-plugin/. Also you can take a look at how other testcafe reporters are implemented: https://www.npmjs.com/search?q=testcafe-reporter
That did it, thanks!
@jesterxiii - Maybe you can help me and other users here. I'm trying to achieve the same i.e post test results to TestRail. Could you share the custom reporter that wrote for us?
Well, you can use custom reporter plugin, and send the test results to the TestRail in the reportTestDone hook through http library like superagent.
@SynaQE I doubt the one I created will fit your needs, but I can pass along some advice:
I'm using https://www.npmjs.com/package/testrail-api just for ease of use.
You basically need to create and collect test information in a data structure during the run, and post it to testrail in the end of either the current test, fixture, or run. You can generate a reporter from here: http://devexpress.github.io/testcafe/documentation/extending-testcafe/reporter-plugin/#generating-a-reporter-project
You can check some of their existing reporters work off of as examples:https://github.com/DevExpress/testcafe-reporter-xunit
Thanks @jesterxiii @CommanderXL for the advice. Let me give this a try and see if I get this to work. If I get stuck along the way, i'll reach out.
If anyone is interested or looking to use TestRail in TestCafe, we have created HTML & TestRail reporter plugin - https://www.npmjs.com/package/testcafe-reporter-html-testrail