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
Comply with html reporter format #160
Comply with html reporter format #160
Conversation
…mutation testing elements json schema (#51)
…o html report + fix bug with health range numbers
…into Comply-html-reporter-format
import stryker4s.report.model.MutantStatus.MutantStatus | ||
import stryker4s.report.model._ | ||
|
||
trait MutantRunResultMapper { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a couple of thoughts about this trait.
- There's one test that covers all the methods, shouldn't we split this up more? That way if a test fails it's easier to identify where the bug is, but I'm not sure how important that is.
- If we're not going to do nr 1, all of these methods can be marked private except
toReport
, if I'm correct. - The method names slightly throw me off. i.e.
toLocation
makes more sense as an extension method. Now for example you're callingtoMutantStatus
, but I'm thinking: "you're going to MutantStatus... from where exactly?" if that makes sense. To me something likemapRunResultToMutantStatus
makes more sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. There's one test that covers all the methods, shouldn't we split this up more? That way if a test fails it's easier to identify where the bug is, but I'm not sure how important that is.
I agree. The single test is a bit massive. The thing is though is that the 'top' map function calls the other functions anyway. So then having tests for the 'smaller' functions is a bit redundant
3. The method names slightly throw me off. i.e. `toLocation` makes more sense as an extension method. Now for example you're calling `toMutantStatus`, but I'm thinking: "you're going to MutantStatus... from where exactly?" if that makes sense. To me something like `mapRunResultToMutantStatus` makes more sense.
Hmm, I feel like the "from where" is already apparent from it being given as a parameter (as well as the signature). Having names like mapRunResultToMutantStatus
will get pretty big and unreadable. I agree the names could be better though
core/src/main/scala/stryker4s/report/mapper/MutantRunResultMapper.scala
Outdated
Show resolved
Hide resolved
core/src/test/scala/stryker4s/report/mapper/MutantRunResultMapperTest.scala
Show resolved
Hide resolved
Are you guys checking in the build result of mutation-testing-elements? Please don't do that! Suggestion: add an SBT plugin to download the file in the build 🙈 |
Cool idea! I agree it's a bit ugly to have the generated js in source control, but I'm not sure what the alternative should be. Ideally, the file would be downloaded at the same as the other dependencies. But to do that we'd have to upload it to maven central or something. If we were to download it with an SBT plugin we still need to put the file somewhere. Putting it in resources means we'd have to add it to gitignore (not a terrible idea), putting it in target/... opens up a whole new can of worms. Alternatively, maybe something like webjars could be useful for us. |
Sounds like a good first step. As a performance improvement: don't download it if the file is already there and remove it on
Sounds good to me. You could also create a package.json file and simply run |
Not sure if I like having to install npm as a requirement for our build. For now, I've made a PR to add it as a dependency |
Yeah, I agree that multiple development stacks as a build requirement isn't the most elegant solution. Glad to see there is a way around it with webjars. |
@Wmaarts I've made some changes. Please have a look and see if you agree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I only have questions tbh.
case _: Survived => MutantStatus.Survived | ||
case _: Killed => MutantStatus.Killed | ||
case _: NoCoverage => MutantStatus.NoCoverage | ||
case _: TimedOut => MutantStatus.Timeout | ||
case _: Error => MutantStatus.CompileError | ||
} | ||
|
||
private[this] def fileContentAsString(path: Path)(implicit config: Config): String = | ||
private def fileContentAsString(path: Path)(implicit config: Config): String = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason this is private
instead of private[this]
? (I'm actually not sure about the difference. 🙈 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no real reason other than consistency. private
means objects of other types can not access it. private[this]
means objects of the same type also cannot access it. So it's slightly tighter encapsulation. (You can also have protected[com.packagename]
for example). It's explained better here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's consistency on this throughout stryker4s though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. But now there is within the class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we'll save this discussion for later then. x)
Closes #29
What it does
Supports the new HTML reporter schema. (stryker-mutator/mutation-testing-elements#1)
How it works
Adds some new case classes that when converted to JSON, comply with the schema. Root case class has a
toJson
method that returns aio.circe
JSON object. Case classes do not havehtml
in their names, as the schema is not html-report specific (though that is the only implementation for now).Also adds a mapper that converts the
MutantRunResult
to the case classes for the HTML report.This PR is to a new branch,
feat-html-reporter
instead of the already existing branchHTML-reporter
as I have made a lot of changes, merged master, etc, which would create a really, really ugly diff.