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

Support full new schema #677

Open
8 of 10 tasks
hugo-vrijswijk opened this issue Dec 23, 2020 · 2 comments
Open
8 of 10 tasks

Support full new schema #677

hugo-vrijswijk opened this issue Dec 23, 2020 · 2 comments
Labels
enhancement New feature or request hacktoberfest Great issues to pick up for Hacktoberfest

Comments

@hugo-vrijswijk
Copy link
Member

hugo-vrijswijk commented Dec 23, 2020

The latest mutation-testing-report-schema release added new properties to the schema. We should fill as many of them as we can:

  • testFiles can be filled per fullyQualifiedName of a test suite
  • coveredBy in a mutant
  • killedBy in a mutant
  • duration in a mutant
  • testsCompleted in a mutant
  • performance
  • framework, we can fill dependencies with at least the sbt and stryker4s version. Perhaps the test framework too
    • Dependencies is not filled at the moment, but other framework info is
  • system, we can easily fill ci, os and cpu
  • config
@hugo-vrijswijk hugo-vrijswijk added the enhancement New feature or request label Dec 23, 2020
@cbrunnkvist
Copy link
Contributor

cbrunnkvist commented Mar 25, 2021

https://raw.githubusercontent.com/stryker-mutator/mutation-testing-elements/master/packages/mutation-testing-report-schema/src/mutation-testing-report-schema.json

It seems like the mutation score per file is NOT included in the schema but, I presume, calculated on-the-fly by the UI component?

That's problematic because I want to log the score to an external database/chart after stryker4s is finished in CI. Isn't it also duplicating the score calculation in both stryker4s.report.ConsoleReporter and the web UI (and the Dashboard?). 🤔

Any ideas of how I can get the score out into my CI runner would be helpful - short of rendering the UI component in a virtual DOM...

@hugo-vrijswijk
Copy link
Member Author

hugo-vrijswijk commented Mar 25, 2021

@cbrunnkvist Yes, to prevent duplicate data in the JSON, the mutation score is calculated on the fly.

Rendering the html report definitely doesn't seem ideal, haha. You might want to look at the mutation-testing-elements repo which has a library for Scala and NodeJS to calculate metrics based on a report in a standard way. That code is used by StrykerJS, Stryker4s, the html report and the dashboard to calculate the score (and a couple of other things).

If there's something missing in the metrics, or it doesn't fit your use-case, let me know! We're happy to support more use-cases!

For example, to get the score in Ammonite:

@ import $ivy.`io.stryker-mutator::mutation-testing-metrics-circe:latest.release`, mutationtesting._, mutationtesting.circe._, io.circe._, io.circe.parser._

@ val report = decode[MutationTestResult[JsonObject]](scala.io.Source.fromFile("./report.json").mkString).right.get
@ val metrics = Metrics.calculateMetrics(report)
@ metrics.mutationScore
res15: Double = 70.24070021881839

@hugo-vrijswijk hugo-vrijswijk added the hacktoberfest Great issues to pick up for Hacktoberfest label Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest Great issues to pick up for Hacktoberfest
Projects
None yet
Development

No branches or pull requests

2 participants