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 file attributes for JUnit Test Report #33

Merged
merged 1 commit into from
Apr 18, 2024
Merged

Conversation

Kuniwak
Copy link
Member

@Kuniwak Kuniwak commented Apr 17, 2024

Add file attributes for <testsuite> and <testcase> to improve summary that generated by https://github.com/mikepenz/action-junit-report .

And in previous specification,time is based on a not useful definition1 so it becomes always "0.000".

Before

Screenshot of Summary that generated by mikepenz/action-junit-report

No full paths present in the summary.

Screenshot 2024-04-17 at 16 19 39

When there are no missing and no dangling metas

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
	<testsuite tests="1" failures="0" time="0.000" name="unity-meta-check">
		<properties>
			<property name="go.version" value="go1.22.0"></property>
		</properties>
		<testcase classname="unity-meta-check" name="OK" time="0.000"></testcase>
	</testsuite>
</testsuites>

When there are one missing and one dangling meta

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
	<testsuite tests="1" failures="1" time="0.000" name="path/to/missing">
		<properties>
			<property name="go.version" value="go1.22.0"></property>
		</properties>
		<testcase classname="missing" name="meta" time="0.000">
			<failure message="Failed" type="">File or directory exists: path/to/missing&#xA;But .meta is missing: path/to/missing.meta</failure>
		</testcase>
	</testsuite>
	<testsuite tests="1" failures="1" time="0.000" name="path/to/dangling">
		<properties>
			<property name="go.version" value="go1.22.0"></property>
		</properties>
		<testcase classname="dangling" name="meta" time="0.000">
			<failure message="Failed" type="">File or directory does not exist: path/to/dangling&#xA;But .meta is present: path/to/dangling.meta</failure>
		</testcase>
	</testsuite>
</testsuites>

After

Screenshot of Summary that generated by mikepenz/action-junit-report

Full paths present in the summary.

Screenshot 2024-04-17 at 16 18 11

When there are no missing and no dangling metas

There are no changes:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
	<testsuite tests="1" failures="0" time="0.000" name="unity-meta-check">
		<properties>
			<property name="go.version" value="go1.22.0"></property>
		</properties>
		<testcase classname="unity-meta-check" name="OK" time="0.000"></testcase>
	</testsuite>
</testsuites>

When there are one missing and one dangling meta

File attributes added:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
	<testsuite tests="1" failures="1" time="0.000" name="path/to/missing" file="path/to/missing"> 👈 a file attribute added
		<properties>
			<property name="go.version" value="go1.22.0"></property>
		</properties>
		<testcase classname="missing" name="meta" time="0.000" file="path/to/missing"> 👈 a file attribute added
			<failure message="Failed" type="">File or directory exists: path/to/missing&#xA;But .meta is missing: path/to/missing.meta</failure>
		</testcase>
	</testsuite>
	<testsuite tests="1" failures="1" time="0.000" name="path/to/dangling" file="path/to/dangling"> 👈 a file attribute added
		<properties>
			<property name="go.version" value="go1.22.0"></property>
		</properties>
		<testcase classname="dangling" name="meta" time="0.000" file="path/to/dangling"> 👈 a file attribute added
			<failure message="Failed" type="">File or directory does not exist: path/to/dangling&#xA;But .meta is present: path/to/dangling.meta</failure>
		</testcase>
	</testsuite>
</testsuites>

Contribution License Agreement

Footnotes

  1. For unity-meta-check ... | unity-meta-check-junit ... style calling, the time is a duration between unity-meta-check-junit is started and ended. This definition is not useful.

@Kuniwak Kuniwak marked this pull request as ready for review April 17, 2024 07:25
@@ -4,7 +4,6 @@ go 1.18

require (
github.com/google/go-cmp v0.5.5
github.com/jstemmer/go-junit-report v0.9.1
Copy link
Member Author

@Kuniwak Kuniwak Apr 18, 2024

Choose a reason for hiding this comment

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

This library does not have ability to set file attributes. So I decided to purge the library.

Copy link

@keigoi keigoi left a comment

Choose a reason for hiding this comment

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

LGTM!

@Kuniwak Kuniwak merged commit f79642f into master Apr 18, 2024
3 checks passed
@Kuniwak Kuniwak deleted the junit-file-attr branch April 18, 2024 10:10
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