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 metadata to TestCase #35

Conversation

bryanbcook
Copy link
Contributor

@bryanbcook bryanbcook commented Nov 8, 2023

This PR introduces a meta_data property to TestCase as outlined in proposal #34

All existing unit tests have been updated to support the new property.

  • Cucumber implementation
  • jUnit implementation
  • Mocha implementation
  • TestNG implementation
  • xUnit implementation

@bryanbcook
Copy link
Contributor Author

I started the TestNG implementation for mapping <groups> to individual <test-method>, but shelved it when I realized it might need a deeper review of that parser.

The mapping should be trivial: iterate over the groups and build a Map<string,string[]> between each method signature and its associated list of groups. However, the current testng parser implementation strips out the <class> when locating relevant <test-method> nodes.

const rawClasses = rawTest.class;
for (let j = 0; j < rawClasses.length; j++) {
  rawTestMethods.push(...rawClasses[j]['test-method'].filter(raw => !raw['@_is-config']));
}

I also wasn't sure which tests were exercising the getTestSuite versus getTestSuiteFromTests.

Any suggestions?

@bryanbcook
Copy link
Contributor Author

I was able to address the testng issue by propagating the className into the test-method for easy retrieval.

@ASaiAnudeep
Copy link
Member

@bryanbcook Thank you for your comprehensive research on all the test result formats. Contributions like yours will make our project stronger and more reliable.

@bryanbcook bryanbcook force-pushed the feature/34-test-case-metadata branch from 48e8435 to 4c16a43 Compare November 10, 2023 15:32
rawTags.push(rawTag);
}
test_case.meta_data.set("tags", tags.join(","));
test_case.meta_data.set("tagsRaw", rawTags.join(","));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ASaiAnudeep - what are your thoughts on preserving the original tags?

@bryanbcook
Copy link
Contributor Author

If you're ok with this, please use the 'squash and merge' option when completing the pull-request.

@ASaiAnudeep ASaiAnudeep merged commit e3c18be into test-results-reporter:main Nov 11, 2023
6 checks passed
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