Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    legopiraat
    @legopiraat
    Hi @plokhotnyuk no that's not suppose to happen, we do know there is a bug with mutli module projects at this moment. Could you try again using something like this: sbt "project yourSubmoduleNameHere" stryker
    Hugo van Rijswijk
    @hugo-vrijswijk
    Adding to that, you also need to configure the base-directory in a stryker4s.conf file (can be a relative path) for sub-modules, see the readme for more info: https://github.com/stryker-mutator/stryker4s#multi-module-projects
    Let us know if it works ;)
    marcindulak
    @marcindulak

    Is html reporter supported by stryker4s? Looking at https://github.com/stryker-mutator/robobar-example/blob/4b4bab94234a0f2dd0488aa348ce80fb295330aa/stryker.conf.js#L6 is supports a nice https://stryker-mutator.io/robobar-example/reports/mutation/html/index.html, but with stryker4s addSbtPlugin("io.stryker-mutator" % "sbt-stryker4s" % "0.2.1")I get:

    cat stryker4s.conf
    stryker4s {
       reporters: ["html", "console"]
    }
    sbt stryker
    ...
    14:51:10.898 [pool-5-thread-2] ERROR stryker4s.config.ConfigReader$ - Failures in reading config: 
    14:51:10.899 [pool-5-thread-2] ERROR stryker4s.config.ConfigReader$ - html (of class java.lang.String).
    ...

    Is there other way to analyse the individual mutants with stryker4s?

    Simon de Lang
    @simondel
    Unfortunately html reports are not yet supported :( But we're working on creating one html reporter for all versions of Stryker
    marcindulak
    @marcindulak
    Is there another way to get the surviving mutant description in stryker4s?
    Hugo van Rijswijk
    @hugo-vrijswijk
    Unfortunately, no. The only reporting for Stryker4s at the moment is console. If you want to persist the logs you could append to a file, e.g.: sbt stryker | tee -a target/stryker4s.log
    Would file logging through the config be something you are interested in? Feel free to open an issue, and I'll see what I can do. It doesn't sound too difficult
    marcindulak
    @marcindulak
    Logging to a file would be interesting if it lists the surviving/killed mutants, even if this could be just printed directly in the console as an e.g. diff. Some kind of a substitute for https://stryker-mutator.io/robobar-example/reports/mutation/html/services/DrinkService.js.html
    Hugo van Rijswijk
    @hugo-vrijswijk
    Hmm, good idea! I've opened an issue for logging killed mutants: stryker-mutator/stryker4s#156
    Wmaarts
    @Wmaarts

    @marcindulak Currently the information is not formatted in a diff format, however I do like the idea.

    Currently the format is like this:

    14:28:06.776 INFO  ConsoleReporter: Undetected mutants:
    core\src\main\scala\stryker4s\run\MutantRunner.scala:56:66:
        from true to false

    For this line of code:
    filePath.createIfNotExists(file.isDirectory, createParents = true) (from here)

    The diff format would look something like this

    14:28:06.776 INFO  ConsoleReporter: Undetected mutants:
    core\src\main\scala\stryker4s\run\MutantRunner.scala:56:66:
    - filePath.createIfNotExists(file.isDirectory, createParents = true)
    + filePath.createIfNotExists(file.isDirectory, createParents = false)
    marcindulak
    @marcindulak

    Any suggestion how to debug a failed stryker initial run a despite successful sbt clean test?
    I'm using scalaVersion := "2.12.7" with

    resolvers += Resolver.sonatypeRepo("snapshots")
    addSbtPlugin("io.stryker-mutator" % "sbt-stryker4s" % "0.2.1+9-2aa50a29-SNAPSHOT")

    and (see sbt/sbt#2194 and https://github.com/stryker-mutator/stryker4s/issues/119)

    java -version
    java version "1.8.0_181"
    Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
    sbt sbtVersion
    ...
    [info] 1.2.1
    export J="-J-Xms5G -J-Xmx7G"
    sbt $J ';clean; set javaOptions in Test += "-Xmx7G -Xms5G"; stryker'
    cat stryker4s.conf
    stryker4s {
    log-level = DEBUG
    reporters = [
      "console"
    ]
    excluded-mutations = [
      "StringLiteral"
    ]
    }

    getting:

    ...
    [info] Defining Test / javaOptions
    [info] The new value will be used by Test / executeTests, Test / forkOptions and 3 others.
    [info]     Run `last` for details.
    [info] Reapplying settings...
    15:29:55.356 [pool-8-thread-2] INFO   - Set stryker logging level to INFO
    15:29:55.721 [pool-8-thread-2] INFO  stryker4s.config.ConfigReader$ - Using stryker4s.conf in the current working directory
    15:30:18.996 [pool-8-thread-2] INFO  stryker4s.mutants.Mutator - Found 30 of 39 file(s) to be mutated.
    15:30:18.996 [pool-8-thread-2] INFO  stryker4s.mutants.Mutator - 928 Mutant(s) generated. Of which 451 Mutant(s) are excluded.
    15:30:21.236 [pool-8-thread-2] INFO  stryker4s.sbt.SbtMutantRunner - Starting initial test run...
    [error] stryker4s.extension.exception.InitialTestRunFailedException: Initial test run failed. Please make sure your tests pass before running Stryker4s.
    [error] (stryker) stryker4s.extension.exception.InitialTestRunFailedException: Initial test run failed. Please make sure your tests pass before running Stryker4s.
    marcindulak
    @marcindulak
    By the way addSbtPlugin("io.stryker-mutator" % "sbt-stryker4s" % "0.2.1") sets the debug level, and print the compilation failure on the screen. Is it a bug or an improper stryker4s usage?
    16:01:25.811 [pool-8-thread-2] INFO  stryker4s.config.ConfigReader$ - Set logging level to DEBUG.
    Hugo van Rijswijk
    @hugo-vrijswijk
    We've changed the logging settings, you can set the log level with the sbt setting logLevel in stryker := Level.Debug
    Could you try setting that and letting us know what goes wrong? There are some known bugs with Scalameta that should be fixed in the next version
    Hugo van Rijswijk
    @hugo-vrijswijk
    The print of the log level being set seems a bit weird. I'll look into that!
    marcindulak
    @marcindulak
    Thanks for looking into it, setting logLevel in stryker := Level.Debug in build.sbt turns on the debug mode, but log-level = debugin stryker4s.conf is ineffective.
    Hugo van Rijswijk
    @hugo-vrijswijk
    Yeah, log-level = debug has been removed (though it's not in an actual release yet). I'll see if I can add a deprecation warning or something
    Were you able to get Stryker4s running/debugged?
    marcindulak
    @marcindulak
    Yes, in the sense of setting logLevel in stryker := Level.Debug in build.sbt turns on the debug mode. It would be nice to have stryker4s.conf checked for correctness, and exit if any configuration settings are wrong.
    Hugo van Rijswijk
    @hugo-vrijswijk
    We already do some checking on the configuration. For example, settings excluded-mutations values that don't exist or incorrect thresholds combinations
    But I agree there are definitely areas where we can improve the configuration!
    Hugo van Rijswijk
    @hugo-vrijswijk
    @/all We have just released Stryker4s v0.3.1, including the Maven plugin, the all new HTML reporter, and a lot of other fixes and improvements! Go check it out:
    Leo
    @leobenkel
    Hello, I am seeing stryker4s.extension.exception.InitialTestRunFailedException: even tho when i do sbt test all my test are passing. Any ideas ?
    Hugo van Rijswijk
    @hugo-vrijswijk
    @leobenkel This could be due to a compile error or tests being run slightly differently in stryker4s.
    You could try enabling logLevel in stryker := Level.Debug
    That might tell you a little more, you might have to exclude a class
    Does the exception tell you anything more?
    Leo
    @leobenkel
    It just says [error] stryker4s.extension.exception.InitialTestRunFailedException: Initial test run failed. Please make sure your tests pass before running Stryker4s. [error] (stryker) stryker4s.extension.exception.InitialTestRunFailedException: Initial test run failed. Please make sure your tests pass before running Stryker4s.
    I am going to try with more logs
    oh i think it is because I had a custom method || to combine two custom classes but I did not have the && so the replacement failed
    Other issue was that I had compiler warning trigger failure
    -Xfatal-warnings
    Leo
    @leobenkel
    its running ! Thanks
    Hugo van Rijswijk
    @hugo-vrijswijk
    Awesome! Good to hear!
    Daniel Westheide
    @dwestheide

    Hey! I have been playing around with using the base-dir config key to get the SBT plugin working in a multi-module project. Unfortunately, I didn't quite get it working. What happened is that the sources to mutate were found, so a few mutants were created, but when the tests were run (both initial test run and running against the mutants), no tests were actually executed, leading to a detection rate of zero percent.

    Has anyone tried this workaround out in the recent past and confirmed that it's working? Maybe I'm just doing something wrong. If you're confident that it should work, I can publish a small example project where it doesn't (for me), so that we can find out what's going on. :)

    Hugo van Rijswijk
    @hugo-vrijswijk
    Hey! Yeah, it should work... Though the last time I've tried it was also a while ago. I can look into it tonight, but a example project would definitely be of help
    Daniel Westheide
    @dwestheide
    @hugo-vrijswijk It turns out I didn't follow the instructions precisely. Instead of sbt "project yourSubmoduleNameHere" stryker I used sbt yourSubmoduleNameHere/stryker. I really thought these were equivalent, but apparently, there is a subtle difference. :)
    Hugo van Rijswijk
    @hugo-vrijswijk
    Wait, there's a difference? I always use the second for running tests...
    Daniel Westheide
    @dwestheide
    I didn't expect there to be a difference either
    Here is an example project: http://github.com/dwestheide/codecov
    You can try comparing the behaviour when running the two commands...
    Max Bo
    @MaxwellBo
    Hi! I'm currently running through https://stryker-mutator.io/stryker4s/quickstart with version 0.6.1. I've tried doing this on 4 seperate projects, and they all throw the same error on a sbt stryker
    sbt:aid-operations> stryker
    01:05:54.916 [pool-34-thread-1] INFO   - Set stryker4s logging level to info
    01:05:54.932 [pool-34-thread-1] INFO  stryker4s.config.ConfigReader$ - Using stryker4s.conf in the current working directory
    [error] java.lang.NoSuchMethodError: scala.meta.io.AbsolutePath$.workingDirectory()Lscala/meta/io/AbsolutePath;
    [error]     at scala.meta.inputs.Input$File$.apply(Input.scala:55)
    [error]     at scala.meta.inputs.Input$.$anonfun$fileToInput$1(Input.scala:92)
    [error]     at scala.meta.common.Convert$$anon$1.apply(Convert.scala:15)
    [error]     at scala.meta.parsers.Api$XtensionParseInputLike.parse(Api.scala:10)
    [error]     at stryker4s.mutants.findmutants.MutantFinder.parseFile(MutantFinder.scala:26)
    [error]     at stryker4s.mutants.findmutants.MutantFinder.mutantsInFile(MutantFinder.scala:15)
    [error]     at stryker4s.mutants.Mutator.findMutants(Mutator.scala:32)
    [error]     at stryker4s.mutants.Mutator.$anonfun$mutate$1(Mutator.scala:17)
    [error]     at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:233)
    [error]     at scala.collection.Iterator.foreach(Iterator.scala:937)
    [error]     at scala.collection.Iterator.foreach$(Iterator.scala:937)
    [error]     at scala.collection.AbstractIterator.foreach(Iterator.scala:1425)
    [error]     at scala.collection.IterableLike.foreach(IterableLike.scala:70)
    [error]     at scala.collection.IterableLike.foreach$(IterableLike.scala:69)
    [error]     at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
    [error]     at scala.collection.TraversableLike.map(TraversableLike.scala:233)
    [error]     at scala.collection.TraversableLike.map$(TraversableLike.scala:226)
    [error]     at scala.collection.AbstractTraversable.map(Traversable.scala:104)
    [error]     at stryker4s.mutants.Mutator.mutate(Mutator.scala:16)
    [error]     at stryker4s.Stryker4s.run(Stryker4s.scala:19)
    [error]     at stryker4s.run.Stryker4sRunner.run(Stryker4sRunner.scala:31)
    [error]     at stryker4s.run.Stryker4sRunner.run$(Stryker4sRunner.scala:17)
    [error]     at stryker4s.sbt.Stryker4sSbtRunner.run(Stryker4sSbtRunner.scala:17)
    [error]     at stryker4s.sbt.Stryker4sMain$.$anonfun$strykerTask$1(Stryker4sMain.scala:37)
    [error]     at scala.Function1.$anonfun$compose$1(Function1.scala:44)
    [error]     at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
    [error]     at sbt.std.Transform$$anon$4.work(System.scala:67)
    [error]     at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
    [error]     at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
    [error]     at sbt.Execute.work(Execute.scala:278)
    [error]     at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
    [error]     at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
    [error]     at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
    [error]     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    [error]     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    [error]     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    [error]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    [error]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    [error]     at java.lang.Thread.run(Thread.java:748)
    [error] (stryker) java.lang.NoSuchMethodError: scala.meta.io.AbsolutePath$.workingDirectory()Lscala/meta/io/AbsolutePath;
    [error] Total time: 1 s, completed 13/08/2019 1:05:55 AM
    Hugo van Rijswijk
    @hugo-vrijswijk
    Hi! Thanks for stopping by. That's certainly surprising. What is sbt version are you running on? And are you running any other sbt plugins?
    I suspect sbt is loading a different scalameta version on the classpath because it is choosing another plugin's version over Stryker4s'
    Would you be able to share a sample project where you are running into this issue?
    Daniel Westheide
    @dwestheide
    Hey! I have seen this error before, when I was experimenting with running stryker4s on various open-source projects. I also suspect that there must be other SBT plugins using a different version of scalameta. Unfortunately, I don't think there is a good way for isolating dependencies of different SBT plugins, but maybe I'm missing something.
    But maybe we should first verify that this is caused by conflicting SBT plugins. @MaxwellBo Could you set up a small SBT project that that makes it possible to reproduce the error?