当前位置:网站首页>Using Jenkins to perform testng+selenium+jsup automated tests and generate extendreport test reports

Using Jenkins to perform testng+selenium+jsup automated tests and generate extendreport test reports

2022-06-26 05:25:00 penngo

The previous article already introduced Maven Integrate TestNG、ExtentReports、Selenium、Jsoup Test project engineering The establishment of the , This paper introduces the use of Jenkins Execute automated test code .

1、Jenkins

1.1 Download and install jenkins

download jenkins:https://www.jenkins.io/download/
start-up Jenkins

java -Xms1024m -Xmx1024m -jar jenkins.war --httpPort=9090

1.2 install HTML Publisher plug-in unit

 Insert picture description here
Modify view HTML File strategy
 Insert picture description here
 Insert picture description here

System.setProperty("hudson.model.DirectoryBrowserSupport.CSP",  "script-src 'unsafe-inline'")

You can make the test report full display style

2、 Use Jenkins Create pipeline tasks

2.1 Create a pipeline

 Insert picture description here
 Insert picture description here

Enter build script code

pipeline {
    
    agent any
    stages {
    
        stage(' Deployment development environment ') {
    
            steps {
    
                bat 'echo  Deployment development environment !'
            }
        }
        stage(' Integration testing ') {
    
            steps {
    
                dir("F:/project/idea_test/extentreports-java/testng_extentreports"){
    
                    bat 'mvn package'
                }
                
            }
        }
    }
    post {
    
        always {
    
            dir("F:/project/idea_test/extentreports-java/testng_extentreports"){
    
                
                publishHTML (target : [allowMissing: false,
                 alwaysLinkToLastBuild: true,
                 keepAll: true,
                 reportDir: 'test-output',
                 reportFiles: 'V3HTML.html',
                 reportName: ' Test report ',
                 reportTitles: 'Html The report '])
            }
                
        }
        
        
    }
}

2.2 structure

 Insert picture description here
Enter the completed build task
 Insert picture description here

2.3 Test report

 Insert picture description here
 Insert picture description here

原网站

版权声明
本文为[penngo]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206260521140536.html