pitest / pitclipse

Mutation testing for Java in Eclipse IDE. Based on PIT (Pitest).
https://pitest.org
Apache License 2.0
59 stars 17 forks source link

NPE #58

Closed Bananeweizen closed 9 years ago

Bananeweizen commented 9 years ago

I have one plugin project in a large Eclipse workspace, where the PIT launch config throws an NPE, independent of whether I try running it on a test, package, source folder or what else. It works fine for other similar projects in the same workspace. There are no related entries in the error log view or workspace log file. Anything I could check, enable more logging/tracing to see what caused the exception?

The only thing that I think might be important: This is an Eclipse test fragment, so the classes to be tested are in another Eclipse plugin project. Nevertheless, that same setup works for other similar tests.

Connecting to: localhost/127.0.0.1:51871
Connected
Received request: PitRequest [options=PitOptions [reportDir=D:\development\CODER\workspace\.metadata\.plugins\org.pitest.pitclipse.core\html_results, classUnderTest=com.etas.esdl.concurrent.utils.FromByteStreamTest, classesToMutate=[], sourceDirs=[D:\development\CODER\git\project33\tests\com.etas.esdl.concurrent.tests\src\test\java], packages=[], threads=8, historyLocation=null, excludedClasses=[], excludedMethods=[], avoidCallsTo=[java.util.logging, org.apache.log4j, org.slf4j, org.apache.commons.logging], mutators=[DEFAULTS], timeoutConst=3000, timeoutFactor=1.25], projects=[com.etas.esdl.concurrent.tests]]
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>                                               
--configFile <The name of the config                                           
  file to use.>                                                                
--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 looking for both mutation                                               
  target and tests>                                                            
--excludedGroups <TestNG groups/JUnit                                          
  categories to include>                                                       
--excludedMethods <comma separated                                             
  list of filters to match against                                             
  methods to exclude from mutation                                             
  analysis>                                                                    
--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]                                                             
--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>                                                       
--jvmArgs <comma separated list of                                             
  child JVM args>                                                              
--jvmPath <path to java executable>                                            
--maxMutationsPerClass <Integer: max    (default: 0)                           
  number of mutations to allow for                                             
  each class>                                                                  
--mutableCodePaths <Globs identifying                                          
  classpath roots containing mutable                                           
  code>                                                                        
--mutateStaticInits [Boolean: whether   (default: true)                        
  or not to generate mutations in                                              
  static initializers]                                                         
--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>                                                                     
* --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>                                                                         
--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]                                                                 
--verbose [Boolean: whether or not to   (default: true)                        
  generate verbose output]                                                     
>>>> Missing required option ['targetClasses']
Closing server
Closed
Exception in thread "main" java.lang.NullPointerException
    at org.pitest.pitclipse.pitrunner.PitResults$Builder.checkFileExists(PitResults.java:55)
    at org.pitest.pitclipse.pitrunner.PitResults$Builder.withHtmlResults(PitResults.java:49)
    at org.pitest.pitclipse.pitrunner.PitRunner.runPIT(PitRunner.java:54)
    at org.pitest.pitclipse.pitrunner.PitRunner.main(PitRunner.java:28)
philglover commented 9 years ago

Sorry for the delay in looking at this. The problem, as you correctly suggest, is because there is no code in this project at all - see the value classesToMutate=[] in the output. Do you have the worskapce level testing option set?

Bananeweizen commented 9 years ago

Thanks for that hint. I wasn't even aware of those preferences. No more exception now.