-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Feature/junit reporter #1187
Feature/junit reporter #1187
Conversation
result.assertionResults && | ||
result.assertionResults.forEach((assertion) => { | ||
const testcase = { | ||
'@name': `${assertion.lhsExpr} ${assertion.rhsExpr}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding the operator to the name, I think that is important to see the actual assertion that is tested here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In testing this it seems like the operator is already included in the rhsExpr
field? When I ran this against some of my existing test suites I got results like res.body.array_field.length gt 0
or res.body[0].field_name isString
. Are there some conditions where the operator isn't included in the rhsExpr?
Thanks for the kind words @awinder 💛 PR looks good to me. I would recommend once change before we merge this
There are some conflicts since I merged some PRs. Please sync your fork with the main. |
9c788e6
to
06f116b
Compare
06f116b
to
de530a8
Compare
Awesome, good idea. I refactored this & cleared up the merge conflicts but let me know if there's anything else! |
Merged! Thank you @awinder ! |
@awinder I have released Bru CLI version |
Hi @awinder, I hope you're well. First of all thanks for your great effort! |
Hi @AkkafaOguz, you might need to upgrade the bru CLI to the latest version. Check |
Description
This adds a new flag to bru run, the
--format
flag. It defaults to"json"
, which is the current output file format, while also implementing a"junit"
option that will produce JUnit-formatted XML.There are some opinionated implementation choices which I don't have strong opinions about:
.bru
) for test suite names in the junit markuptime
attribute, and I had access to timing details on the .bru file / test suite level, but not the test case level. For implementation simplicity what I did was I used timing details from the .bru file to set thetime
attribute on the test suite, and then I divided it equally for the child testcases (which are the assertions / individual tests). This seemed accurate enough while hopefully not breaking some tooling that expects thetime
attr to be presentAlso, I don't think I messed anything up applying a new npm module for xml writing (and chose a module which was already being required outside of the cli package), but the package-lock.json file updated widely so probably best to double-check there. I also removed a
@jest/globals
require in the test file because I couldn't get that to work locally, I can add that back, but I'm pretty sure it's unnecessary? And of course happy to address any feedback.MOST IMPORTANTLY: THANK YOU so much for your work on Bruno, this project is awesome. I have now been burned twice on tools in this family (once with Swagger, and now again with Insomnia) adopting cloud policies that will never be acceptable as a business risk. I want to figure out how to champion sponsorship for this project but until then, consider this a small token of appreciation 😄
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.