ronaldlokers / grunt-casperjs

Grunt task for casperjs
MIT License
104 stars 51 forks source link

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

Open abelnation opened 10 years ago

abelnation commented 10 years ago

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.

damienjoldersma commented 10 years ago

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

inerte commented 10 years ago

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.

darwin604 commented 9 years ago

@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.

inerte commented 9 years ago

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.