Unable to get Jacoco to work with Powermockito using offline instrumentation

前端 未结 12 1755
醉梦人生
醉梦人生 2020-12-13 01:56

Given that Jacoco doesn\'t play nicely with PowerMockito when instrumenting \"on the fly\", I\'ve been trying to configure offline instrumentation in the hope this will give

12条回答
  •  半阙折子戏
    2020-12-13 02:44

    Use below maven plugin code snippet this works fine in jenkins as well as in local and shows full code coverage for PowermockRunner unit tests

    
                
                    
                        org.jacoco
                        jacoco-maven-plugin
                        ${jacoco-maven-plugin.version}
                        
                            
                                pre-test
                                
                                    prepare-agent
                                
                                
                                    true                           
                                
                            
                            
                                pre-integ-test
                                
                                    prepare-agent-integration
                                
                                
                                    true                           
                                
                            
    
                            
                                jacoco-instrument
                                
                                    instrument
                                
                            
                            
                                jacoco-restore-instrumented-classes
                                
                                    restore-instrumented-classes
                                
                            
                        
                        
                            
                                *
                            
                        
                    
                
            
    

提交回复
热议问题