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

Adding stack traces in xml_reports. #14

Open
malonaz opened this issue Mar 15, 2019 · 5 comments · May be fixed by #25
Open

Adding stack traces in xml_reports. #14

malonaz opened this issue Mar 15, 2019 · 5 comments · May be fixed by #25

Comments

@malonaz
Copy link

malonaz commented Mar 15, 2019

Hey thank you for your help, this is a great tool!
I was wondering if you could add stack trace data in the report?
thank you

<testcase classname="vault.range" name="CreateAccount()" time="0.062">
   <failure message="'5' != 1" type="AssertionError">
   <![CDATA[Traceback (most recent call last):
       package:test_api                
         expect
          test/range/range_test.dart 6:5 main.<fn>\n]]>		
   </failure>
</testcase>
@rspilker
Copy link
Contributor

Thanks for reaching out.

I don't exactly understand the request. It would help if you could give a concrete example, preferably including source code , to demonstrate the problem you want to solve, and how you would expect it to end up in the xml reports.

@rspilker rspilker added the parked Awaiting feedback from reporter label Mar 15, 2019
@raubreysmith
Copy link

raubreysmith commented May 22, 2019

@rspilker looking at the dart --reporter json and flutter --machine output there is a stacktrace property

{"testID":3,"error":"Expected: <false>\n  Actual: <true>\nmy failure reason\n","stackTrace":"package:test_api         expect\ntest\\main.test.dart 5:5  main.<fn>\n","isFailure":true,"type":"error","time":1171}

Version

pub -v
FINE: Pub 2.3.0

@rspilker rspilker removed the parked Awaiting feedback from reporter label May 26, 2020
@buntagonalprism buntagonalprism linked a pull request Mar 26, 2021 that will close this issue
@buntagonalprism
Copy link

Pretty old issue, but it looks like the stack trace was being deliberately excluded from the JUnit output when a test failed an expect() call. The stack trace was only included when the test threw an unexpected exception.

I've raised a pull request to fix this behaviour. I don't see any reason why the stack traces should be excluded from test failures - they provide useful information especially in large projects with lots of tests and test helper methods.

@rspilker
Copy link
Contributor

rspilker commented Jan 6, 2022

I'm a bit in the fence. the reason it that in most cases, the only clutter up the output. I understand that if you have a lot of test helper classes and the actual expect is not being done in the test method itself, it might be helpful.

However, I think in that case you're doing it wrong. I'm okay with having some helper code, but the actual comparison or verification of exception should always be done in the test function.

So now you're asking me to add clutter to the output for those developers that are using best practices. I have a problem with that.

I am considering adding a boolean opt-in command line parameter for also adding stack traces on failures.

@davidmartos96
Copy link

I've also encountered with this. An opt in flag would be great for our use case.
Thanks for the useful package @rspilker !

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 a pull request may close this issue.

5 participants