国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Jenkins+maven+testng+htmlreport單元自動化測試

這篇具有很好參考價值的文章主要介紹了Jenkins+maven+testng+htmlreport單元自動化測試。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

背景說明

為了可以在jenkins自動化運行單元測試的代碼,所以使用maven+testng的技術(shù)結(jié)合,達到手動或者定時去執(zhí)行單元測試的代碼,以便提高人工運行的自動化的效率。單元通過該方案也可以套用在httpclient框架去執(zhí)行測試web api接口的自動化測試,原理是一致的。

環(huán)境準備

  1. 安裝開發(fā)工具:eclipse開發(fā)工具
  2. 安裝maven:在官方下載maven在開發(fā)環(huán)境和jenkins環(huán)境都需要安裝配置,下載地址:Maven – Download Apache Mavenhttps://maven.apache.org/download.cgi
  3. 安裝jenkins服務(wù):Jenkins
  4. 安裝jdk1.7以上的版本:Java Downloads | Oracle

代碼結(jié)構(gòu)

Jenkins+maven+testng+htmlreport單元自動化測試,JAVA,自動化測試,接口測試,jenkins,maven,運維,unit testing,java,http

配置pom.xml

創(chuàng)建測試項目時,以maven類型項目創(chuàng)建

<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>jenkins.testng.demo</groupId>
	<artifactId>TestDemo</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>TestDemo</name>
	<url>http://maven.apache.org</url>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>
	
	<build>
	    <plugins>
            <!-- 加入maven-surefire-plugin插件用來使用maven執(zhí)行用例,其中suiteXmlFile配置的就是testNG用例執(zhí)行文件的地址 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
                <configuration>
                    <!--          忽略測試錯誤,繼續(xù)編譯         -->
                    <testFailureIgnore>true</testFailureIgnore>
                    <suiteXmlFiles>
                        <suiteXmlFile>src/main/java/jenkins/testng/demo/TestngSample/testng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                    <!-- 加入編碼設(shè)置,否則生成的報告會中文亂碼 -->
                    <argLine>-Dfile.encoding=UTF-8</argLine>
                </configuration>
            </plugin>
          </plugins>
	</build>
	
	
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<scope>test</scope>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin -->
		<dependency>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-surefire-plugin</artifactId>
			<version>3.0.0-M5</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.apache.maven/maven-plugin-api -->
		
		<dependency>
			<groupId>org.apache.maven</groupId>
			<artifactId>maven-plugin-api</artifactId>
			<version>3.6.3</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.apache.maven/maven-artifact -->
		<dependency>
			<groupId>org.apache.maven</groupId>
			<artifactId>maven-artifact</artifactId>
			<version>3.6.3</version>
		</dependency>


		<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
		<dependency>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<version>3.8.1</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.apache.maven.plugin-tools/maven-plugin-annotations -->
		<dependency>
			<groupId>org.apache.maven.plugin-tools</groupId>
			<artifactId>maven-plugin-annotations</artifactId>
			<version>3.6.0</version>
			<scope>provided</scope>
		</dependency>


		<!-- https://mvnrepository.com/artifact/org.testng/testng -->
		<dependency>
			<groupId>org.testng</groupId>
			<artifactId>testng</artifactId>
			<version>7.1.0</version>
			<scope>test</scope>
		</dependency>


		<!-- https://mvnrepository.com/artifact/org.uncommons/reportng -->
		<dependency>
			<groupId>org.uncommons</groupId>
			<artifactId>reportng</artifactId>
			<version>1.1.4</version>
			<scope>test</scope>
		</dependency>

	</dependencies>
</project>

測試代碼

package jenkins.testng.demo.TestngSample;
import static org.testng.Assert.assertEquals;
import org.testng.annotations.Test;

public class TestDemong {
	
	@Test
	public void demo() {
		assertEquals(true, true);
		
	}
	
	@Test
	public void demo2() {
		assertEquals(true, true);
		
	}

}

配置testng.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
<suite name="test">
	<test name="test">
		<classes>
			<class name="jenkins.testng.demo.TestngSample.TestDemong">
			</class>
		</classes>
	</test>
	<listeners>
		<listener class-name="org.uncommons.reportng.HTMLReporter" />
		<listener
			class-name="org.uncommons.reportng.JUnitXMLReporter" />
	</listeners>
</suite>

配置jenkins

Jenkins+maven+testng+htmlreport單元自動化測試,JAVA,自動化測試,接口測試,jenkins,maven,運維,unit testing,java,http

Jenkins+maven+testng+htmlreport單元自動化測試,JAVA,自動化測試,接口測試,jenkins,maven,運維,unit testing,java,http

Jenkins+maven+testng+htmlreport單元自動化測試,JAVA,自動化測試,接口測試,jenkins,maven,運維,unit testing,java,http

Jenkins+maven+testng+htmlreport單元自動化測試,JAVA,自動化測試,接口測試,jenkins,maven,運維,unit testing,java,http

Jenkins+maven+testng+htmlreport單元自動化測試,JAVA,自動化測試,接口測試,jenkins,maven,運維,unit testing,java,http

運行查看

Jenkins+maven+testng+htmlreport單元自動化測試,JAVA,自動化測試,接口測試,jenkins,maven,運維,unit testing,java,http

Jenkins+maven+testng+htmlreport單元自動化測試,JAVA,自動化測試,接口測試,jenkins,maven,運維,unit testing,java,http文章來源地址http://www.zghlxwxcb.cn/news/detail-694326.html

到了這里,關(guān)于Jenkins+maven+testng+htmlreport單元自動化測試的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔相關(guān)法律責任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • Jenkins+Maven+Gitlab+Tomcat 自動化構(gòu)建打包,部署

    Jenkins+Maven+Gitlab+Tomcat 自動化構(gòu)建打包,部署

    1、安裝服務(wù) Jenkins工具、環(huán)境、插件配置 全局變量配置 Manage JenkinstoolsJDK 安裝 安裝插件 Deploy to container 安裝此插件,才能將打好的包部署到tomcat上 ? ? 配置國內(nèi)mvn源 創(chuàng)建maven項目 1 ?2 ? 3? ? 4? ? 5? ? 6? ? 7? ? 8? ? ?9 10 ?

    2024年02月05日
    瀏覽(33)
  • Jenkins + Gitee + Maven 自動化部署 Spring Boot

    Jenkins + Gitee + Maven 自動化部署 Spring Boot

    目錄 1、前言 1?.1、插件簡介 1.2、插件安裝 2、創(chuàng)建Maven項目 2.1、新建一個全新的項目 2.2、拷貝已有項目 3、項目配置 3.1 、General 3.2、源碼管理 3.3、構(gòu)建觸發(fā)器 3.4、構(gòu)建環(huán)境 3.5、Pre Steps 3.6、Build 1)Root POM 2)Goals and options 3)【高級】 3.7、Pre Steps 3.8、構(gòu)建環(huán)境 3.9、Post Ste

    2024年02月08日
    瀏覽(42)
  • 詳細步驟記錄:持續(xù)集成Jenkins自動化部署一個Maven項目

    詳細步驟記錄:持續(xù)集成Jenkins自動化部署一個Maven項目

    提示:本教程基于CentOS Linux 7系統(tǒng)下進行 1. 下載安裝jdk11 官網(wǎng)下載地址:https://www.oracle.com/cn/java/technologies/javase/jdk11-archive-downloads.html 本文檔教程選擇的是jdk-11.0.20_linux-x64_bin.tar.gz 解壓jdk-11.0.20_linux-x64_bin.tar.gz命令為: 2. 下載Jenkins的war包 官網(wǎng)下載地址:https://mirrors.tuna.tsing

    2024年02月04日
    瀏覽(62)
  • 2023全網(wǎng)最細最全保姆級gitlab+Jenkins+maven自動化部署springboot項目教程

    2023全網(wǎng)最細最全保姆級gitlab+Jenkins+maven自動化部署springboot項目教程

    如果沒有Linux基礎(chǔ)請仔細看好每一個步驟,避免出錯,從0到1帶你搭建自動化部署環(huán)境,包括服務(wù)器安裝,自動化部署所需各類軟件安裝配置,詳細貼出每一步,不斷步驟,讓你一次搭建部署完成,希望這篇文章能給大家?guī)硪欢ǖ膸椭?話不多說開始整 2.0 CentOs安裝 2.0.1 下載VM虛擬機 我直

    2024年02月08日
    瀏覽(62)
  • UI自動化測試篇 :Selenium2(Webdriver)&TestNG自動化測試環(huán)境搭建

    UI自動化測試篇 :Selenium2(Webdriver)&TestNG自動化測試環(huán)境搭建

    ??? 交流討論: 歡迎加入我們一起學習! ?? 資源分享 : 耗時200+小時精選的「軟件測試」資料包 ??? 教程推薦: 火遍全網(wǎng)的《軟件測試》教程?? ?? 歡迎點贊 ?? 收藏 ?留言 ?? 如有錯誤敬請指正! ?? 最開始學習UI自動化,用的工具是QTP10,用起來確實比較容易上手

    2024年03月10日
    瀏覽(31)
  • Java+Selenium+Testng自動化學習(一):環(huán)境搭建

    Java+Selenium+Testng自動化學習(一):環(huán)境搭建

    目錄 一、軟件準備及版本介紹? 二、安裝步驟及環(huán)境變量配置:? 2.1? ? Java安裝及配置 2.2? ? IDE工具(Intellij IDEA)安裝 2.3? ? Maven安裝及配置 2.4? ? Maven本地倉庫配置 2.5? ? Intellij IDEA配置mvn倉庫 2.6? ? Intellij IDEA創(chuàng)建maven項目 2.7? ? Selenium安裝 2.8? ? TestNG安裝 2.9? ? Chr

    2024年02月05日
    瀏覽(29)
  • 0基礎(chǔ)→自動化測試框架實現(xiàn):java + testng + httpclient + allure

    0基礎(chǔ)→自動化測試框架實現(xiàn):java + testng + httpclient + allure

    必備基礎(chǔ) java基礎(chǔ):https://www.cnblogs.com/uncleyong/p/15828510.html 配置文件解析(properties):https://www.cnblogs.com/uncleyong/p/15867779.html fastjson的使用(處理json字符串、json數(shù)組):https://www.cnblogs.com/uncleyong/p/16683578.html jsonpath的使用:https://www.cnblogs.com/uncleyong/p/16676791.html java操作excel(通過POI):

    2024年02月16日
    瀏覽(18)
  • 無界面自動化測試(IDEA+Java+Selenium+testng)(PhantomJS)

    無界面自動化測試(IDEA+Java+Selenium+testng)(PhantomJS)

    自動化測試(IDEA+Java+Selenium+testng)(PhantomJS)_phantomjs怎么寫js腳本idea-CSDN博客 上述連接是參考:現(xiàn)在如果按照如上鏈接進行操作大概率會失敗,下面會針對如上鏈接的部分步驟做出修改 1、在pom.xml文件中需要使用低版本selenium-java依賴包,目前我使用的是4.13.0版本的所以在運行

    2024年01月18日
    瀏覽(22)
  • java基礎(chǔ) - 實現(xiàn)一個簡單的Http接口功能自動化測試框架(HttpClient + TestNG)

    java基礎(chǔ) - 實現(xiàn)一個簡單的Http接口功能自動化測試框架(HttpClient + TestNG)

    已知現(xiàn)在已經(jīng)用Spring boot框架搭建了一個簡單的web服務(wù),并且有現(xiàn)成的Controller來處理http請求,以之前搭建的圖書管理服務(wù)為例,BookController的源碼如下: 在搭建一個Http接口功能自動化測試框架之前,我們需要思考幾個問題: 1、http請求的發(fā)送,使用什么實現(xiàn)? 2、接口返回的

    2024年02月05日
    瀏覽(28)
  • java+Selenium+TestNg搭建自動化測試架構(gòu)(3)實現(xiàn)POM(page+Object+modal)

    java+Selenium+TestNg搭建自動化測試架構(gòu)(3)實現(xiàn)POM(page+Object+modal)

    1.Page Object是Selenium自動化測試項目開發(fā)實踐的最佳設(shè)計模式之一,通過對界面元素的封裝減少冗余代碼,同時在后期維護中,若元素定位發(fā)生變化,只需要調(diào)整頁面元素封裝的代碼,提高測試用例的可維護性。 PageObject設(shè)計模式:是將某個頁面的所有\(zhòng)\\"元素(包含控件)屬性

    2024年02月06日
    瀏覽(25)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包