Search code examples
webdriverautomated-teststestcafetestrailwdio-v4

Custom TestRail reporter for TestCafe not grab test results


I have custom TestRail (TR) reporter set and working with standard WDIO project. Basically it gets TR parameters in Json from CI, that grab test results and POST them to TR via 'testrail-api'. Reporters used:

reporterOptions: {
        outputDir:   './mochawesome-report',
        mochawesome_filename: 'results.json',
        testRailReporter: TRreporterConfig
},

Now I migrated my project to TestCafe and need to apply same reporter here.

I did set custom 'TestRailReporter', moved all parameters from wdio.conf.json int testcafe.conf.json. I'm able to start my run with specified custom parameters that I see applied in code.

But, TRreporterConfig reporter doens't get any data and so no results filled in TR.

Test triggered by: testcafe chrome tests --TEST_RAIL_RUN_PARAMS="{\"project\":{\"id\": 1,\"name\":\"MyProject\"},\"run\":{\"id\": 1},\"suite\":{\"id\": 1,\"name\": \"MyProject\"}}"

Than those parameters parsed and provided for test run

Is there any special 'hooks' I need to add in order to grab test results in TestCafe?


Solution

  • You cannot pass custom arguments directly to TestCafe, so the testcafe chrome tests --TEST_RAIL_RUN_PARAMS... command doesn't work.

    To grab test results and process them, TestCafe provides the Custom Reporters mechanism.

    Override all required reporter methods and put all your custom logic into it.