Escape some characters in xunit_results.xml #252
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
First of all we love your work! We are using your framework for some time now and found a problem with the xml results.
Assert Messages and TestNames are not properly escaped in the xunit_testresults.xml
If you would add a " character in either the Assert Message or TestName the xunit_testresults.xml cannot be properly parsed by xml parsers. To fix this problem I've implemented a F_XmlEscapeString function. For now I followed the 'safe' approach as suggested in this link https://stackoverflow.com/a/1091953.
Sample test code that will create the problem in the xml file:
These tests result in:
But should be:
I've tried to add some basic tests, but I'm not happy with the requirement that is now should be run on a local machine for this to work. I'm happy to omit these tests or adjust this if needed.
Please let me know what you think of this change.
(Note: this is the first time I'm actively contributing to a project, so please let me know if I should do anything different next time :) )