Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the JUnit time attribute on a failed tests. #204

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pbernery
Copy link

@pbernery pbernery commented Feb 1, 2016

The Sonar JUnit parser fails if the time attribute is not present on
failed tests. This patch adds this attribute for these tests with a
fixed duration of "0".

Adding the real test duration was considered however it cannot be
done easily with the current xcpretty implementation: xcpretty parses
Xcode output line by line whereas a failed test outputs at least 2 lines
of log: one that shows the failed test and the cause, another that
displays the duration (quite the same line as a passing test).
A considered approach would be to keep a context and output a
transformed log line only if the context is full (in the case of failed
tests, only if the cause and the duration have been parsed).

The Sonar JUnit parser fails if the time attribute is not present on
failed tests. This patch adds the time attribute for these tests with a
fixed duration of "0".

Adding the real test duration was considered however it cannot be
done easily with the current xcpretty implementation:  xcpretty parses
Xcode output line by line whereas a failed test outputs at least 2 lines
of log: one that shows the failed test and the cause, another that
displays the duration (quite the same line as a passing test).
A considered approach would be to keep a context and output a
transformed log line only if the context is full (in the case of failed
tests, only if the cause and the duration have been parsed).
@Palleas
Copy link

Palleas commented Dec 1, 2016

Any news on this? I'm having the same issue and made the exact same fix in my fork.
Poke @supermarin, maybe?

@supermarin
Copy link
Contributor

@Palleas this will be addressed after releasing 0.3.

@Palleas
Copy link

Palleas commented Dec 2, 2016

Great news!

@pbernery
Copy link
Author

Hello,
Any news about this 0.3 version?

@supermarin
Copy link
Contributor

supermarin commented Jun 1, 2017

you can use / test it with blacklist branch. Can't commit to a date where it's released

@pbernery
Copy link
Author

pbernery commented Jun 2, 2017

Alright, thanks @supermarin. I'll have a look.

@orj
Copy link

orj commented Jun 5, 2017

Um. This blocking people using xcpretty with Sonar and is a trivial change. Why can we not get a v0.2.9 in the interim before 0.3?

@supermarin
Copy link
Contributor

@orj sorry for the late feedback on this. I'm pretty sure time value is present on the test run output. I think we should parse it and add properly vs just adding a zero. Mind looking into that?
You'd need to patch the parser in order to parse out the time

@ButkiewiczP
Copy link

@orj This issue seems to be addressed by #240 , which was merged, but then reverted before the 0.2.4 release. I've made an issue about it: #292

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants