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 multilineProperty method to test_node #76

Conversation

sebastian-sauer
Copy link
Contributor

Some tools allow the property to have a textContent and not use the value attribute.

See https://github.com/testmoapp/junitxml?tab=readme-ov-file#properties-for-suites-and-cases for examples.

@davidparsson
Copy link
Owner

davidparsson commented Sep 17, 2024

Thanks for your contribution! In general I'm happy with it, but I'm not a big fan of boolean flags in public APIs. I can think of two reasonable alternatives:

  1. Either we split the property method into two, one that works as befor and one named something like .textContentProperty(text), or
  2. we automatically detect line breaks in the provided property value (if it's a string) and use a text content properpty when line breaks are detected.

I'm leaning towards the first option to avoid assumptions and unexpected errors, but having the library do the "right thing" for the user is also appealing. What do you think?

@sebastian-sauer
Copy link
Contributor Author

I like option 1, too. I'll change the PR this evening.

@sebastian-sauer
Copy link
Contributor Author

@davidparsson i've now added the textContentProperty - hope the new api is better.

@davidparsson
Copy link
Owner

Thanks, I like this! I'll consider if the names are good enough or if anything should be renamed, but I think I can merge this in its current form.

Thank you for your contribution!

@sebastian-sauer
Copy link
Contributor Author

To be honest - I'm not 100% convinced that the method name is easy to understand :) but as of now I don't have any better name....

@davidparsson
Copy link
Owner

Perhaps multilineProperty() is better? That's the use case, right?

@sebastian-sauer
Copy link
Contributor Author

That sounds good. I'll try to update the PR asap.

@sebastian-sauer sebastian-sauer changed the title Allow properties to use textcontent Add multilineProperty method to test_node Sep 18, 2024
Copy link
Owner

@davidparsson davidparsson left a comment

Choose a reason for hiding this comment

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

Awesome, thanks! 🤩

@davidparsson davidparsson merged commit 6cb2ba4 into davidparsson:main Sep 18, 2024
6 checks passed
@davidparsson
Copy link
Owner

@sebastian-sauer, this is now released in v5.1.0. Thanks!

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.

2 participants