DevExpress / testcafe-reporter-xunit

This is the xUnit reporter plugin for TestCafe.
https://testcafe.io
MIT License
10 stars 30 forks source link

How can I write output to a file using the reporter method #6

Closed kweij closed 4 years ago

kweij commented 4 years ago

Documentation state the following usage:

testCafe
    .createRunner()
    .src('path/to/test/file.js')
    .browsers('chrome')
    .reporter('xunit') // <-
    .run();

But how can I specify a filename to write out the results? Setting the reporter like this only formats the console.logged output, but I want it in a file.

Thanks in advance

AndreyBelym commented 4 years ago

Thank you for your inquiry. This issue looks like a question that would be best asked on StackOverflow - an amazing platform for users to ask and answer questions.

You can use the following approaches to redirect the reporter's output to a file:

testCafe
    .createRunner()
    .src('path/to/test/file.js')
    .browsers('chrome')
    .reporter('xunit', 'report.xml')
    .run();
testCafe
    .createRunner()
    .src('path/to/test/file.js')
    .browsers('chrome')
    .reporter({ name: 'xunit', output: 'report.xml' })
    .run();
kweij commented 4 years ago

Thanks you so much for the quick response. And indeed, I should've posted this on StackOverflow.