szpak / gradle-pitest-plugin

Gradle plugin for PIT Mutation Testing
http://gradle-pitest-plugin.solidsoft.info/
213 stars 58 forks source link

skipFailingTests not recognized #175

Closed idosal closed 4 years ago

idosal commented 4 years ago

Gradle version: 5.1.1 and 6.1.1 gradle-pitest-plugin: 1.4.6 pitest-junit5-plugin: 0.8 and 0.12

Running 'pitest' task produces the following output: >>>> skipFailingTests is not a recognized option without running the tests. When I look at PitestPluginExtension.groovy this property exists.

Gradle setup:

buildscript {
    repositories {
        mavenCentral()
    }
    configurations.maybeCreate('pitest')

    dependencies {
        classpath('info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.4.6')
        pitest 'org.pitest:pitest-junit5-plugin:0.12'
    }
}

plugins {
    id 'info.solidsoft.pitest' version '1.4.6'
}

pitest {
    skipFailingTests.set(true)
}

Full Gradle output:

> Task :pitest
Option (* = required)                   Description      
---------------------                   -----------      
-?, -h                                  show help        
--avoidCallsTo <comma separated list                     
  of packages to consider as                             
  untouchable logging calls>                             
--classPath <coma separated list of                      
  additional classpath elements>                         
--classPathFile <File: File with a                       
  list of additional classpath                           
  elements (one per line)>                               
--coverageThreshold <Integer: Line      (default: 0)     
  coverage below which to throw an                       
  error>                                                 
--dependencyDistance <Integer: maximum  (default: -1)    
  distance to look from test for                         
  covered classes>                                       
--detectInlinedCode [Boolean: whether   (default: true)  
  or not to try and detect code                          
  inlined from finally blocks]                           
--excludedClasses <comma separated                       
  list of globs for classes to exclude                   
  when mutating>                                         
--excludedGroups <TestNG groups/JUnit                    
  categories to include>                                 
--excludedMethods <comma separated                       
  list of filters to match against                       
  methods to exclude from mutation                       
  analysis>                                              
--excludedTestClasses <comma separated                   
  list of globs of test classes to                       
  exclude>                                               
--exportLineCoverage [Boolean: whether  (default: true)  
  or not to dump per test line                           
  coverage data to disk]                                 
--failWhenNoMutations [Boolean:         (default: true)  
  whether to throw error if no                           
  mutations found]                                       
--features <comma separated list of                      
  features to enable/disable.>                           
--fullMutationMatrix <Boolean: Whether  (default: false) 
  to create a full mutation matrix>                      
--historyInputLocation <File: File to                    
  read history from for incremental                      
  analysis>                                              
--historyOutputLocation <File: File to                   
  write history to for incremental                       
  analysis>                                              
--includeLaunchClasspath [Boolean:      (default: true)  
  whether or not to analyse launch                       
  classpath]                                             
--includedGroups <TestNG groups/JUnit                    
  categories to include>                                 
--includedTestMethods <Test methods                      
  that should be included for                            
  challenging the mutants>                               
--jvmArgs <comma separated list of                       
  child JVM args>                                        
--jvmPath <path to java executable>                      
--maxMutationsPerClass <Integer: No     (default: 0)     
  longer supported. Use CLASSLIMIT                       
  (limit[42]) feature instead>                           
--maxSurviving <Integer: Maximum        (default: -1)    
  number of surviving mutants to allow                   
  without throwing an error>                             
--mutableCodePaths <Globs identifying                    
  classpath roots containing mutable                     
  code>                                                  
--mutationEngine <mutation engine to    (default: gregor)
  use>                                                   
--mutationThreshold <Integer: Mutation  (default: 0)     
  score below which to throw an error>                   
--mutationUnitSize <Integer: Maximum    (default: 0)     
  number of mutations to include                         
  within a single unit of analysis>                      
--mutators <comma separated list of                      
  mutation operators>                                    
--outputFormats <comma separated list   (default: HTML)  
  of listeners to receive mutation                       
  results>                                               
--pluginConfiguration <KeyValuePair:                     
  custom plugin properties>                              
* --reportDir <directory to create                       
  report folder in>                                      
* --sourceDirs <File: comma separated                    
  list of source directories>                            
* --targetClasses <comma separated                       
  list of filters to match against                       
  classes to test>                                       
--targetTests <comma separated list of                   
  filters to match against tests to                      
  run>                                                   
--testPlugin <test plugin to use>       (default: junit) 
--threads <Integer: number of threads   (default: 1)     
  to use for testing>                                    
--timeoutConst [Long: constant to       (default: 4000)  
  apply to calculate maximum test                        
  duration]                                              
--timeoutFactor [Float: factor to       (default: 1.25)  
  apply to calculate maximum test                        
  duration]                                              
--timestampedReports [Boolean: whether  (default: true)  
  or not to generated timestamped                        
  directories]                                           
--useClasspathJar [Boolean: support     (default: false) 
  large classpaths by creating a                         
  classpath jar]                                         
--verbose [Boolean: whether or not to   (default: true)  
  generate verbose output]                               
>>>> skipFailingTests is not a recognized option

BUILD SUCCESSFUL in 4s
szpak commented 4 years ago

Thanks for your report. I took a look at it and in fact that feature was implemented only for the Maven plugin. It is required to add a few more things in PIT itself to support command line arguments (which are used by the Gradle plugin).

I will create a PR in PIT to have it included in the next version (1.4.12).

szpak commented 4 years ago

The PR has been merged upstream. @idosal You can play with the snapshot to verify it works for you.

buildscript {
    repositories {
        mavenCentral()
        //Needed only for SNAPSHOT versions
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
    }
    dependencies {
        classpath 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.4.6'
    }
}
pitest {
    pitestVersion = "1.5.1-SNAPSHOT"
}
idosal commented 4 years ago

It works. Thanks!