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

ISSUE-689 # Sanitize json report file name #692

Merged

Conversation

javiertuya
Copy link
Collaborator

Sanitize json report file name

Fixes Issue

Motivation and Context

To generate html reports, a json file is created for each scenario. The file name is taken from the scenario name. Report for this scenario fails if the name contains characters that are not allowed as part of a filename. This PR sanitizes the report file name.

Note to reviewers: Sanitization is strict (only keeps alphanumeric, spaces, dots and dashes) because the report filenames are guaranteed to be unique because they contain the correlation id. It could be less strict by replacing only the windows forbidden characters (also valid for unix), even making different replacements for linux and windows, but I'm not sure if it's worth it.

Checklist:

  • New Unit tests were added

    • Covered in existing Unit tests
  • Integration tests were added

    • Covered in existing Integration tests
  • Test names are meaningful

  • Feature manually tested and outcome is successful

  • PR doesn't break any of the earlier features for end users

    • WARNING! This might break one or more earlier earlier features, hence left a comment tagging all reviewrs
  • Branch build passed in CI

  • No 'package.*' in the imports

  • Relevant DOcumentation page added or updated with clear instructions and examples for the end user

    • Not applicable. This was only a code refactor change, no functional or behaviourial changes were introduced
  • Http test added to http-testing module(if applicable) ?

    • Not applicable. The changes did not affect HTTP automation flow
  • Kafka test added to kafka-testing module(if applicable) ?

    • Not applicable. The changes did not affect Kafka automation flow

@authorjapps
Copy link
Owner

@javiertuya , fix looks good to me.
Have you manually check the HTML and CSV reports? ⚠️
Are they fine?

If so, please go ahead and merge the PR.

@javiertuya
Copy link
Collaborator Author

@javiertuya , fix looks good to me. Have you manually check the HTML and CSV reports? ⚠️ Are they fine?

@authorjapps Yes, they are fine. A scenario with this name: Title - with. invalid chars / : produces this csv files after running twice:
image

and the html report shows:
image

@javiertuya javiertuya merged commit 739dd2b into authorjapps:master Oct 27, 2024
1 check passed
@javiertuya javiertuya deleted the 689-report-scenario-invalid-chars branch November 8, 2024 16:46
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.

Report generation fails if scenario name contains non allowed characters
3 participants