webdriverio-boneyard / wdio-junit-reporter

A WebdriverIO v4 plugin. Report results in junit xml format.
http://v4.webdriver.io
MIT License
11 stars 42 forks source link

No xml file created after adding 'outputFileFormat' option in wdio config file #92

Closed aliu145 closed 6 years ago

aliu145 commented 6 years ago

When I try to add option to generate just one xml file (by adding outputFileFormat 'single' option), like below:

image

When I run my code now, no xml file is generated in the output directory (vs if I remove the 'outputFileFormat' var, it is generated when code is run). Any ideas why this may be happening?

aliu145 commented 6 years ago

Basically, 'single' and 'multi' options don't work. If I just put in:

outputFileFormat: function(opts) { return "results-${opts.cid}.${opts.capabilities}.xml" }

It will work..

christian-bromann commented 6 years ago

ping @mcelotti ^^^

mcelotti commented 6 years ago

Hi @aliu145 what version of wdio-junit-reporter do you have in package.json?

aliu145 commented 6 years ago

@mcelotti the version is set to "^0.3.1"

mcelotti commented 6 years ago

You need to check (npm ls wdio-junit-reporter) if you're using the latest version (0.4.2). Or you could set it manually in package.json replacing "^0.3.1" with "0.4.2".

aliu145 commented 6 years ago

Thanks that worked! If I wanted to include run information in the file name i.e. browser type (Chrome), date/time, etc how could I access that?

mcelotti commented 6 years ago

Great! With the 'single' option you only get the config param since capabilities and cid are not applicable. In your case I think you could do something like:

outputFileFormat: {
    single: (config) => `chrome-${new Date().getTime()}.xml`
}

This creates a file with a timestamp like 'chrome-1520895982563.xml' but you can customize to have a MM/dd/yyyy format or similar

christian-bromann commented 6 years ago

I guess this can get closed then