Skip to content

Conversation

@magnetik
Copy link
Contributor

Hi,

From https://github.com/testmoapp/junitxml, I've seen that the <testcase> tag can support a line number. It can helps pinpointing a failing test quickly.

Thanks !

@acoulton
Copy link
Contributor

@magnetik thanks for the contribution, I agree this could be useful. However it looks to me like the line attribute is expected to be on the testcase element?

Your code appears to be putting it on the failure / error element where I think it's not supported?

It would be great if you could fix that, and update the JUnit examples in the failing tests to include the new attribute? Thanks :)

@magnetik
Copy link
Contributor Author

oh yep my bad. I will correct it

@magnetik
Copy link
Contributor Author

I'm fixing the test but it made me wonder if I should report the line only for failed steps because for valid steps, it will always return the last one

@magnetik
Copy link
Contributor Author

magnetik commented Apr 1, 2025

Hey @acoulton. Do you have any input or things I need to change? Thanks :)

Copy link
Contributor

@acoulton acoulton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@magnetik apologies that I didn't get a chance to look at this sooner.

It looks like the junit examples in the hook_failures_junit_(annotations|attributes).feature files need to be updated to add the new attribute there as well.

The implementation looks good to me - in a perfect world I'd rather have kept the code alongside writing the other attributes (e.g. in JunitScenarioPrinter) but from a quick look I think that would be challenging with the existing structure of the listener / printer / output classes. So I think you've found a good solution to add this to what we have already.

made me wonder if I should report the line only for failed steps because for valid steps, it will always return the last one

I think that's OK, it's probably better for end-users to consistently have the attribute present with "the line number of the step that ran" than to have to work out what it means / work around it only being present sometimes.

@magnetik
Copy link
Contributor Author

It was my turn to be late to the party. I fixed both files.

Thanks for your input 👍

@magnetik magnetik requested a review from acoulton May 16, 2025 12:38
Copy link
Contributor

@acoulton acoulton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@magnetik thanks very much for updating this, there's one tiny change to pass the standards check - I'll commit that for you now (once this is merged, the CI will run immediately for any future contributions from you, so it'll be much easier to get feedback).

@acoulton acoulton requested a review from carlos-granados May 20, 2025 08:35
Copy link
Contributor

@carlos-granados carlos-granados left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @magnetik

@acoulton acoulton merged commit 2a8b5b2 into Behat:master May 20, 2025
18 checks passed
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.

3 participants