Daniel-Marynicz / BehatParallelExtension

Behat Parallel Extension
MIT License
18 stars 6 forks source link

Multiple output overwriting #67

Closed barryswaisland-eagleeye closed 5 months ago

barryswaisland-eagleeye commented 6 months ago

Hello, fantastic module. I'm interested in getting existing file output from this - which currently seems like it is always going to be incomplete as it would overwrite the out, given I have many scenarios and/or features:

bit/behat -l --format=pretty --out=pretty.txt

pretty.txt will only contain the last processes output.

I was thinking that would create unique files within a folder would be the best case for this, e.g. foreach of buildOptionArguments in TaskArgumentsBuilder might be like:

if ('out' === $name) {
   if ('std' !== reset($value)) {
    //no need to pass this on as it is unseen
    continue;
   }
   $pathinfo = pathinfo(reset($value)); 
   $value = 'parallel_output' . DIRECTORY_SEPARATOR
      . $pathinfo['dirname'] . DIRECTORY_SEPARATOR
      . $pathinfo['filename'] . mt_rand() . '.' . $pathinfo['extension'];
}

Then if there were someway to re-combine them would be the icing on cake - but the main purpose is to be able to parse results from junit automatically. It is a shame as I have yet to think of how to still get the html output which would be nice.

What do you think?

Daniel-Marynicz commented 5 months ago

Instead, you can use --out to redirect the output to a file bit/behat -l --format=pretty > pretty.txt 2>&1

barryswaisland-eagleeye commented 5 months ago

Thank you I can see how that would work with --format=pretty.

I should have put --format=junit as the example as parsing this automatically is key.

And again very much a shame that cannot output to html.

Daniel-Marynicz commented 5 months ago

junit formatter does not support this.

You need create and register custom format. Like this example https://stackoverflow.com/questions/8922825/how-to-set-custom-template-for-html-formatter-in-behat As a base for your formater you can use classes https://github.com/Behat/Behat/tree/master/src/Behat/Behat/Output/Node/Printer/JUnit

barryswaisland-eagleeye commented 5 months ago

I appreciate your responses @Daniel-Marynicz - I was thinking as Junit might be considered part of behat and it would be more changes to this module to support existing behavior (that I'd make) and could be something like the original suggestion and then to re-combine the separate outputs - but I assume this is not a direction you would like for the module based on the suggestions so far.

I'll have a think if writing custom formatter or something else external works instead of changes to this module to make it work "out of the box". Thanks again for the module and your time.