0

I am using Jenkins Ver:2.176.3 for declarative multibranch pipeline. I have junit test in my application code base and using maven surefire plugin to run unit test using maven command.

Multibranch job page shows 'Test Result' link and 'Test Result Trend' graph also. I think this is being displayed/published here due to plugin 'test-results-analyzer'.

In declarative pipeline we have two stages as shown in code sample and we use maven commands. Now my problem is that this test result count same unit test for each stage of pipeline so the count of unit tests are being double on this Test Result of Jenkins job page.

I tried skipping unit test in stage 'package-IT' using maven option -DskipTests and as per log it does skip unit testing but still see the duplicate test results.

if know please suggest

stages{ 
                        stage('compile-N-test') {
                            agent {label 'agent'}
                            steps {
                                script {
                                    // mvn clean test
                                }
                            }
                        }

                        stage('packaging-IT') {
                            agent {label 'agent'}                           
                            steps {
                                script {
                                    //mvn verify                                
                                }
                            }
                        }   
Sanjesh M
  • 341
  • 2
  • 6
  • 22
  • Can you try to give either of the command in script of 2nd stage: **mvn verify -Dmaven.test.skip=true** or **mvn verify -DskipTests** – Sourav May 17 '20 at 11:10
  • 2
    Finally i got the solution: in pipeline we are using withMaven() which invoke test result and keep adding it so increasing count. – Sanjesh M May 18 '20 at 22:11
  • @Nicolò Boschi Thanks I am adding this as solution below – Sanjesh M Dec 19 '21 at 03:51

1 Answers1

0

Finally i got the solution: in pipeline we are using withMaven() which invoke test result and keep adding it so increasing count.

Sanjesh M
  • 341
  • 2
  • 6
  • 22