Testcafe report generaton - open source engine

101 views Asked by At

I am planning to convert my testcafe console output to txt/html file with custom file name, I am using below line of script, but output file is not generating and no errors. I have installed the required report templates. Please guide me .

$ testcafe chrome tests/core/sample.test.js --reporter html:/file.html $ testcafe chrome tests/core/sample.test.js --reporter list:/test.txt

Thanks Ramesh D

1

There are 1 answers

1
pavelsaman On

console output to txt

Isn't this just easier?

$ testcafe chrome tests/core/sample.test.js > test_output.txt 2>&1

I mean you can use reporters, you can build your own reporter and spend hours on that, or if you really just need a file out of console output, this should be enough.

console output to html

I have a habit of using config files rather than command line options, so I'll show it on config files:

.testcaferc.json

{    
     "reporter": [        
        {
            "name": "html",
            "output": "Results/report.html"
        }
    ]
}

First, of course, you need to install the appropriate npm package:

$ npm install --save-dev testcafe-reporter-html

If you insist on a command-line option, this testcafe docs should guide you. I believe this would be the right command:

$ testcafe chrome tests/core/sample.test.js -r html:Results/report.html