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 unit tests to the JUnit xml report generation #3184

Merged

Conversation

romain-gilles-ultra
Copy link
Contributor

Add unit tests to the JUnit XML report generation.

@romain-gilles-ultra romain-gilles-ultra changed the title Add unit test to the JUnit xml report generation Add unit tests to the JUnit xml report generation May 24, 2024
@@ -386,9 +387,11 @@ object TestModule {
tests={testResults.length.toString}
failures={testResults.count(_.status == Status.Failure.toString).toString}
errors={testResults.count(_.status == Status.Error.toString).toString}
skipped={testResults.count(_.status == Status.Skipped.toString).toString}
skipped={
testResults.count(testResult => SkippedStatus.contains(testResult.status)).toString
Copy link
Member

Choose a reason for hiding this comment

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

You sometimes use Status.toString and sometimes Status.name(). Is there a difference? Can we always use name ?

Copy link
Contributor Author

@romain-gilles-ultra romain-gilles-ultra May 24, 2024

Choose a reason for hiding this comment

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

Hi @lefou
You are right I should always use the Enum.name() function which is the right function to get the string representation of the enum name. I will fix it. BTW I introduced constants for those names it's my mistake to not use them here ;)

@@ -206,6 +206,10 @@ trait TestModule

object TestModule {
private val FailedTestReportCount = 5
private val ErrorStatus = Status.Error.name()
private val FailureStatus = Status.Failure.name()
private val SkippedStatus =
Copy link
Member

@lefou lefou May 24, 2024

Choose a reason for hiding this comment

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

Should this be plural?

Suggested change
private val SkippedStatus =
private val SkippedStates =

scalalib/src/mill/scalalib/TestModule.scala Show resolved Hide resolved
Copy link
Member

@lefou lefou left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thank you!

@lefou lefou merged commit 9ec9bc1 into com-lihaoyi:main May 24, 2024
39 checks passed
@lefou lefou added this to the 0.11.8 milestone May 24, 2024
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