VinodAnandan / sonar-pitest

43 stars 30 forks source link

kotlin files not visible on sonar #16

Closed sbuisson closed 6 years ago

sbuisson commented 6 years ago

I've a project with a mix of kotlin and java file, only the java files are displayed on the Mutation analysis Measures page.

Just for info: both my java and kotlin file are present in the pitest report: `Main.javasome.Mainmain([Ljava/lang/String;)V10org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator5removed call to java/io/PrintStream::println

MainKotlin.ktsome.Hellohello()V6org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator7removed call to java/io/PrintStream::print

`

sarahBuisson commented 6 years ago

I do a pull request to correct this issue: https://github.com/VinodAnandan/sonar-pitest/pull/17 The pull request pass, the issue in the build is that the sonar cannot be reach.

VinodAnandan commented 6 years ago

17 Fixed

bradflood commented 6 years ago

@sarahBuisson I'm afraid the test coverage over new code has dropped, and in reviewing further, we don't have any unit tests with kotlin mutations in the mutations.xml file.

I looked over at the pitest project and couldn't find any examples there either. Would you be able to provide a mutations.xml file generated from pitest generating mutations on kotlin source?

sbuisson commented 6 years ago

@bradflood I don't understand. Do you want I add test to my PR , or do you just want a mutation.xml?

`<?xml version="1.0" encoding="UTF-8"?>

Main.javasome.Mainmain([Ljava/lang/String;)V12org.pitest.mutationtest.engine.gregor.mutators.ConditionalsBoundaryMutator14changed conditional boundary Main.javasome.Mainmain([Ljava/lang/String;)V13org.pitest.mutationtest.engine.gregor.mutators.IncrementsMutator17Changed increment from 1 to -1 Main.javasome.Mainmain([Ljava/lang/String;)V12org.pitest.mutationtest.engine.gregor.mutators.NegateConditionalsMutator14negated conditional Main.javasome.Mainmain([Ljava/lang/String;)V10org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator5removed call to java/io/PrintStream::println MainKotlin.ktsome.Workdworld()V17org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator7removed call to java/io/PrintStream::print MainKotlin.ktsome.Worldworld()V17org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator7removed call to java/io/PrintStream::print MainKotlin.ktsome.Hellohello()V6org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator7removed call to java/io/PrintStream::print

`

bradflood commented 6 years ago

@sbuisson sorry I wasn't very clear. What you provided is perfect - I'm not familiar with Kotlin and wanted to understand how pitest reported on Kotlin mutations, specifically the mutatedClass and the sourceFile elements. It appears there is no correlation. I'm getting ready to refactor to create SQ issues and need to create some Kotlin tests before I start.

bradflood commented 6 years ago

@sbuisson the just-completed 0.9-SNAPSHOT build has what I believe is first-class support for mutations in Kotlin code. Could you please evaluate and give feedback on whether Kotlin files show mutation info? They will show as Issues with tags "test-quality" and "test-coverage"