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
Merged
hugo-vrijswijk
merged 48 commits into
feat-html-reporter
from
Comply-html-reporter-format
Mar 20, 2019
Merged
Changes from 37 commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
460023f
WIP: Start on mapper
legopiraat 93eba12
WIP: First setup to generate classes based on the html reporter spec
legopiraat 86e7c77
Fill in a few more fields
legopiraat 8e3cb2a
Add file source to report structure
legopiraat f3f6fae
Add plumbing so we can validate the html reporter output against the …
legopiraat c0b60c7
Merge branch 'master' into HTML-Reporter
legopiraat b8b7c5e
Merge branch 'HTML-Reporter' into Comply-html-reporter-format
legopiraat 2f6779e
Add names to mutants so we can have it in the html report
legopiraat 55329ce
Merge branch 'Mutant-name-for-html-report' into Comply-html-reporter-…
legopiraat 17680bf
Add html reporter to list of available reporters + add mutator name t…
legopiraat aa90691
Add test to make sure multiple reporters are invoked when specified
legopiraat d9153d0
Merge branch 'master' of https://github.com/stryker-mutator/stryker4s…
legopiraat e081c48
More of the merge
legopiraat cfc2522
Add location
legopiraat fbdb58e
Cleanup tests and add schema in resources
hugo-vrijswijk e00f474
Add test for validating generated json
hugo-vrijswijk 632fe0b
Update everit-json-schema version (using jitpack now)
hugo-vrijswijk 3441459
WIP
hugo-vrijswijk 514dc4f
Merge remote-tracking branch 'origin/master' into Comply-html-reporte…
hugo-vrijswijk a9ffa5b
Remove Circe parser dependency (no parsing is done, only writing)
hugo-vrijswijk a548118
Redo html report case classes
hugo-vrijswijk cf1d7ed
WIP: Add test for mapping validation
hugo-vrijswijk 3abff6b
WIP
hugo-vrijswijk 1a2bf82
Fix rename issue
hugo-vrijswijk 6a9889e
Add new flat structure report schema
hugo-vrijswijk 1b36880
Move reporter to stryker4s.report package and add new report case cla…
hugo-vrijswijk ab84208
Move tests and replace report json with new version
hugo-vrijswijk 92bdae4
Implement MutantMapper and add tests
hugo-vrijswijk aa3d36f
Add html report files to resources
hugo-vrijswijk ab2a0a3
Fix mapper not finding correct file source
hugo-vrijswijk f92dde3
Fix html reporter
hugo-vrijswijk f9ac27d
Fix test not finding files
hugo-vrijswijk 6d64b56
Remove stryker4s.conf
Wmaarts 5d818bb
Small refactorings and comments
hugo-vrijswijk 564eb52
Remove unused code
hugo-vrijswijk a582084
Merge branch 'feat-html-reporter' into Comply-html-reporter-format
hugo-vrijswijk 683435a
Formatting
hugo-vrijswijk 00ec106
Ugly-print json and add test
hugo-vrijswijk 308d05e
Update mutation-test-elements.js to v0.0.7
hugo-vrijswijk d1cf0bd
Remove generated sources, and fetch them as a dependency from webjars…
hugo-vrijswijk 36a6916
Merge remote-tracking branch 'origin/master' into Comply-html-reporte…
hugo-vrijswijk ccddc52
Move report modelclasses into single file
hugo-vrijswijk faa01e5
Small renaming in MutantRunResultMapper
hugo-vrijswijk bfc5431
Fix and simplify MutantRunResultMapperTest
hugo-vrijswijk 34eadd4
Edit html config documentation
hugo-vrijswijk d2b75d2
Fix test
hugo-vrijswijk cc072dc
Update to v1.0.1 of mutation-testing-report
hugo-vrijswijk 40ec153
Merge remote-tracking branch 'origin/master' into Comply-html-reporte…
hugo-vrijswijk File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<mutation-test-report-app src="mutation-report.json"></mutation-test-report-app> | ||
<script src="mutation-test-elements.js"></script> | ||
</body> | ||
|
||
</html> |
5,823 changes: 5,823 additions & 0 deletions
5,823
core/src/main/resources/html-report/mutation-test-elements.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tryker4s/run/report/ConsoleReporter.scala → ...la/stryker4s/report/ConsoleReporter.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package stryker4s.run.report | ||
package stryker4s.report | ||
|
||
import java.lang.System.lineSeparator | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package stryker4s.report | ||
import stryker4s.config.Config | ||
import stryker4s.model.MutantRunResults | ||
import stryker4s.report.mapper.MutantRunResultMapper | ||
|
||
class HtmlReporter extends MutantRunReporter with MutantRunResultMapper { | ||
|
||
override def report(runResults: MutantRunResults)(implicit config: Config): Unit = { | ||
val mapped = toReport(runResults).toJson | ||
|
||
println(mapped) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...scala/stryker4s/run/report/Reporter.scala → ...ain/scala/stryker4s/report/Reporter.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
core/src/main/scala/stryker4s/report/mapper/MutantRunResultMapper.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package stryker4s.report.mapper | ||
import java.nio.file.Path | ||
|
||
import stryker4s.config.{Config, Thresholds => ConfigThresholds} | ||
import stryker4s.model._ | ||
import stryker4s.report.model.MutantStatus.MutantStatus | ||
import stryker4s.report.model._ | ||
|
||
trait MutantRunResultMapper { | ||
|
||
private val schemaVersion = "1" | ||
|
||
def toReport(mutantRunResults: MutantRunResults)(implicit config: Config): MutationTestReport = MutationTestReport( | ||
schemaVersion, | ||
toThreshold(config.thresholds), | ||
toFiles(mutantRunResults.results.toSeq) | ||
) | ||
|
||
def toThreshold(thresholds: ConfigThresholds): Thresholds = | ||
Thresholds(high = thresholds.high, low = thresholds.low) | ||
|
||
def toFiles(results: Seq[MutantRunResult])(implicit config: Config): Map[String, MutationTestResult] = | ||
results groupBy (_.fileSubPath) map { | ||
case (path, runResults) => path.toString.replace('\\', '/') -> toMutationTestResults(runResults) | ||
} | ||
|
||
def toMutationTestResults(runResults: Seq[MutantRunResult])(implicit config: Config): MutationTestResult = | ||
MutationTestResult( | ||
fileContentAsString(runResults.head.fileSubPath), | ||
runResults.map(toMutantRunResult) | ||
) | ||
|
||
def toMutantRunResult(runResult: MutantRunResult): MutantResult = { | ||
hugo-vrijswijk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
val mutant = runResult.mutant | ||
MutantResult( | ||
mutant.id.toString, | ||
mutant.mutationType.mutationName, | ||
mutant.mutated.syntax, | ||
toLocation(mutant.original.pos), | ||
toMutantStatus(runResult) | ||
) | ||
} | ||
|
||
def toLocation(pos: scala.meta.inputs.Position): Location = Location( | ||
start = Position(line = pos.startLine + 1, column = pos.startColumn + 1), | ||
end = Position(line = pos.endLine + 1, column = pos.endColumn + 1) | ||
) | ||
|
||
def toMutantStatus(mutant: MutantRunResult): MutantStatus = mutant match { | ||
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 = | ||
(config.baseDir / path.toString).contentAsString | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package stryker4s.report.model | ||
|
||
final case class Location(start: Position, end: Position) |
8 changes: 8 additions & 0 deletions
8
core/src/main/scala/stryker4s/report/model/MutantResult.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package stryker4s.report.model | ||
import stryker4s.report.model.MutantStatus.MutantStatus | ||
|
||
final case class MutantResult(id: String, | ||
mutatorName: String, | ||
replacement: String, | ||
location: Location, | ||
status: MutantStatus) |
6 changes: 6 additions & 0 deletions
6
core/src/main/scala/stryker4s/report/model/MutantStatus.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package stryker4s.report.model | ||
|
||
object MutantStatus extends Enumeration { | ||
type MutantStatus = Value | ||
val Killed, Survived, NoCoverage, CompileError, Timeout = Value | ||
} |
16 changes: 16 additions & 0 deletions
16
core/src/main/scala/stryker4s/report/model/MutationTestReport.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package stryker4s.report.model | ||
import io.circe.{Encoder, Json} | ||
import stryker4s.report.model.MutantStatus.MutantStatus | ||
|
||
final case class MutationTestReport(schemaVersion: String, | ||
thresholds: Thresholds, | ||
files: Map[String, MutationTestResult]) { | ||
|
||
private implicit val encoder: Encoder[MutantStatus] = Encoder.enumEncoder(MutantStatus) | ||
|
||
def toJson: Json = { | ||
import io.circe.generic.auto._ | ||
import io.circe.syntax._ | ||
this.asJson | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
core/src/main/scala/stryker4s/report/model/MutationTestResult.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package stryker4s.report.model | ||
|
||
final case class MutationTestResult(source: String, mutants: Seq[MutantResult], language: String = "scala") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package stryker4s.report.model | ||
|
||
final case class Position(line: Int, column: Int) | ||
hugo-vrijswijk marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package stryker4s.report.model | ||
|
||
final case class Thresholds(high: Int, low: Int) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
toReport
, if I'm correct.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.
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
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