grunt-casperjs icon indicating copy to clipboard operation
grunt-casperjs copied to clipboard

xunit results overwritten when you have multiple src files in a single task

Open abelnation opened this issue 10 years ago • 4 comments

If you have a single target that runs multiple src files, and specifies an xunit path. The xunit file will be overwritten by each subsequent file that is run.

abelnation avatar May 19 '14 22:05 abelnation

Hi ran into this today as well, any update on how to resolve?

damienjoldersma avatar Jul 03 '14 18:07 damienjoldersma

I found a workaround. You can override xunit on the file specified on --includes. Say you have something like:

options = {
  casperjsOptions: ['--includes=./test/casper-setup.js'],
}

Then on ./test/casper-setup.js you can:

casper.cli.options.xunit = './artifacts/test/results-' + new Date().toISOString() + '.xml';

This will generate a new results-.xml file with Date's toISOString appended. Then maybe after all casperjs tests are run you can aggregate all .xml files into one or, if your xunit processor accepts multiple xml files, leave it this way.

inerte avatar Aug 06 '14 17:08 inerte

@inerte Saved my day! Is it necessary to put the config in its own JS file or can you just slap it in the Gruntfile? I only had success with the former.

darwin604 avatar Sep 16 '15 23:09 darwin604

Hey @darwin604 , I am glad I was able to help. I think you can only manipulate the casper object in casper included files, either specified on --includes or the actual files with the tests.

inerte avatar Sep 17 '15 03:09 inerte