Junit formatter for Behat 3.x

Events happening in the community are now at Drupal community events on www.drupal.org.
fen's picture

Does anyone have the junit formatter working with behat 3.x?

I suppose there is a related question: is anyone using Behat 3.x with D7 site builds or is 2.x still the way to go?

Comments

Ah, just found the PR

fen's picture

Looks like the PR is ready to go: https://github.com/Behat/Behat/pull/676

Can't wait ;)

Thanks for all the work!

How to configure the junit foormatter

fen's picture

I applied pull/676 to a fork of behat (yes, I know I'm jumping the gun) and I see the junit formatter is now available (via behat -h) - yay! But when I try to run e.g.

./vendor/bin/behat -f pretty,progress,junit --out ,${PROGRESS_LOG},logs/xml -c tests/behat/smoke.yml

I get:
[Behat\Testwork\Output\Exception\FormatterNotFoundException]                        
pretty,progress,junit formatter is not found or has not been properly registered.

If I choose only junit, ("-f junit -o logs/xml") I get output in logs/xml/default.xml

I also tried this in my smoke.yml to no avail:

  formatters:
    pretty:
    progress: [logs/progress.log]
    junit: [logs/xml]

I am also waiting the release

mikaoelitiana@gmail.com's picture

I am also waiting the release for the support of junit format in 3.x. I am using this with D7 and I am using DrupalExtension 3. Do you recommend downgrading to 2.x for now?

Perhaps not the best solution...

fen's picture

I applied the pull request to a local fork of Behat.

Now this works: behat -f junit --out logs/xml but it will be the only formatter. That is, I can get 'pretty' or 'junit' but not both ('pretty,junit'). But it supports jenkins, so I'm happy.

Note: I'm not sharing my fork as, once junit has been merged, I might do other experiments with the fork and I don't want to be responsible for breaking other's tests.

Same here

MKorostoff's picture

Same result here. I had to upgrade to the latest dev version of behat, and even then I only get access to one formatter at a time.

I copied this command verbatim from the behat docs:

behat -f pretty,progress,junit --out ,progress.out,xml

And received this error:

Only local images are allowed.

UPDATE: the format as of

MKorostoff's picture

UPDATE: the format as of behat 3.0-dev is:

bin/behat --format=pretty --out=std --format=junit --out=junit

UPDATE: the format as of

MKorostoff's picture

UPDATE: the format as of behat 3.0-dev is:

bin/behat --format=pretty --out=std --format=junit --out=junit

Behat

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: