• 【jenkins】jenkins+maven+gitlab+testng,jenkins配置


    电脑版本:windows10企业版

    jenkins配置

    1.general配置,这里的配置比较简单,基本默认就可以了

    2.源码管理

      2.1填写git地址,从你的gitlib项目里去找。不会的自行百度。

       然后将git的公钥配置到gitlab里面【必须要配置,和后面jenkins里面的私钥对应起来】

       2.2点击添加按钮,弹出下面的框,填写git私钥

     

      2.3选择master分支

     3.构建环境和构建触发器,暂时省略,不配,点击立即构建也可以跑起来

    4.构建

    clean install

    5.构建后操作-->测试报告。我选的是allure report。

      备注:先在插件里安装allure report

     6.还需要和工程下的testng.xml文件关联起来,我的是maven工程

    <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>ppwx</groupId>
    	<artifactId>autotest</artifactId>
    	<version>0.0.1-SNAPSHOT</version>
    	<packaging>jar</packaging>
    	<name>test</name>
    	<url>http://maven.apache.org</url>
    	<properties>
    		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    		<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
    	</properties>
    	<dependencies>
    		<!--此处省略-->
    	</dependencies>
    
    	<build>
    		<finalName>Test</finalName>
    		<plugins>
    			<plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-surefire-plugin</artifactId>
    				<configuration>
    					<systemPropertyVariables>
    						<org.uncommons.reportng.escape-output>false</org.uncommons.reportng.escape-output>
    					</systemPropertyVariables>
    					<forkMode>once</forkMode>
    					<argLine>-Dfile.encoding=UTF-8</argLine>
    					<suiteXmlFiles>
    						<suiteXmlFile>./testng.xml</suiteXmlFile>
    					</suiteXmlFiles>
    					<workingDirectory>target/</workingDirectory>
    				</configuration>
    			</plugin>
    		</plugins>
    	</build>
    
    
    
    </project>
    

    配置完后,重启jenkins,重启电脑(比较保险,有时不重启,不生效)  

    然后我们来看看执行结果

    如果allure report没有生成,看一下全局设置里。把这里配置一下。

  • 相关阅读:
    PHP流程控制考察点
    PHP运算符考察点
    PHP的魔术常量
    android窗体溢出WindowManager$BadTokenException: Unable to add window -- token null is not for an applica
    android网络访问异常java.lang.SecurityException: Permission denied (missing INTERNET permission?)
    快速排序算法思想
    播放Assets下的指定音频时,变成播放所有音频了
    python-01-Python环境搭建
    eclipse安装svn
    DOM children方法
  • 原文地址:https://www.cnblogs.com/Jourly/p/10469780.html
Copyright © 2020-2023  润新知